prefill: STRATA_MMQ_DIRECT=1 reads resident experts in their cache slots (pointer-table MMQ)

mmq_plan marks a native layer direct when the pointer-table MMQ covers both products, gate/up
reads nothing past its matrix, the down over-read (72 B IQ4_NL, 136 B Q8_0) fits the 256 B
guard, and the blob is exactly [gate | up | down] in MMQ's matrix sizes; it says once how many
layers qualify.

In the MoE walk (both the staged and the streamed walk) compute() takes the expert's cache slot:
a resident expert whose slot has room for the over-read (slot_tail) and a 16-byte aligned blob
is not gathered - the group's pointer tables point at its gate|up and down in the slot, and the
guard goes into the group's GuardTab. Streamed, peer and unguarded experts are gathered as
before, at compact positions c = 0..ns-1 (gather_native, or gather_native_group with its
mid-group flushes unchanged); the end-of-group flush runs even when the last entry was direct.
At the group end one prep_group launch zeroes the direct experts' guards and the tails after
position ns, replacing the two memsets; both products run with the same n, bounds, ids,
max_rows and buffers plus .tab. STRATA_MMQ_DIRECT=0 (default) and 2 run the existing body.

PrefillStats::experts_direct, said on the generate summary when non-zero.
This commit is contained in:
havok2-htwo authored and Niko1221 committed 2026-10-14 06:56:48 +02:00
1 parent b82cdb1090
commit 7d9b50dc1a
3 files changed
+94 -7

No files matched your search

+3
View File
@@ -13348,6 +13348,9 @@ int main(int argc, char** argv) {
ps.ms_total > 0 ? 1000.0 * (double) ps.tokens / ps.ms_total : 0.0, (long long) ps.experts_streamed,
(long long) ps.experts_dma, ps.ms_experts_host, (long long) ps.experts_resident,
(long long) ps.experts_cpu, ps.cpu_share, ps.ms_ple);
if (ps.experts_direct > 0)
std::fprintf(stderr, "strata generate: prompt MMQ read %lld of the %lld resident experts in their slots "
"(STRATA_MMQ_DIRECT)\n", (long long) ps.experts_direct, (long long) ps.experts_resident);
}
if (!kvg_started) { // the elastic K/V of a prompt that was not read in batches