place: routing-aware file-tier reads

The file tier read every file-tier unit of a routed layer whether or not
the router sent rows to it. A deep layer keeps whole experts on the drive
(288 per world), but a pass routes rows to a handful of them: the read
volume was ~18x what the router justified, and the engine streamed
~378 GiB from the SSD per run at 2.05 tok/s (GLM-5.3-Flash, TP2).

The layer's router has run by the time the stager triggers -- the
trigger is the layer's first expert op -- so the pass's route counts are
already on the device. Ctx::route_counts_device exposes them; the file
stager hands them to Mover::stage_file_units, and an expert counted
zero, which has no sorted rows and no GEMM run naming it, is left on the
drive: its weights are not read at all. Its table entries are published
at a valid dummy address (the calm region) for the pass and nulled again
with the staged units, because the kernels still issue the layer's table
and a null entry fails the step. Published even when EVERY unit of the
layer is skipped -- a decode step can route nothing to a layer.

The drafter's own weights (the "mtp." namespace) run on every draft pass
of every decode step, more often than anything a profile could rank, so
the planner pins them in the host pool ahead of everything ranked
(MoveUnit::draft_head) instead of letting the expert fill push them to
the file tier every step.

Read extents are also clamped to the container file's size, so a
truncated container fails a read loudly instead of reading past EOF.

Measured on GLM-5.3-Flash TP2 (2x Radeon R9700), 250-token essay at
temp 0: 3.4-3.6 tok/s where main gives 1.42 on the same prompt.

Assisted-by: GLM-5.3-Flash
This commit is contained in:
overchop authored and StillDeadcode committed 2026-10-30 15:02:09 +01:00
1 parent 9647b84ee0
commit 9efdd00c4c
9 files changed
+208 -24

No files matched your search

+7 -2
View File
@@ -3828,8 +3828,13 @@ int Engine::start() {
r->stager.n_layers(), (int)PrefillStager::lead());
}
/* The file stager, wherever a routed expert is on the file tier (static or dynamic plan;
* such a unit has no other address). */
RAD_TRY(r->fstager.init(r->program, r->plan, &r->mover));
* such a unit has no other address). Routing-aware reads take this
* rank's routing reports: the trigger runs after the layer's router on the same stream. */
RAD_TRY(r->fstager.init(r->program, r->plan, &r->mover,
[](void* ud, int32_t layer, int64_t* n) -> const int32_t* {
return ((Ctx*)ud)->route_counts_device(layer, n);
},
&r->ctx));
if (r->fstager.enabled() && r->index == 0)
RAD_INFO("file stager: %zu routed layers hold experts read from the container; each "
"pass reads a layer's (up to %s) into one of two VRAM buffers before its "