prain: pin the RAM tier per expert (big pinned blocks take minutes on eGPU hosts); sim charges disk reads on the CPU path; measure CPU cost on cold experts

This commit is contained in:
2026-10-28 00:33:34 +01:00
parent 01dce2ffc6
commit 16c3bf81f7
4 changed files with 31 additions and 13 deletions
+8
View File
@@ -57,6 +57,14 @@ class Simulate(unittest.TestCase):
copy = self.run_sim().ms_per_decode
self.assertLess(self.run_sim(miss=Miss(mode="auto")).ms_per_decode, copy)
def test_cpu_path_pays_the_disk_read_of_disk_experts(self):
on_disk = {layer: LayerPlacement((), (), tuple(range(32)), 3) for layer in range(4)}
cpu = Miss(mode="cpu", admit=0)
ram = simulate(self.forwards, all_ram(3), Policy(), Prefetch(), cpu, Cost())
disk = simulate(self.forwards, on_disk, Policy(), Prefetch(), cpu, Cost())
self.assertAlmostEqual(disk.total_ms - ram.total_ms, ram.counters["cpu"] * Cost().read_ms(),
places=3)
def test_prefetch_helps_when_predictions_are_right(self):
none = self.run_sim().hit_rate
good = self.run_sim(prefetch=Prefetch(mode="pregate", budget=4))