[GH-ISSUE #1549] Prompt reading is 72x slower when experts come from the host mirror, and ~48x off the PCIe bound #618

Closed
opened 2026-11-04 01:44:32 +07:00 by bsakaguchi · 18 comments
Owner

Originally created by @demetree on GitHub (Oct 8, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1549

The prompt path collapses when experts come from the host mirror, and not at the PCIe bound

The host mirror (plan item 2: experts that do not fit in VRAM read from pinned host memory over PCIe instead of the
SSD) works well for decode. It does not work for the prompt, and the gap is much larger than bandwidth can explain.

Arc Pro B70 32 GB, Windows, OpenCL backend, Qwen3.8-Flash-Next-GSQ-RCO, --spec 4 --mtp, greedy, medians of two
interleaved runs where both rows are the same build:

experts in VRAM decode, 2,048-token prompt decode, 3-token prompt prompt reading, 2,048 tokens
IQ1_M 23.42 GiB, all resident 43.6 tok/s 76.4 tok/s 74.7 tok/s
IQ3_XXS 39.97 GiB, 17,687 of 24,576 resident + 6,889 (11.15 GiB) mirrored 30.0 tok/s 19.2 tok/s 1.03 tok/s

Decode absorbs the misses - 30 tok/s with 28% of the experts over PCIe is a reasonable price, and the device-built
verify plan points the expert kernels straight at the mirror. The prompt does not: 1.03 tok/s is a 72x drop, and one
2,048-token prompt took 1,987,881 ms (33 minutes), of which 1,988,700 ms was the wait for the first token - it is all in
the prefill, which the 4,096-row chunk handles in one pass.

The ratio is the interesting part. If each layer simply streamed the mirrored experts it needed over PCIe, 11.15 GiB
per layer across 48 layers is ~535 GiB, which at the 13.3 GB/s host-to-device I measured on this machine is ~41 s, not
1,988 s. So the mirror's prompt reads are ~48x off the bandwidth bound: they do not look pipelined the way the decode
plan's are. For reference, Prefill::prefill.cpp already carries a note that "part of the model in the host mirror a
short first chunk costs a whole extra pass of that stream", and g_pinned_share drops the staging ring to 96 slots when
less than 90% of the streamed experts are pinned - the design expects streamed experts to go through a small host-copy
ring, so a fully pinned mirror may be hitting a path that was tuned for the other case.

What I checked

The mirror is wired into both paths, so this is not a missing wire: resident_plan_set_mirror() gives the verify plan
its per-layer mirror addresses, and the prefill reads a mirrored expert with m.src->pinned(l, e) ->
m.src->blob(l, e) rather than staging it. The engine also knows the difference is not bandwidth-sized - the
existing all-resident forced test in docs/INTEL.md measures 3.6 GiB of misses costing ~6% of decode, and 3.6 GiB here
would be a few percent, not 72x.

What would help

A profile of one prefill chunk with and without the mirror would say where the 48x goes - most likely either the
per-expert launches not being enqueued far enough ahead, or the chunk re-reading the same mirrored expert once per
row-block. The number that would confirm it is bytes moved per second over PCIe during the prefill: 535 GiB in 1,988 s
is 270 MB/s, about 2% of the link.

For anyone choosing a model on a card this size in the meantime: a model that fits entirely in VRAM is fine on both
paths, and one that does not is decode-usable and prompt-useless. That is worth knowing before choosing one.

Originally created by @demetree on GitHub (Oct 8, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/1549 ### The prompt path collapses when experts come from the host mirror, and not at the PCIe bound The host mirror (plan item 2: experts that do not fit in VRAM read from pinned host memory over PCIe instead of the SSD) works well for decode. It does not work for the prompt, and the gap is much larger than bandwidth can explain. Arc Pro B70 32 GB, Windows, OpenCL backend, Qwen3.8-Flash-Next-GSQ-RCO, `--spec 4 --mtp`, greedy, medians of two interleaved runs where both rows are the same build: | | experts in VRAM | decode, 2,048-token prompt | decode, 3-token prompt | prompt reading, 2,048 tokens | |---|---|---|---|---| | IQ1_M | 23.42 GiB, **all resident** | 43.6 tok/s | 76.4 tok/s | **74.7 tok/s** | | IQ3_XXS | 39.97 GiB, 17,687 of 24,576 resident + 6,889 (11.15 GiB) mirrored | 30.0 tok/s | 19.2 tok/s | **1.03 tok/s** | Decode absorbs the misses - 30 tok/s with 28% of the experts over PCIe is a reasonable price, and the device-built verify plan points the expert kernels straight at the mirror. The prompt does not: 1.03 tok/s is a 72x drop, and one 2,048-token prompt took 1,987,881 ms (33 minutes), of which 1,988,700 ms was the wait for the first token - it is all in the prefill, which the 4,096-row chunk handles in one pass. The ratio is the interesting part. If each layer simply streamed the mirrored experts it needed over PCIe, 11.15 GiB per layer across 48 layers is ~535 GiB, which at the 13.3 GB/s host-to-device I measured on this machine is ~41 s, not 1,988 s. So the mirror's prompt reads are ~48x off the bandwidth bound: they do not look pipelined the way the decode plan's are. For reference, `Prefill::prefill.cpp` already carries a note that "part of the model in the host mirror a short first chunk costs a whole extra pass of that stream", and `g_pinned_share` drops the staging ring to 96 slots when less than 90% of the streamed experts are pinned - the design expects streamed experts to go through a small host-copy ring, so a *fully pinned* mirror may be hitting a path that was tuned for the other case. ### What I checked The mirror is wired into both paths, so this is not a missing wire: `resident_plan_set_mirror()` gives the verify plan its per-layer mirror addresses, and the prefill reads a mirrored expert with `m.src->pinned(l, e)` -> `m.src->blob(l, e)` rather than staging it. The engine also *knows* the difference is not bandwidth-sized - the existing all-resident forced test in docs/INTEL.md measures 3.6 GiB of misses costing ~6% of decode, and 3.6 GiB here would be a few percent, not 72x. ### What would help A profile of one prefill chunk with and without the mirror would say where the 48x goes - most likely either the per-expert launches not being enqueued far enough ahead, or the chunk re-reading the same mirrored expert once per row-block. The number that would confirm it is bytes moved per second over PCIe during the prefill: 535 GiB in 1,988 s is 270 MB/s, about 2% of the link. For anyone choosing a model on a card this size in the meantime: a model that fits entirely in VRAM is fine on both paths, and one that does not is decode-usable and prompt-useless. That is worth knowing before choosing one.
Author
Owner

@demetree commented on GitHub (Oct 8, 2026):

Not a general property of the mirror - my measurements were on the OpenCL/eager-replay backend

TeppeiLan1104 measured this on a machine whose driver exposes a user-mode Level Zero adapter (Windows 11, driver
32.0.101.8864, UR over Level Zero V2), so command graphs and oneMKL are both live there, and the prompt path with a
large mirror is fine:

model (one B70, graphs) decode, short prompt, 2,391 tokens decode after it
Coder IQ1_M 82.0 tok/s 758 tok/s 79.3 tok/s
Flash-Next IQ2_XS (8.7 GiB mirrored) 81.5 718 79.0
Flash-Next IQ3_XXS (16.1 GiB mirrored) 73.3 648 73.7
Flash-Next IQ3_S (23.4 GiB mirrored) 64.2 570 68.1

So 648 tok/s with 16.1 GiB mirrored, against the 1.03 tok/s I measured. That is not the mirror - that is my backend,
and the difference between the two setups is graphs plus eager replay, not the mirror table.

What I measured is still real, and still worth something: with the OpenCL backend and STRATA_VERIFY_EAGER=1 (no
command graphs, every window enqueued kernel by kernel), the prompt path with mirrored experts reads at 1.03 tok/s
against 74.7 tok/s with all experts resident - 33 minutes for a 2,048-token prompt.
That combination is what the
Windows port ships today whenever the driver has no user-mode Level Zero adapter, which is the case on the machine I
measured on (driver 32.0.101.8976, sycl-ls lists only opencl:gpu).

I also read the ratio as too large to be bandwidth: 11.15 GiB of mirrored experts per layer across 48 layers is
~535 GiB, and at the 13.3 GB/s host-to-device I measured that is ~41 s, not 1,988 s - about 2% of the link. So
something in that path serialises. Whether the eager replay is the cause or merely the condition, I have not isolated;
Teppei's numbers suggest the mirror mechanism itself is sound, so the useful question is narrower than the one I filed.

What would still help

A profile of one prefill chunk with and without the mirror on the OpenCL/eager path, since that is the combination
that has never been measured with misses: is it the per-expert launches not being enqueued far enough ahead, the chunk
re-reading the same expert per row-block, or g_pinned_share dropping the staging ring to 96 slots for a fully pinned
mirror (the ring is tuned for the unpinned case)?

For anyone choosing a model on a card this size in the meantime, the practical summary is unchanged on an OpenCL-only
setup and reversed with graphs: a model that fits entirely in VRAM is fastest on both paths; one that does not is
decode-usable everywhere, and prompt-useless without graphs.

<!-- gh-comment-id:6059365499 --> @demetree commented on GitHub (Oct 8, 2026): ### Not a general property of the mirror - my measurements were on the OpenCL/eager-replay backend TeppeiLan1104 measured this on a machine whose driver exposes a **user-mode Level Zero adapter** (Windows 11, driver 32.0.101.8864, UR over Level Zero V2), so command graphs and oneMKL are both live there, and the prompt path with a large mirror is fine: | model (one B70, graphs) | decode, short | prompt, 2,391 tokens | decode after it | |---|---|---|---| | Coder IQ1_M | 82.0 tok/s | 758 tok/s | 79.3 tok/s | | Flash-Next IQ2_XS (8.7 GiB mirrored) | 81.5 | 718 | 79.0 | | Flash-Next IQ3_XXS (16.1 GiB mirrored) | 73.3 | **648** | 73.7 | | Flash-Next IQ3_S (23.4 GiB mirrored) | 64.2 | 570 | 68.1 | So 648 tok/s with 16.1 GiB mirrored, against the 1.03 tok/s I measured. That is not the mirror - that is my backend, and the difference between the two setups is graphs plus eager replay, not the mirror table. What I measured is still real, and still worth something: **with the OpenCL backend and `STRATA_VERIFY_EAGER=1` (no command graphs, every window enqueued kernel by kernel), the prompt path with mirrored experts reads at 1.03 tok/s against 74.7 tok/s with all experts resident - 33 minutes for a 2,048-token prompt.** That combination is what the Windows port ships today whenever the driver has no user-mode Level Zero adapter, which is the case on the machine I measured on (driver 32.0.101.8976, `sycl-ls` lists only `opencl:gpu`). I also read the ratio as too large to be bandwidth: 11.15 GiB of mirrored experts per layer across 48 layers is ~535 GiB, and at the 13.3 GB/s host-to-device I measured that is ~41 s, not 1,988 s - about 2% of the link. So something in that path serialises. Whether the eager replay is the cause or merely the condition, I have not isolated; Teppei's numbers suggest the mirror mechanism itself is sound, so the useful question is narrower than the one I filed. ### What would still help A profile of one prefill chunk with and without the mirror **on the OpenCL/eager path**, since that is the combination that has never been measured with misses: is it the per-expert launches not being enqueued far enough ahead, the chunk re-reading the same expert per row-block, or `g_pinned_share` dropping the staging ring to 96 slots for a fully pinned mirror (the ring is tuned for the unpinned case)? For anyone choosing a model on a card this size in the meantime, the practical summary is unchanged on an OpenCL-only setup and reversed with graphs: a model that fits entirely in VRAM is fastest on both paths; one that does not is decode-usable everywhere, and prompt-useless without graphs.
Author
Owner

@demetree commented on GitHub (Oct 8, 2026):

Not a general property of the mirror - my measurements were on the OpenCL/eager-replay backend

TeppeiLan1104 measured this on a machine whose driver exposes a user-mode Level Zero adapter (Windows 11, driver
32.0.101.8864, UR over Level Zero V2), so command graphs and oneMKL are both live there, and the prompt path with a
large mirror is fine:

model (one B70, graphs) decode, short prompt, 2,391 tokens decode after it
Coder IQ1_M 82.0 tok/s 758 tok/s 79.3 tok/s
Flash-Next IQ2_XS (8.7 GiB mirrored) 81.5 718 79.0
Flash-Next IQ3_XXS (16.1 GiB mirrored) 73.3 648 73.7
Flash-Next IQ3_S (23.4 GiB mirrored) 64.2 570 68.1

So 648 tok/s with 16.1 GiB mirrored, against the 1.03 tok/s I measured. That is not the mirror - that is my backend,
and the difference between the two setups is graphs plus eager replay, not the mirror table.

What I measured is still real, and still worth something: with the OpenCL backend and STRATA_VERIFY_EAGER=1 (no
command graphs, every window enqueued kernel by kernel), the prompt path with mirrored experts reads at 1.03 tok/s
against 74.7 tok/s with all experts resident - 33 minutes for a 2,048-token prompt.
That combination is what the
Windows port ships today whenever the driver has no user-mode Level Zero adapter, which is the case on the machine I
measured on (driver 32.0.101.8976, sycl-ls lists only opencl:gpu).

I also read the ratio as too large to be bandwidth: 11.15 GiB of mirrored experts per layer across 48 layers is
~535 GiB, and at the 13.3 GB/s host-to-device I measured that is ~41 s, not 1,988 s - about 2% of the link. So
something in that path serialises. Whether the eager replay is the cause or merely the condition, I have not isolated;
Teppei's numbers suggest the mirror mechanism itself is sound, so the useful question is narrower than the one I filed.

What would still help

A profile of one prefill chunk with and without the mirror on the OpenCL/eager path, since that is the combination
that has never been measured with misses: is it the per-expert launches not being enqueued far enough ahead, the chunk
re-reading the same expert per row-block, or g_pinned_share dropping the staging ring to 96 slots for a fully pinned
mirror (the ring is tuned for the unpinned case)?

For anyone choosing a model on a card this size in the meantime, the practical summary is unchanged on an OpenCL-only
setup and reversed with graphs: a model that fits entirely in VRAM is fastest on both paths; one that does not is
decode-usable everywhere, and prompt-useless without graphs.

<!-- gh-comment-id:6063203957 --> @demetree commented on GitHub (Oct 8, 2026): ### Not a general property of the mirror - my measurements were on the OpenCL/eager-replay backend TeppeiLan1104 measured this on a machine whose driver exposes a **user-mode Level Zero adapter** (Windows 11, driver 32.0.101.8864, UR over Level Zero V2), so command graphs and oneMKL are both live there, and the prompt path with a large mirror is fine: | model (one B70, graphs) | decode, short | prompt, 2,391 tokens | decode after it | |---|---|---|---| | Coder IQ1_M | 82.0 tok/s | 758 tok/s | 79.3 tok/s | | Flash-Next IQ2_XS (8.7 GiB mirrored) | 81.5 | 718 | 79.0 | | Flash-Next IQ3_XXS (16.1 GiB mirrored) | 73.3 | **648** | 73.7 | | Flash-Next IQ3_S (23.4 GiB mirrored) | 64.2 | 570 | 68.1 | So 648 tok/s with 16.1 GiB mirrored, against the 1.03 tok/s I measured. That is not the mirror - that is my backend, and the difference between the two setups is graphs plus eager replay, not the mirror table. What I measured is still real, and still worth something: **with the OpenCL backend and `STRATA_VERIFY_EAGER=1` (no command graphs, every window enqueued kernel by kernel), the prompt path with mirrored experts reads at 1.03 tok/s against 74.7 tok/s with all experts resident - 33 minutes for a 2,048-token prompt.** That combination is what the Windows port ships today whenever the driver has no user-mode Level Zero adapter, which is the case on the machine I measured on (driver 32.0.101.8976, `sycl-ls` lists only `opencl:gpu`). I also read the ratio as too large to be bandwidth: 11.15 GiB of mirrored experts per layer across 48 layers is ~535 GiB, and at the 13.3 GB/s host-to-device I measured that is ~41 s, not 1,988 s - about 2% of the link. So something in that path serialises. Whether the eager replay is the cause or merely the condition, I have not isolated; Teppei's numbers suggest the mirror mechanism itself is sound, so the useful question is narrower than the one I filed. ### What would still help A profile of one prefill chunk with and without the mirror **on the OpenCL/eager path**, since that is the combination that has never been measured with misses: is it the per-expert launches not being enqueued far enough ahead, the chunk re-reading the same expert per row-block, or `g_pinned_share` dropping the staging ring to 96 slots for a fully pinned mirror (the ring is tuned for the unpinned case)? For anyone choosing a model on a card this size in the meantime, the practical summary is unchanged on an OpenCL-only setup and reversed with graphs: a model that fits entirely in VRAM is fastest on both paths; one that does not is decode-usable everywhere, and prompt-useless without graphs.
Author
Owner

@demetree commented on GitHub (Oct 8, 2026):

A second, cleaner reproducer: over-reserving the resident KV cache

This may be the same problem reached a different way, and it is much easier to isolate than the IQ3_XXS case because
nothing else changes between the working and the broken run.

Arc Pro B70 32 GB, Windows, OpenCL backend, eager replay, Coder IQ1_M with all 12,288 experts resident (23.42 GiB),
16,386-token prompt. Only --kv-resident varies:

--kv-resident KV cache streams? prompt reading decode after it
32,768 yes, above 32,768 178.4 tok/s 40.7 tok/s
65,536 yes, above 65,536 178.6 42.1
131,072 no - it all fits 181.6 41.2
196,608 - never finished (>25 min) -

Medians of three interleaved runs for the first three; one run at 196,608.

Two things worth separating from the headline:

Within the range that works, the resident KV is nearly free. The expert cache is 12,288 slots / 23.42 GiB in every
one of those runs, and the prompt borrows almost the same number of slots throughout (1,036, 1,036, 969), so the cache
is not being squeezed. Decode does not fall off as the reservation grows either: 40.7 / 42.1 / 41.2 is inside the
run-to-run noise (individual runs 39.2-45.9). If a 128K KV cache costs a few percent of decode on this card, the usual
"about 3.6 GiB of VRAM to context for ~6% of decode" is not the rule - the expert pool is sized from the free VRAM,
so it is the KV that gets what is left rather than the reverse.

Past the ceiling it is not a hang and not an allocation failure. The Windows GPU counters (per-process GPU Engine
utilisation and GPU Adapter Memory dedicated usage) show the card at 100% with 30.83 of 32.00 GiB dedicated memory
in use
, with system RAM unremarkable, while the prefill makes no progress past its first chunk. The engine's own log
stops at the plain-SYCL prompt GEMM's banner, and the expert cache is still fully resident, so this is not the mirror
path.

Given that the expert mirror (the other way to have misses) shows the same shape - 100% busy, no progress - I suspect
one cause rather than two: the prompt path's expert staging on a backend without command graphs. What I would want to
profile is a single stalled chunk: bytes moved over PCIe per second (should be visible in the GPU Adapter Memory
counters), and whether the expert launches are enqueued far enough ahead.

TeppeiLan1104's IQ3_XXS with 16.1 GiB mirrored reads at 648 tok/s on a driver that exposes a user-mode Level Zero
adapter (command graphs live), and their IQ3_S with 23.4 GiB mirrored still reads at 570 tok/s - so both this report and
the mirror one are about the OpenCL/eager path, and both are consistent with graphs being the fix.

<!-- gh-comment-id:6063210564 --> @demetree commented on GitHub (Oct 8, 2026): ### A second, cleaner reproducer: over-reserving the resident KV cache This may be the same problem reached a different way, and it is much easier to isolate than the IQ3_XXS case because nothing else changes between the working and the broken run. Arc Pro B70 32 GB, Windows, OpenCL backend, eager replay, Coder IQ1_M with **all 12,288 experts resident** (23.42 GiB), 16,386-token prompt. Only `--kv-resident` varies: | `--kv-resident` | KV cache streams? | prompt reading | decode after it | |---|---|---|---| | 32,768 | yes, above 32,768 | 178.4 tok/s | 40.7 tok/s | | 65,536 | yes, above 65,536 | 178.6 | 42.1 | | 131,072 | no - it all fits | 181.6 | 41.2 | | **196,608** | - | **never finished (>25 min)** | - | Medians of three interleaved runs for the first three; one run at 196,608. Two things worth separating from the headline: **Within the range that works, the resident KV is nearly free.** The expert cache is 12,288 slots / 23.42 GiB in every one of those runs, and the prompt borrows almost the same number of slots throughout (1,036, 1,036, 969), so the cache is not being squeezed. Decode does not fall off as the reservation grows either: 40.7 / 42.1 / 41.2 is inside the run-to-run noise (individual runs 39.2-45.9). If a 128K KV cache costs a few percent of decode on this card, the usual "about 3.6 GiB of VRAM to context for ~6% of decode" is not the rule - the expert pool is sized from the *free* VRAM, so it is the KV that gets what is left rather than the reverse. **Past the ceiling it is not a hang and not an allocation failure.** The Windows GPU counters (per-process `GPU Engine` utilisation and `GPU Adapter Memory` dedicated usage) show the card at **100% with 30.83 of 32.00 GiB dedicated memory in use**, with system RAM unremarkable, while the prefill makes no progress past its first chunk. The engine's own log stops at the plain-SYCL prompt GEMM's banner, and the expert cache is still fully resident, so this is not the mirror path. Given that the expert mirror (the other way to have misses) shows the same shape - 100% busy, no progress - I suspect one cause rather than two: the prompt path's expert staging on a backend without command graphs. What I would want to profile is a single stalled chunk: bytes moved over PCIe per second (should be visible in the GPU Adapter Memory counters), and whether the expert launches are enqueued far enough ahead. TeppeiLan1104's IQ3_XXS with 16.1 GiB mirrored reads at 648 tok/s on a driver that exposes a user-mode Level Zero adapter (command graphs live), and their IQ3_S with 23.4 GiB mirrored still reads at 570 tok/s - so both this report and the mirror one are about the OpenCL/eager path, and both are consistent with graphs being the fix.
Author
Owner

@demetree commented on GitHub (Oct 8, 2026):

Profile of the mirrored prefill: 95.8% of it is the expert GEMMs, and the copy waits are 34 ms

The profile this issue asked for. Arc Pro B70, Windows, OpenCL backend, eager replay, Qwen3.8-Flash-Next-GSQ-RCO IQ3_XXS (17,687 of 24,576 experts resident, 6,889 = 11.15 GiB mirrored in pinned RAM), --spec 4 --mtp, greedy, STRATA_PREFILL_TIMING=1, on current main plus #1390.

The bug still reproduces after the rebase: the 2,049-token prompt reads at 1.06 tok/s (1,924,555 ms), against the 1.03 tok/s originally reported here.

A 255-token prompt, phase-charged between device events:

prefill 254 tokens in 1 chunks, 957619.1 ms (0.3 tok/s);
experts streamed 1526 (1496 by DMA, host 231.7 ms), resident 5057; PLE 86.5 ms

GPU timeline 957283 ms, wall 957620 ms, host staging 232 ms:
  gemm gate/up   551139 ms  (57.6%)
  gemm down      365226 ms  (38.2%)
  gdn             11705 ms  ( 1.2%)
  dequant          8253 ms  ( 0.9%)
  hc read          6324 ms  ( 0.7%)
  qsa proj         5325 ms  ( 0.6%)
  gdn out proj     4867 ms  ( 0.5%)
  router+shared    1999 ms  ( 0.2%)
  combine          1252 ms  ( 0.1%)
  gdn recurrence    578 ms  ( 0.1%)
  host grouping     148 ms, gather 110 ms, qsa attn 114 ms, ple 87 ms,
  gdn conv+gates 87 ms, qsa select 14 ms, embed+steps 16 ms, kv stage 0 ms
  wait copy          34 ms  ( 0.0%)

So the 48x is not bandwidth, not staging, and not the mirror table. The two expert GEMM phases are 95.8% of the GPU timeline. wait copy - the phase that waits for the host->device staging DMAs - is 34 ms of 957,283, and all host staging is 232 ms. The bytes arrive essentially free; the arithmetic on them does not. The 1,496 DMAs this run counted confirm the pinned path is doing what expert_source.hpp documents ("the prompt path copies it by DMA"). (The 0 by DMA a stream-all run reports is a counter artifact: prefill.cpp's stream-all arm issues m.copy->memcpy without incrementing stats_.experts_dma, unlike the routed arm.)

The cost is per expert, not per token. Two prompts on the same build:

prompt prefill
254 tokens 957,861 ms 0.27 tok/s
2,048 tokens 1,924,555 ms 1.06 tok/s

Marginal cost is (1,924,555 - 957,861) / (2,048 - 254) = 0.54 s per token, which leaves about 821 s fixed in the 254-token run - 48 layers, so ~17 s per layer before a single token is charged. That is the shape of one launch per expert rather than one grouped pass over the layer's experts, and it is why a longer prompt looks "less bad" per token: the fixed part amortises.

Where that comes from, structurally. ring_slots() returns the 8-slot STAGE ring whenever the non-resident share is 10% or more:

const bool stream_all_ok = stream_all_env == 1 || (stream_all_env == -1 && g_nonres_share < 0.10);
if (!stream_all_ok) return STAGE;

IQ3_XXS mirrors 28% of its experts, so its prompt takes that arm. And the grouped path is gated on the ring being bigger than STAGE:

return src && fused_ring() && mmq_plan().any && ring_slots(T) > STAGE && (int64_t) T >= stream_all_min();

So a mirror does not only shrink the staging ring - it turns off the grouped/fused expert pass, and every streamed expert is then its own GEMM launch, on a backend with no command graphs where each launch is enqueued individually. ~139 ms of gate/up + down per streamed expert, for experts serving ~15 tokens each, is what that costs here.

STRATA_PREFILL_STREAM_ALL=1 does not lift it - measured, same build, 2,049-token prompt: 1.06 tok/s against the 1.03 default, i.e. nothing. And the walk never ran: it reported experts streamed 7552, which is the routed count, not the 6,889 x 48 = 330,672 a real stream-all walk would copy. So m.ring stayed at STAGE despite the override, and the gate above stayed shut. Whatever sets m.ring at layout time did not see T >= stream_all_min(); I have not found which call site that is.

What I did not test: a bigger ring forced through STRATA_PREFILL_RING (it is still gated on T >= stream_all_min() at layout time, so I do not know it would engage); any change to the grouping itself; Level Zero, since this driver still exposes no user-mode adapter (separate thread on #1390). Runs here cost 20-35 minutes each because the bug is what makes them slow, so I stopped at the profile rather than sweep.

The practical reading for anyone on a card this size is unchanged and now sharper: a model that does not fit in VRAM is decode-usable and prompt-useless on this backend, and the reason is the expert GEMM path losing its grouping, not PCIe.

<!-- gh-comment-id:6067364774 --> @demetree commented on GitHub (Oct 8, 2026): ### Profile of the mirrored prefill: 95.8% of it is the expert GEMMs, and the copy waits are 34 ms The profile this issue asked for. Arc Pro B70, Windows, OpenCL backend, eager replay, Qwen3.8-Flash-Next-GSQ-RCO IQ3_XXS (17,687 of 24,576 experts resident, 6,889 = 11.15 GiB mirrored in pinned RAM), `--spec 4 --mtp`, greedy, `STRATA_PREFILL_TIMING=1`, on current `main` plus #1390. **The bug still reproduces after the rebase**: the 2,049-token prompt reads at **1.06 tok/s** (1,924,555 ms), against the 1.03 tok/s originally reported here. A 255-token prompt, phase-charged between device events: ``` prefill 254 tokens in 1 chunks, 957619.1 ms (0.3 tok/s); experts streamed 1526 (1496 by DMA, host 231.7 ms), resident 5057; PLE 86.5 ms GPU timeline 957283 ms, wall 957620 ms, host staging 232 ms: gemm gate/up 551139 ms (57.6%) gemm down 365226 ms (38.2%) gdn 11705 ms ( 1.2%) dequant 8253 ms ( 0.9%) hc read 6324 ms ( 0.7%) qsa proj 5325 ms ( 0.6%) gdn out proj 4867 ms ( 0.5%) router+shared 1999 ms ( 0.2%) combine 1252 ms ( 0.1%) gdn recurrence 578 ms ( 0.1%) host grouping 148 ms, gather 110 ms, qsa attn 114 ms, ple 87 ms, gdn conv+gates 87 ms, qsa select 14 ms, embed+steps 16 ms, kv stage 0 ms wait copy 34 ms ( 0.0%) ``` **So the 48x is not bandwidth, not staging, and not the mirror table.** The two expert GEMM phases are **95.8%** of the GPU timeline. `wait copy` - the phase that waits for the host->device staging DMAs - is **34 ms of 957,283**, and all host staging is 232 ms. The bytes arrive essentially free; the arithmetic on them does not. The 1,496 DMAs this run counted confirm the pinned path is doing what `expert_source.hpp` documents ("the prompt path copies it by DMA"). (The `0 by DMA` a stream-all run reports is a counter artifact: `prefill.cpp`'s stream-all arm issues `m.copy->memcpy` without incrementing `stats_.experts_dma`, unlike the routed arm.) **The cost is per expert, not per token.** Two prompts on the same build: | prompt | prefill | | |---|---|---| | 254 tokens | 957,861 ms | 0.27 tok/s | | 2,048 tokens | 1,924,555 ms | 1.06 tok/s | Marginal cost is (1,924,555 - 957,861) / (2,048 - 254) = **0.54 s per token**, which leaves about **821 s fixed** in the 254-token run - 48 layers, so ~17 s per layer before a single token is charged. That is the shape of one launch per expert rather than one grouped pass over the layer's experts, and it is why a longer prompt looks "less bad" per token: the fixed part amortises. **Where that comes from, structurally.** `ring_slots()` returns the 8-slot `STAGE` ring whenever the non-resident share is 10% or more: ```cpp const bool stream_all_ok = stream_all_env == 1 || (stream_all_env == -1 && g_nonres_share < 0.10); if (!stream_all_ok) return STAGE; ``` IQ3_XXS mirrors 28% of its experts, so its prompt takes that arm. And the grouped path is gated on the ring being bigger than `STAGE`: ```cpp return src && fused_ring() && mmq_plan().any && ring_slots(T) > STAGE && (int64_t) T >= stream_all_min(); ``` So a mirror does not only shrink the staging ring - it turns off the grouped/fused expert pass, and every streamed expert is then its own GEMM launch, on a backend with no command graphs where each launch is enqueued individually. ~139 ms of gate/up + down per streamed expert, for experts serving ~15 tokens each, is what that costs here. **`STRATA_PREFILL_STREAM_ALL=1` does not lift it** - measured, same build, 2,049-token prompt: 1.06 tok/s against the 1.03 default, i.e. nothing. And the walk never ran: it reported `experts streamed 7552`, which is the routed count, not the 6,889 x 48 = 330,672 a real stream-all walk would copy. So `m.ring` stayed at `STAGE` despite the override, and the gate above stayed shut. Whatever sets `m.ring` at layout time did not see `T >= stream_all_min()`; I have not found which call site that is. **What I did not test**: a bigger ring forced through `STRATA_PREFILL_RING` (it is still gated on `T >= stream_all_min()` at layout time, so I do not know it would engage); any change to the grouping itself; Level Zero, since this driver still exposes no user-mode adapter (separate thread on #1390). Runs here cost 20-35 minutes each because the bug is what makes them slow, so I stopped at the profile rather than sweep. The practical reading for anyone on a card this size is unchanged and now sharper: a model that does not fit in VRAM is decode-usable and prompt-useless **on this backend**, and the reason is the expert GEMM path losing its grouping, not PCIe.
Author
Owner

@demetree commented on GitHub (Oct 8, 2026):

Correction: the stream-all walk did run. And the useful comparison is in docs/INTEL.md

I argued above that STRATA_PREFILL_STREAM_ALL=1 left m.ring at STAGE because the run reported experts streamed 7552 against an expected 6,889 x 48. That expectation was wrong and I withdraw the claim. 24,576 is the total (layer, expert) pair count - docs/UNSLOTH_Q4.md says the profile "ranks the same 48 x 512 experts" - so the non-resident set is 6,889 pairs in all, and the mirror is 11.15 GiB in all, not per layer. The same log supplies the rest of the number:

expert cache 17687 slots, 28.82 GiB of VRAM
6889 of 6889 experts missing from VRAM mirrored in pinned host memory (11.15 GiB, 32.3 s)
prompt path borrows 663 cache slots (1.21 GiB)

6,889 + 663 = 7,552, exactly what that run reported. So the walk staged the complete non-resident set, ring_slots() did return the big ring, and the gate I blamed was not shut. The structural claim - that a mirror forces STAGE and thereby switches off the grouped expert pass - is unsupported; I should not have posted it as a finding.

The override result gets stronger, not weaker. The walk staged all 7,552 blobs for 2,662.7 ms of host time and the prompt still read 1.06 tok/s. A deep ring and a full stream-ahead are not the fix. That is consistent with the phase profile: wait copy 34 ms of 957,283, all host staging 232 ms, the two expert GEMM phases 95.8%.

The comparison that matters: this same configuration is documented at ~1,000 tok/s on the xe backend

docs/INTEL.md, "Arc Pro B70 with a model that does not fit: Flash-Next IQ3_S", measures a pinned mirror of the same shape - the same 24,576 experts, 11.5k resident, the rest in a pinned host mirror the GPU reads over PCIe - on a B70 VM, xe driver, kernel 7.0, oneAPI 2026.1, engine 0.1.40-sycl:

xe / Level Zero, IQ3_S (docs/INTEL.md) Windows / OpenCL / eager, IQ3_XXS (here)
mirrored share 13k of 24,576 6,889 of 24,576
prompt with the mirror 4,095 tokens: 980-1,002 tok/s 2,048 tokens: 1.03-1.06 tok/s
expert dequant 20% of the GPU timeline 0.9%
the two expert GEMMs 34% 95.8%
QSA attention / GDN / hc reads / host grouping 14% / 9% / 4.6% / 6.5% 0.0% / 1.2% / 0.7% / 0.0%

This is not a controlled A/B - a different quant, a different mirror size and a different prompt length - so I am not claiming the 950x. What carries across is the phase shares, which are properties of the backend's kernels: on xe the two expert GEMMs are a third of the timeline with dequant a fifth, and here they are 95.8% with dequant gone. Two readings of the dequant row are possible and I have not distinguished them: either the fallback charges dequantization inside the GEMM phases (so 20% + 34% collapses into 95.8%), or the dequant really does vanish and the GEMMs absorb the whole cost.

This build logs prefill gemm: oneMKL SYCL BLAS is not usable on this backend; plain SYCL fallback. The controlled version of the comparison is already in this thread - TeppeiLan1104's Level Zero rows are the same two models:

Level Zero (his machine) OpenCL / eager (here) what the mirror costs
Coder IQ1_M, every expert resident 758 tok/s prompt 74.7 -
Flash-Next IQ3_XXS, mirrored 648 tok/s prompt 1.03 1.17x there, 72x here

So the backend alone is worth ~10x on the all-resident prompt, which is what losing oneMKL and command graphs should cost. The mirror then costs a further 1.17x on Level Zero and 72x here, and that second factor is the bug this issue is about - it is not the general OpenCL gap. The shape says where to look: 254 tokens cost 957,861 ms and 2,048 tokens 1,924,555 ms, i.e. 0.54 s/token marginal and ~821 s fixed, about 17 s per layer over 48 layers. A large fixed cost per expert GEMM call in the fallback would produce exactly that, since the pass touched 6,583 experts for ~139 ms of gate/up + down each.

What still stands, measured

  • 95.8% of the mirrored prompt is gemm gate/up (57.6%) + gemm down (38.2%); wait copy is 34 ms and all host staging 232 ms. The bytes are not the problem.
  • The cost is mostly fixed, not per token (the 254 / 2,048 pair above).
  • Staging the entire non-resident set ahead does not move it: 1.06 against 1.03 tok/s.
  • 0 by DMA on the stream-all arm is a counter artifact, with a sharper reason than I gave: gsrc != nullptr (--stream-experts) is tested before the pinned-mirror branch, so that arm re-reads the 6,889 experts from the GGUF instead of DMA'ing them from pinned RAM. It costs little here - the stager runs far ahead inside a 1,924 s pass - but the mirror is bypassed on that arm.

What I did not test

The same phase profile on the all-resident Coder at the same chunk size, which would put a number on the fallback's per-call cost directly and separate "the fallback is slow per call" from "the streamed path calls it far more often". That is the next measurement and I have not run it. Nor have I tested anything on Level Zero: this driver still exposes no user-mode adapter (separate thread on #1390), so I cannot say whether oneMKL alone closes the gap.

<!-- gh-comment-id:6067478159 --> @demetree commented on GitHub (Oct 8, 2026): ### Correction: the stream-all walk did run. And the useful comparison is in `docs/INTEL.md` I argued above that `STRATA_PREFILL_STREAM_ALL=1` left `m.ring` at `STAGE` because the run reported `experts streamed 7552` against an expected 6,889 x 48. **That expectation was wrong and I withdraw the claim.** 24,576 is the *total* (layer, expert) pair count - `docs/UNSLOTH_Q4.md` says the profile "ranks the same 48 x 512 experts" - so the non-resident set is 6,889 pairs *in all*, and the mirror is 11.15 GiB in all, not per layer. The same log supplies the rest of the number: ``` expert cache 17687 slots, 28.82 GiB of VRAM 6889 of 6889 experts missing from VRAM mirrored in pinned host memory (11.15 GiB, 32.3 s) prompt path borrows 663 cache slots (1.21 GiB) ``` 6,889 + 663 = **7,552**, exactly what that run reported. So the walk staged the complete non-resident set, `ring_slots()` did return the big ring, and the gate I blamed was not shut. The structural claim - that a mirror forces `STAGE` and thereby switches off the grouped expert pass - is unsupported; I should not have posted it as a finding. **The override result gets stronger, not weaker.** The walk staged all 7,552 blobs for **2,662.7 ms** of host time and the prompt still read 1.06 tok/s. A deep ring and a full stream-ahead are not the fix. That is consistent with the phase profile: `wait copy` 34 ms of 957,283, all host staging 232 ms, the two expert GEMM phases 95.8%. ### The comparison that matters: this same configuration is documented at ~1,000 tok/s on the xe backend `docs/INTEL.md`, "Arc Pro B70 with a model that does not fit: Flash-Next IQ3_S", measures a pinned mirror of the same shape - the same 24,576 experts, 11.5k resident, the rest in a pinned host mirror the GPU reads over PCIe - on a **B70 VM, xe driver, kernel 7.0, oneAPI 2026.1, engine 0.1.40-sycl**: | | xe / Level Zero, IQ3_S (`docs/INTEL.md`) | Windows / OpenCL / eager, IQ3_XXS (here) | |---|---|---| | mirrored share | 13k of 24,576 | 6,889 of 24,576 | | prompt with the mirror | 4,095 tokens: **980-1,002 tok/s** | 2,048 tokens: **1.03-1.06 tok/s** | | expert dequant | 20% of the GPU timeline | 0.9% | | the two expert GEMMs | **34%** | **95.8%** | | QSA attention / GDN / hc reads / host grouping | 14% / 9% / 4.6% / 6.5% | 0.0% / 1.2% / 0.7% / 0.0% | This is not a controlled A/B - a different quant, a different mirror size and a different prompt length - so I am not claiming the 950x. What carries across is the *phase shares*, which are properties of the backend's kernels: on xe the two expert GEMMs are a third of the timeline with dequant a fifth, and here they are 95.8% with dequant gone. Two readings of the dequant row are possible and I have not distinguished them: either the fallback charges dequantization inside the GEMM phases (so 20% + 34% collapses into 95.8%), or the dequant really does vanish and the GEMMs absorb the whole cost. This build logs `prefill gemm: oneMKL SYCL BLAS is not usable on this backend; plain SYCL fallback`. The controlled version of the comparison is already in this thread - TeppeiLan1104's Level Zero rows are the same two models: | | Level Zero (his machine) | OpenCL / eager (here) | what the mirror costs | |---|---|---|---| | Coder IQ1_M, every expert resident | 758 tok/s prompt | 74.7 | - | | Flash-Next IQ3_XXS, mirrored | 648 tok/s prompt | 1.03 | **1.17x there, 72x here** | So the backend alone is worth ~10x on the all-resident prompt, which is what losing oneMKL and command graphs should cost. The mirror then costs a further 1.17x on Level Zero and **72x** here, and that second factor is the bug this issue is about - it is not the general OpenCL gap. The shape says where to look: 254 tokens cost 957,861 ms and 2,048 tokens 1,924,555 ms, i.e. 0.54 s/token marginal and ~821 s fixed, about 17 s per layer over 48 layers. A large fixed cost per expert GEMM *call* in the fallback would produce exactly that, since the pass touched 6,583 experts for ~139 ms of gate/up + down each. ### What still stands, measured - 95.8% of the mirrored prompt is `gemm gate/up` (57.6%) + `gemm down` (38.2%); `wait copy` is 34 ms and all host staging 232 ms. The bytes are not the problem. - The cost is mostly fixed, not per token (the 254 / 2,048 pair above). - Staging the entire non-resident set ahead does not move it: 1.06 against 1.03 tok/s. - `0 by DMA` on the stream-all arm is a counter artifact, with a sharper reason than I gave: `gsrc != nullptr` (`--stream-experts`) is tested *before* the pinned-mirror branch, so that arm re-reads the 6,889 experts from the GGUF instead of DMA'ing them from pinned RAM. It costs little here - the stager runs far ahead inside a 1,924 s pass - but the mirror is bypassed on that arm. ### What I did not test The same phase profile on the all-resident Coder at the same chunk size, which would put a number on the fallback's per-call cost directly and separate "the fallback is slow per call" from "the streamed path calls it far more often". That is the next measurement and I have not run it. Nor have I tested anything on Level Zero: this driver still exposes no user-mode adapter (separate thread on #1390), so I cannot say whether oneMKL alone closes the gap.
Author
Owner

@demetree commented on GitHub (Oct 8, 2026):

The mirror is not the cause: forcing one on the same pack costs nothing

The controlled test this issue needed. Same build, same pack (Coder IQ1_M), same 2,049-token prompt, --prefill 4096, STRATA_PREFILL_TIMING=1, and only --expert-cache changed, to push part of the same pack into the pinned host mirror:

arm mirrored prefill chunks streamed (by DMA) resident GEMM ms GEMM ms per expert touched
--expert-cache auto none 28,126 ms (72.8 tok/s) 2 760 (0) 10,818 23,268 2.01
--expert-cache 8847 778 experts, 1.48 GiB 18,180 ms (112.7) 1 1,357 (0) 6,367 14,109 1.83
--expert-cache 6144 4,285 experts, 8.19 GiB 18,744 ms (109.3) 1 3,080 (2,779 by DMA) 4,155 14,824 2.05

Mirroring 35% of the pack - 4,285 experts, 8.19 GiB read over PCIe, 2,779 DMAs from pinned RAM - leaves the per-expert GEMM cost at 2.05 ms and the prompt at 109 tok/s. There is no collapse, and the pinned DMA path is doing its job (2,779 of 3,080).

The mirrored arms read faster overall only because they run one chunk instead of two: STRATA_PREFILL_FIRST is 256 tokens only when the cache holds every expert, so the all-resident arm pays an extra pass of the stream. That is why the per-expert figure is the comparable column, and it does not move: 2.01, 1.83, 2.05.

Against the IQ3_XXS run in my previous comment: 139.2 ms of GEMM per expert touched - 70x this. The variable that matters is not where the bytes come from.

What this means for the issue

The premise in the title does not hold on this backend. A model that does not fit in VRAM is not prompt-slow because it is mirrored - the two only happened together because IQ3_XXS is both the model that does not fit in 32 GB and the model whose expert kernels are slow here. Nothing that improves the mirror's PCIe path will touch this, which is worth knowing before anyone spends time on the staging ring, the copy stream or the pinned arena.

The practical reading flips, too: on this backend, mirroring up to 35% of a pack whose kernels are fast is free at the prompt (measured on the Coder). The constraint on choosing a model is the pack, not the fit.

What it is not

Both packs load the same way - native pack: ... experts, 302 canonical tensors skipped: served natively - so it is not the pack mechanism. And it is not blob size: IQ3_XXS's largest blob is 2.33 MB against IQ1_M's 2.66 MB, so the slow model has the smaller blob. It is also not the token count per expert: the IQ3_XXS pass served ~19 tokens per expert against the Coder's ~80, and a per-call fixed cost would make the smaller one cheaper, not 70x dearer.

That leaves the pack's quant or its geometry - IQ3_XXS has 512 experts per layer against the Coder's 256 - or the expert-dot kernel each selects.

What I did not test

IQ3_XXS cannot be made all-resident on a 32 GB card (39.97 GiB of experts), so I cannot separate its quant from its 512-expert geometry directly. A model with 512 experts per layer and a quant this backend handles well would do it, and I do not have one. I have also not traced which expert-dot kernel each pack selects, which is the cheapest next step and does not need a GPU run.

<!-- gh-comment-id:6068355233 --> @demetree commented on GitHub (Oct 8, 2026): ### The mirror is not the cause: forcing one on the same pack costs nothing The controlled test this issue needed. Same build, same pack (Coder IQ1_M), same 2,049-token prompt, `--prefill 4096`, `STRATA_PREFILL_TIMING=1`, and only `--expert-cache` changed, to push part of the *same* pack into the pinned host mirror: | arm | mirrored | prefill | chunks | streamed (by DMA) | resident | GEMM ms | **GEMM ms per expert touched** | |---|---|---|---|---|---|---|---| | `--expert-cache auto` | none | 28,126 ms (72.8 tok/s) | 2 | 760 (0) | 10,818 | 23,268 | **2.01** | | `--expert-cache 8847` | 778 experts, 1.48 GiB | 18,180 ms (112.7) | 1 | 1,357 (0) | 6,367 | 14,109 | **1.83** | | `--expert-cache 6144` | 4,285 experts, 8.19 GiB | 18,744 ms (109.3) | 1 | 3,080 (**2,779 by DMA**) | 4,155 | 14,824 | **2.05** | Mirroring **35% of the pack - 4,285 experts, 8.19 GiB read over PCIe, 2,779 DMAs from pinned RAM - leaves the per-expert GEMM cost at 2.05 ms and the prompt at 109 tok/s.** There is no collapse, and the pinned DMA path is doing its job (2,779 of 3,080). The mirrored arms read *faster* overall only because they run one chunk instead of two: `STRATA_PREFILL_FIRST` is 256 tokens only when the cache holds every expert, so the all-resident arm pays an extra pass of the stream. That is why the per-expert figure is the comparable column, and it does not move: 2.01, 1.83, 2.05. Against the IQ3_XXS run in my previous comment: **139.2 ms of GEMM per expert touched - 70x this.** The variable that matters is not where the bytes come from. ### What this means for the issue The premise in the title does not hold on this backend. A model that does not fit in VRAM is not prompt-slow *because it is mirrored* - the two only happened together because IQ3_XXS is both the model that does not fit in 32 GB and the model whose expert kernels are slow here. Nothing that improves the mirror's PCIe path will touch this, which is worth knowing before anyone spends time on the staging ring, the copy stream or the pinned arena. The practical reading flips, too: on this backend, mirroring up to 35% of a pack whose kernels are fast is **free at the prompt** (measured on the Coder). The constraint on choosing a model is the pack, not the fit. ### What it is not Both packs load the same way - `native pack: ... experts`, `302 canonical tensors skipped: served natively` - so it is not the pack mechanism. And it is not blob size: IQ3_XXS's largest blob is **2.33 MB against IQ1_M's 2.66 MB**, so the slow model has the *smaller* blob. It is also not the token count per expert: the IQ3_XXS pass served ~19 tokens per expert against the Coder's ~80, and a per-call fixed cost would make the smaller one cheaper, not 70x dearer. That leaves the pack's quant or its geometry - IQ3_XXS has 512 experts per layer against the Coder's 256 - or the expert-dot kernel each selects. ### What I did not test IQ3_XXS cannot be made all-resident on a 32 GB card (39.97 GiB of experts), so I cannot separate its quant from its 512-expert geometry directly. A model with 512 experts per layer and a quant this backend handles well would do it, and I do not have one. I have also not traced which expert-dot kernel each pack selects, which is the cheapest next step and does not need a GPU run.
Author
Owner

@demetree commented on GitHub (Oct 8, 2026):

It is not the prompt length either: the Coder's per-expert cost is flat, and 66x cheaper at the same 254 tokens

My IQ3_XXS profile was a 254-token prompt and my first control was 2,048 tokens, so the comparison was not clean. The Coder at four prompt lengths, same build, same config, STRATA_PREFILL_TIMING=1:

tokens prefill chunks experts touched GEMM ms GEMM ms per expert
64 7,562 ms (8.5 tok/s) 1 2,801 6,484 2.31
254 11,421 ms (22.2) 1 4,747 10,083 2.12
1024 25,489 ms (40.2) 2 10,646 22,139 2.08
2048 27,932 ms (73.3) 2 11,578 23,102 2.00

At 254 tokens - the exact length of the IQ3_XXS profile - the Coder costs 2.12 ms of GEMM per expert against IQ3_XXS's 139.2 ms. Same backend, same prompt length, comparable expert counts (4,747 against 6,583), 66x apart.

So, with the previous comment: it is not the mirror (35% of the same pack mirrored costs nothing), and it is not the short prompt. It is specific to the IQ3_XXS configuration.

Note that both models show the same shape - a fixed per-expert cost that amortises as the prompt grows (Coder 8.5 -> 73.3 tok/s from 64 to 2,048 tokens; IQ3_XXS 0.27 -> 1.06). The mechanism is the same kind of cost. IQ3_XXS's is just 66x bigger.

A structural gap this exposes: the SYCL port has no grouped expert path at all

Tracing the dispatch, use_mmq comes from mmq_plan(), which is gated on mmq::built(). The SYCL build never defines STRATA_PREFILL_MMQ - sycl/CMakeLists.txt does not mention it, sycl/src/prefill/moe_mmq.dp.cpp is not in any target, and where gemm.dp.cpp uses the macro it is #if defined(STRATA_PREFILL_MMQ) && defined(__HIPCC__), HIP-only. So prefill.cpp's #ifndef STRATA_PREFILL_MMQ stub is what compiles:

bool built() { return false; }
bool supported(int) { return false; }
bool fits(int, int64_t) { return false; }

use_mmq is therefore false for every layer of every pack, and every expert product on this backend takes the per-expert FP16 arm: two dequant kernels, then Gemm::f16 for gate/up and again for down - one launch pair per expert. A Coder prompt makes ~12,288 of those pairs, and its whole 28 s prefill is essentially that (23.1 s in the two GEMM phases).

That matters for reading this issue: on CUDA, mmq::supported covers the i-quants and Q2_0 but explicitly not IQ1_M (include/strata/prefill/moe_mmq.hpp: "IQ1_M is not covered"), and MMQ runs 16 experts per launch (MMQ_GROUP). So on CUDA the two packs in this comparison take different paths - IQ1_M per-expert FP16, IQ3_XXS grouped - while on SYCL both take the per-expert one. The port's loss falls entirely on the packs MMQ would have covered.

I am not claiming that explains the 66x: both packs run the same arm here, with the same GEMM shapes (ne x 1280 x N and ne x N x 640) and comparable ne. It does explain why prompts on this backend are slow in general, and it is a gap worth its own thread.

What I have not resolved

Why one per-expert call costs 66x more for IQ3_XXS. The only pack-dependent calls in that arm are the two dequant kernels, and they are indeed slower per expert - 1.25 ms against the Coder's 0.045 ms at 254 tokens, 28x - but their phase is 8,253 ms of 957,283, under 1%. The other 908 s is in the two GEMM phases, whose shapes do not depend on the pack.

The open question is whether that 908 s is GPU work or GPU idle. STRATA_PREFILL_TIMING charges the gap between two marks to the first mark's phase, and its own comment says "a gap where the GPU waits (for the host's expert grouping, or for an expert's copy) lands on the phase that was waiting" - so a host-bound dispatch would present exactly as these two phases do. The phases sum to 957,284 ms against a 957,283 ms timeline, which confirms they tile it but cannot separate work from waiting.

The measurement that would settle it is the GPU's compute utilisation during an IQ3_XXS prefill (busy = the kernels are slow; idle = the host cannot keep the queue fed), or STRATA_PREFILL_SYNC=1, which waits at every mark. I have not run either - each needs a 15-20 minute IQ3_XXS pass, because the bug is what makes it slow.

<!-- gh-comment-id:6068648344 --> @demetree commented on GitHub (Oct 8, 2026): ### It is not the prompt length either: the Coder's per-expert cost is flat, and 66x cheaper at the same 254 tokens My IQ3_XXS profile was a 254-token prompt and my first control was 2,048 tokens, so the comparison was not clean. The Coder at four prompt lengths, same build, same config, `STRATA_PREFILL_TIMING=1`: | tokens | prefill | chunks | experts touched | GEMM ms | **GEMM ms per expert** | |---|---|---|---|---|---| | 64 | 7,562 ms (8.5 tok/s) | 1 | 2,801 | 6,484 | **2.31** | | **254** | 11,421 ms (22.2) | 1 | 4,747 | 10,083 | **2.12** | | 1024 | 25,489 ms (40.2) | 2 | 10,646 | 22,139 | **2.08** | | 2048 | 27,932 ms (73.3) | 2 | 11,578 | 23,102 | **2.00** | At **254 tokens - the exact length of the IQ3_XXS profile - the Coder costs 2.12 ms of GEMM per expert against IQ3_XXS's 139.2 ms.** Same backend, same prompt length, comparable expert counts (4,747 against 6,583), **66x apart**. So, with the previous comment: it is not the mirror (35% of the same pack mirrored costs nothing), and it is not the short prompt. It is specific to the IQ3_XXS configuration. Note that both models show the *same shape* - a fixed per-expert cost that amortises as the prompt grows (Coder 8.5 -> 73.3 tok/s from 64 to 2,048 tokens; IQ3_XXS 0.27 -> 1.06). The mechanism is the same kind of cost. IQ3_XXS's is just 66x bigger. ### A structural gap this exposes: the SYCL port has no grouped expert path at all Tracing the dispatch, `use_mmq` comes from `mmq_plan()`, which is gated on `mmq::built()`. The SYCL build never defines `STRATA_PREFILL_MMQ` - `sycl/CMakeLists.txt` does not mention it, `sycl/src/prefill/moe_mmq.dp.cpp` is not in any target, and where `gemm.dp.cpp` uses the macro it is `#if defined(STRATA_PREFILL_MMQ) && defined(__HIPCC__)`, HIP-only. So `prefill.cpp`'s `#ifndef STRATA_PREFILL_MMQ` stub is what compiles: ```cpp bool built() { return false; } bool supported(int) { return false; } bool fits(int, int64_t) { return false; } ``` `use_mmq` is therefore false for **every layer of every pack**, and every expert product on this backend takes the per-expert FP16 arm: two dequant kernels, then `Gemm::f16` for gate/up and again for down - one launch pair per expert. A Coder prompt makes ~12,288 of those pairs, and its whole 28 s prefill is essentially that (23.1 s in the two GEMM phases). That matters for reading this issue: on CUDA, `mmq::supported` covers the i-quants and Q2_0 but explicitly **not IQ1_M** (`include/strata/prefill/moe_mmq.hpp`: "IQ1_M is not covered"), and MMQ runs 16 experts per launch (`MMQ_GROUP`). So on CUDA the two packs in this comparison take *different* paths - IQ1_M per-expert FP16, IQ3_XXS grouped - while on SYCL both take the per-expert one. The port's loss falls entirely on the packs MMQ would have covered. I am not claiming that explains the 66x: both packs run the same arm here, with the same GEMM shapes (`ne x 1280 x N` and `ne x N x 640`) and comparable `ne`. It does explain why prompts on this backend are slow in general, and it is a gap worth its own thread. ### What I have not resolved Why one per-expert call costs 66x more for IQ3_XXS. The only pack-dependent calls in that arm are the two dequant kernels, and they are indeed slower per expert - 1.25 ms against the Coder's 0.045 ms at 254 tokens, 28x - but their phase is 8,253 ms of 957,283, under 1%. The other 908 s is in the two GEMM phases, whose shapes do not depend on the pack. The open question is whether that 908 s is GPU work or GPU idle. `STRATA_PREFILL_TIMING` charges the gap between two marks to the first mark's phase, and its own comment says "a gap where the GPU waits (for the host's expert grouping, or for an expert's copy) lands on the phase that was waiting" - so a host-bound dispatch would present exactly as these two phases do. The phases sum to 957,284 ms against a 957,283 ms timeline, which confirms they tile it but cannot separate work from waiting. The measurement that would settle it is the GPU's compute utilisation during an IQ3_XXS prefill (busy = the kernels are slow; idle = the host cannot keep the queue fed), or `STRATA_PREFILL_SYNC=1`, which waits at every mark. I have not run either - each needs a 15-20 minute IQ3_XXS pass, because the bug is what makes it slow.
Author
Owner

@demetree commented on GitHub (Oct 9, 2026):

The 48x follows VRAM occupancy, not the pack's data: same kernel calls, 43x faster with the cache smaller

Following the per-kernel trace in my last comment, the expert GEMMs are the naive fallback kernel on both packs, with the same shapes. I tested the candidates that could make the same call slower. Arc Pro B70, Windows, OpenCL, eager, 64-token prompt, STRATA_PREFILL_TIMING=1 and STRATA_GEMM_STATS=1.

1. Value classes of the FP16 inputs (STRATA_DQ_STATS=1, first 300 experts). No subnormals in either pack, in the dequantized weights or the activations; every gate/up value is normal. The one real difference is the down projection's zeros, 27% for IQ3_XXS against 6% for the Coder. That is not a subnormal penalty, and I have no reason to think zeros cost time.

gate/up zero / subnormal / normal down zero / subnormal / normal activations zero / subnormal / normal
Coder IQ1_M 0 / 0 / 1.0000 0.063 / 0 / 0.937 0 / 0.0006 / 0.999
IQ3_XXS 0 / 0 / 1.0000 0.270 / 0 / 0.730 0 / 0.0005 / 0.9995

2. The KV setting the two configs disagree on. The IQ3_XXS config uses --kv-resident 32768 and the Coder 131072. Coder at 64 tokens: 7,589 ms against 7,587 ms with 32768. No effect.

3. VRAM occupancy. The IQ3_XXS config fills nearly all of the card: 17,687 cache slots, 28.8 GiB. I reran the same pack with --expert-cache 8000 (10,698 slots, 17.4 GiB):

--expert-cache VRAM of experts naive GEMM calls (gate/up, down) prefill, 64 tokens per call
auto (17,687) 28.8 GiB 3,668 each 426,008 ms (0.2 tok/s) ~112 ms per expert pair
8000 (10,698) 17.4 GiB 3,668 each 9,955 ms (6.5 tok/s) ~2.7 ms per expert pair

The calls, their shapes and their row counts are identical. Only the free VRAM changed, and the per-call cost fell to the Coder's ~2.3 ms. The mirror test in my earlier comment agrees: that run also left VRAM free, and it was fast with 35% of the pack mirrored. So the variable is how full VRAM is, not the mirror and not the pack's kernels.

What I have not verified: the mechanism. My guess is that when device allocations approach the card's capacity, the Windows driver moves some of them out to system memory, so the naive kernel's reads cross PCIe. That would appear as shared-memory use rising during the full-cache run. I have not sampled GPU Adapter Memory during a slow pass yet. The smaller cache also changes the DMA count (1,923 against 626). The mirror test already showed DMA volume does not matter, but I have not isolated that here.

Practical reading: on a 32 GB card the expert cache should leave headroom, and an IQ3_XXS config that fills nearly all of VRAM is slow at the prompt for a reason that has nothing to do with the mirror or the quant.

<!-- gh-comment-id:6072711265 --> @demetree commented on GitHub (Oct 9, 2026): ### The 48x follows VRAM occupancy, not the pack's data: same kernel calls, 43x faster with the cache smaller Following the per-kernel trace in my last comment, the expert GEMMs are the naive fallback kernel on both packs, with the same shapes. I tested the candidates that could make the same call slower. Arc Pro B70, Windows, OpenCL, eager, 64-token prompt, `STRATA_PREFILL_TIMING=1` and `STRATA_GEMM_STATS=1`. **1. Value classes of the FP16 inputs (`STRATA_DQ_STATS=1`, first 300 experts).** No subnormals in either pack, in the dequantized weights or the activations; every gate/up value is normal. The one real difference is the down projection's zeros, 27% for IQ3_XXS against 6% for the Coder. That is not a subnormal penalty, and I have no reason to think zeros cost time. | | gate/up zero / subnormal / normal | down zero / subnormal / normal | activations zero / subnormal / normal | |---|---|---|---| | Coder IQ1_M | 0 / 0 / 1.0000 | 0.063 / 0 / 0.937 | 0 / 0.0006 / 0.999 | | IQ3_XXS | 0 / 0 / 1.0000 | 0.270 / 0 / 0.730 | 0 / 0.0005 / 0.9995 | **2. The KV setting the two configs disagree on.** The IQ3_XXS config uses `--kv-resident 32768` and the Coder 131072. Coder at 64 tokens: 7,589 ms against 7,587 ms with 32768. No effect. **3. VRAM occupancy.** The IQ3_XXS config fills nearly all of the card: 17,687 cache slots, 28.8 GiB. I reran the same pack with `--expert-cache 8000` (10,698 slots, 17.4 GiB): | `--expert-cache` | VRAM of experts | naive GEMM calls (gate/up, down) | prefill, 64 tokens | per call | |---|---|---|---|---| | auto (17,687) | 28.8 GiB | 3,668 each | 426,008 ms (0.2 tok/s) | ~112 ms per expert pair | | 8000 (10,698) | 17.4 GiB | 3,668 each | 9,955 ms (6.5 tok/s) | ~2.7 ms per expert pair | The calls, their shapes and their row counts are identical. Only the free VRAM changed, and the per-call cost fell to the Coder's ~2.3 ms. The mirror test in my earlier comment agrees: that run also left VRAM free, and it was fast with 35% of the pack mirrored. So the variable is how full VRAM is, not the mirror and not the pack's kernels. **What I have not verified:** the mechanism. My guess is that when device allocations approach the card's capacity, the Windows driver moves some of them out to system memory, so the naive kernel's reads cross PCIe. That would appear as shared-memory use rising during the full-cache run. I have not sampled `GPU Adapter Memory` during a slow pass yet. The smaller cache also changes the DMA count (1,923 against 626). The mirror test already showed DMA volume does not matter, but I have not isolated that here. Practical reading: on a 32 GB card the expert cache should leave headroom, and an IQ3_XXS config that fills nearly all of VRAM is slow at the prompt for a reason that has nothing to do with the mirror or the quant.
Author
Owner

@demetree commented on GitHub (Oct 9, 2026):

Follow-up: the slow pass fills the card and spills into shared memory; the fast pass doesn't

Sampling GPU Adapter Memory (dedicated and shared) and the compute engine every 3 s, during the same 64-token IQ3_XXS prefill, Arc Pro B70, Windows, OpenCL, eager:

pass dedicated during prefill shared during prefill prefill
--expert-cache 8000 (10,698 slots, 17.4 GiB) ~23.2 GiB ~2.1 GiB 9,988 ms
--expert-cache auto (17,687 slots, 28.8 GiB) ~31.2 GiB (card full) ~17.0 GiB 197,402 ms this run

In the full-cache pass, dedicated memory reaches the card's usable ~31.8 GiB, and shared memory climbs to about 17 GiB while the compute engine is busy. The 8,000-slot pass holds dedicated near 23 GiB and shared near 2 GiB. The kernel calls are the same in both (3,668 naive gate/up and down calls each).

Two caveats:

  • The full-cache prefill is not stable across runs. I measured 426,008 ms, 429,760 ms and 197,402 ms, so the gap to the 8,000-slot pass is roughly 20 to 43x, not a fixed 43x.
  • This shows correlation with spilling, not causation. I have not shown that the naive kernel's reads are what slows down. The samples are 3 s windows, which is coarse for a 3-minute prefill.

Practical reading: on this card the prompt path slows sharply when the expert cache leaves little dedicated memory free, and in this run the GPU was reaching a large amount of system memory during the prefill. Keeping free VRAM for the prompt's own buffers, or sizing the cache with that headroom, is the first thing to try on a 32 GB card.

<!-- gh-comment-id:6079149737 --> @demetree commented on GitHub (Oct 9, 2026): ### Follow-up: the slow pass fills the card and spills into shared memory; the fast pass doesn't Sampling `GPU Adapter Memory` (dedicated and shared) and the compute engine every 3 s, during the same 64-token IQ3_XXS prefill, Arc Pro B70, Windows, OpenCL, eager: | pass | dedicated during prefill | shared during prefill | prefill | |---|---|---|---| | `--expert-cache 8000` (10,698 slots, 17.4 GiB) | ~23.2 GiB | ~2.1 GiB | 9,988 ms | | `--expert-cache auto` (17,687 slots, 28.8 GiB) | ~31.2 GiB (card full) | ~17.0 GiB | 197,402 ms this run | In the full-cache pass, dedicated memory reaches the card's usable ~31.8 GiB, and shared memory climbs to about 17 GiB while the compute engine is busy. The 8,000-slot pass holds dedicated near 23 GiB and shared near 2 GiB. The kernel calls are the same in both (3,668 naive gate/up and down calls each). Two caveats: - The full-cache prefill is not stable across runs. I measured 426,008 ms, 429,760 ms and 197,402 ms, so the gap to the 8,000-slot pass is roughly 20 to 43x, not a fixed 43x. - This shows correlation with spilling, not causation. I have not shown that the naive kernel's reads are what slows down. The samples are 3 s windows, which is coarse for a 3-minute prefill. Practical reading: on this card the prompt path slows sharply when the expert cache leaves little dedicated memory free, and in this run the GPU was reaching a large amount of system memory during the prefill. Keeping free VRAM for the prompt's own buffers, or sizing the cache with that headroom, is the first thing to try on a 32 GB card.
Author
Owner

@demetree commented on GitHub (Oct 9, 2026):

The dose-response has a cliff: the prompt is 50x slower from 14,704 to 15,382 expert-cache slots

Sweeping --expert-cache on the same pack, same build, same 64-token IQ3_XXS prompt, Arc Pro B70, Windows, OpenCL, eager. GEMM ms/call is the two expert GEMM phases over the 3,668 naive calls counted by STRATA_GEMM_STATS.

requested actual slots experts in VRAM prefill GEMM ms/call
8000 10,698 17.36 GiB 10,259 ms 2.39
11000 14,704 23.87 GiB 9,704 ms 2.32
11500 15,382 24.95 GiB 472,150 ms 122.05
12000 15,996 26.03 GiB 222,321 ms 54.37
12500 16,745 27.12 GiB 204,761 ms 49.57
14000 17,800 29.00 GiB 431,751 ms 111.06
auto 17,687 28.82 GiB 431,769 ms 111.12

The split is categorical, not a slope: every size up to 14,704 slots reads at 2.3-2.4 ms per expert GEMM call, and every size from 15,382 slots up reads at 50-122 ms. Between those two rows the prompt goes 9,704 ms to 472,150 ms.

The kernel calls never change: 3,668 naive gate/up and 3,668 down calls at every cache size, same shapes. Only the dedicated memory left over changes.

Two qualifications:

  • The magnitude in the slow regime is noisy. Within it I measured 204,761, 222,321, 431,751 and 472,150 ms for the prompt. The fast regime is stable at about 10 s. So the cliff is trustworthy and the 49x figure for the 11,500 row is the largest, not the median, gap.
  • I have not shown what the driver does at the cliff. It is consistent with dedicated memory reaching the card's usable capacity and device allocations moving into shared (system) memory, which the earlier sampling showed rising to about 17 GiB during the slow passes.

The actionable part: --expert-cache auto lands at 17,687 slots on this 32 GB card, about 3,000 slots past the cliff. So the default sizing chooses the slow side. Keeping the cache at or below about 14,700 slots (23.9 GiB) leaves enough dedicated memory for the prompt path's own buffers and keeps the prompt at 9-10 s for the same 64 tokens. A 2,048-token prompt would scale the same way, since the cost is per expert GEMM call.

This is measured for the IQ3_XXS pack on a B70. I have not checked other packs, other sizes of card, or whether the cliff moves with --prefill or the KV reservation.

<!-- gh-comment-id:6086629335 --> @demetree commented on GitHub (Oct 9, 2026): ### The dose-response has a cliff: the prompt is 50x slower from 14,704 to 15,382 expert-cache slots Sweeping `--expert-cache` on the same pack, same build, same 64-token IQ3_XXS prompt, Arc Pro B70, Windows, OpenCL, eager. `GEMM ms/call` is the two expert GEMM phases over the 3,668 naive calls counted by `STRATA_GEMM_STATS`. | requested | actual slots | experts in VRAM | prefill | GEMM ms/call | |---|---|---|---|---| | 8000 | 10,698 | 17.36 GiB | 10,259 ms | 2.39 | | 11000 | **14,704** | **23.87 GiB** | **9,704 ms** | **2.32** | | 11500 | **15,382** | **24.95 GiB** | **472,150 ms** | **122.05** | | 12000 | 15,996 | 26.03 GiB | 222,321 ms | 54.37 | | 12500 | 16,745 | 27.12 GiB | 204,761 ms | 49.57 | | 14000 | 17,800 | 29.00 GiB | 431,751 ms | 111.06 | | **auto** | **17,687** | **28.82 GiB** | **431,769 ms** | **111.12** | The split is categorical, not a slope: every size up to 14,704 slots reads at 2.3-2.4 ms per expert GEMM call, and every size from 15,382 slots up reads at 50-122 ms. Between those two rows the prompt goes 9,704 ms to 472,150 ms. The kernel calls never change: 3,668 naive gate/up and 3,668 down calls at every cache size, same shapes. Only the dedicated memory left over changes. Two qualifications: - The magnitude in the slow regime is noisy. Within it I measured 204,761, 222,321, 431,751 and 472,150 ms for the prompt. The fast regime is stable at about 10 s. So the *cliff* is trustworthy and the 49x figure for the 11,500 row is the largest, not the median, gap. - I have not shown what the driver does at the cliff. It is consistent with dedicated memory reaching the card's usable capacity and device allocations moving into shared (system) memory, which the earlier sampling showed rising to about 17 GiB during the slow passes. **The actionable part:** `--expert-cache auto` lands at 17,687 slots on this 32 GB card, about 3,000 slots past the cliff. So the default sizing chooses the slow side. Keeping the cache at or below about 14,700 slots (23.9 GiB) leaves enough dedicated memory for the prompt path's own buffers and keeps the prompt at 9-10 s for the same 64 tokens. A 2,048-token prompt would scale the same way, since the cost is per expert GEMM call. This is measured for the IQ3_XXS pack on a B70. I have not checked other packs, other sizes of card, or whether the cliff moves with `--prefill` or the KV reservation.
Author
Owner

@demetree commented on GitHub (Oct 10, 2026):

Measured on an RTX 5070 Ti: no cliff, and the reason is a check CUDA has and this port cannot read

The A/B on NVIDIA, so the knob's default can stay zero there. One card, Windows 11 (WDDM), driver
610.62, 16 GB, RTX 5070 Ti, this branch built with CUDA 13.1 and MSVC 19.44 for sm_120 (the
generate.cpp change compiles without errors). Setup's own Coder IQ1_M config, --expert-cache auto --prefill auto --spec 4 --kv int8 --kv-resident 32768 --vram-reserve-mib 700 --max-context 262144,
23.42 GiB of experts. Three rounds with the arms' order alternating, the server restarted for every run,
6,345-token prompt:

headroom expert cache after the post-write check prompt, tok/s decode, tok/s
0 3,368-3,428 slots, 6.43-6.54 GiB 2,022 64.5
1/6 3,249-3,491 slots, 6.21-6.66 GiB 2,064 66.6

2% on the prompt and 3% on decode, inside the spread of either arm. No cliff.

Why there is none: the CUDA path has a working post-write check. After the cache's slots are written
it reads the free VRAM again and shrinks the cache until --vram-reserve-mib is really free. With
headroom 0 that check fired twice in every run and settled the cache at 6.43-6.54 GiB; with 1/6 it fired
once in two runs out of three and settled at 6.21-6.66 GiB. Both arms end within 0.3 GiB of each other,
because the headroom changes the size the check starts from, not the size it ends at. That is why
the knob is a no-op on CUDA, and why its default is zero there.

And on the B70 the same check cannot fire at all

I checked what that check reads on this card, by printing it (Arc Pro B70, IQ3_XXS, auto, both arms):

headroom 0:   expert cache auto: 31.00 GiB free, 2048 MiB reserved -> 13283 slots
              post-write free 31.00 GiB, want 2048 MiB, cache 17687 slots (28.82 GiB)
headroom 1/6: post-write free 31.00 GiB, want 2048 MiB, cache 14688 slots (23.83 GiB)

After the cache has taken 28.82 GiB of VRAM, device_free_bytes() still reports 31.00 GiB free - the
figure it gave before the allocation. It does not move. So the check, which breaks out when the free
figure is short of the reserve, breaks out on the first read in every case, and the cache is never
shrunk. That is consistent with the absence of its "only N MiB free once the slots are written" message
in every B70 log I have.

The query is dpct::get_current_device().get_memory_info(), and the correction for drivers that
misreport is own_drm_local_bytes() - which reads the process's DRM fdinfo and is therefore
Linux-only. On Windows it returns 0 and the correction at expert_cache.cpp never runs.

So on this backend the post-write check is inert, and the only thing that constrains the cache size is
the arithmetic at sizing time. Which is what the headroom in #1549's earlier commits is for: it is the
only lever that works here.

Two corrections to what I wrote earlier in this issue

I withdraw the WDDM-paging explanation. I wrote that the ~15 GiB of shared memory in the slow arm
was the driver paging device memory to system RAM. The NVIDIA runs above suggest the likelier reading:
the shared figure is almost entirely the engine's own pinned arena mapped for the GPU (the 23.42 GiB
expert arena and 3.09 GiB of K/V), which is by design. On the B70 the ~15 GiB matches the 11.15 GiB
mirror plus the K/V and weights closely, and the fast arm held less shared while mirroring more
experts, which does not fit a spill. I presented that as "consistent, not proven" and it now looks wrong.

The mechanism is still unknown. What is measured and standing: the expert GEMM phases are 95.8% of
the GPU timeline, wait copy is 34 ms of 957,283, the per-expert call costs 2.3 ms with the cache cut
and 54-122 ms without it, the GPU is busy throughout, the calls and their shapes are identical in every
arm, and identical output tokens either way. What is now ruled out: the mirror, the prompt length,
subnormals, the KV setting, and now a failing memory check.

The next measurement that would help is what the driver is actually doing with 28.82 GiB of a 31.00 GiB
card - whether the GEMMs are slow because they are competing for memory bandwidth with eviction traffic,
or because of something about the working set at that size. The B70's own counters (sycl/probe/) are
the place to look, and I have not run them.

<!-- gh-comment-id:6097520363 --> @demetree commented on GitHub (Oct 10, 2026): ### Measured on an RTX 5070 Ti: no cliff, and the reason is a check CUDA has and this port cannot read **The A/B on NVIDIA, so the knob's default can stay zero there.** One card, Windows 11 (WDDM), driver 610.62, 16 GB, RTX 5070 Ti, this branch built with CUDA 13.1 and MSVC 19.44 for sm_120 (the `generate.cpp` change compiles without errors). Setup's own Coder IQ1_M config, `--expert-cache auto --prefill auto --spec 4 --kv int8 --kv-resident 32768 --vram-reserve-mib 700 --max-context 262144`, 23.42 GiB of experts. Three rounds with the arms' order alternating, the server restarted for every run, 6,345-token prompt: | headroom | expert cache after the post-write check | prompt, tok/s | decode, tok/s | |---|---|---|---| | 0 | 3,368-3,428 slots, 6.43-6.54 GiB | 2,022 | 64.5 | | 1/6 | 3,249-3,491 slots, 6.21-6.66 GiB | 2,064 | 66.6 | 2% on the prompt and 3% on decode, inside the spread of either arm. No cliff. **Why there is none: the CUDA path has a working post-write check.** After the cache's slots are written it reads the free VRAM again and shrinks the cache until `--vram-reserve-mib` is really free. With headroom 0 that check fired twice in every run and settled the cache at 6.43-6.54 GiB; with 1/6 it fired once in two runs out of three and settled at 6.21-6.66 GiB. Both arms end within 0.3 GiB of each other, because the headroom changes the size the check *starts* from, not the size it *ends* at. That is why the knob is a no-op on CUDA, and why its default is zero there. ### And on the B70 the same check cannot fire at all I checked what that check reads on this card, by printing it (Arc Pro B70, IQ3_XXS, `auto`, both arms): ``` headroom 0: expert cache auto: 31.00 GiB free, 2048 MiB reserved -> 13283 slots post-write free 31.00 GiB, want 2048 MiB, cache 17687 slots (28.82 GiB) headroom 1/6: post-write free 31.00 GiB, want 2048 MiB, cache 14688 slots (23.83 GiB) ``` After the cache has taken 28.82 GiB of VRAM, `device_free_bytes()` still reports **31.00 GiB free** - the figure it gave *before* the allocation. It does not move. So the check, which breaks out when the free figure is short of the reserve, breaks out on the first read in every case, and the cache is never shrunk. That is consistent with the absence of its "only N MiB free once the slots are written" message in every B70 log I have. The query is `dpct::get_current_device().get_memory_info()`, and the correction for drivers that misreport is `own_drm_local_bytes()` - which reads the process's DRM fdinfo and is therefore **Linux-only**. On Windows it returns 0 and the correction at `expert_cache.cpp` never runs. So on this backend the post-write check is inert, and the only thing that constrains the cache size is the arithmetic at sizing time. Which is what the headroom in #1549's earlier commits is for: it is the only lever that works here. ### Two corrections to what I wrote earlier in this issue **I withdraw the WDDM-paging explanation.** I wrote that the ~15 GiB of shared memory in the slow arm was the driver paging device memory to system RAM. The NVIDIA runs above suggest the likelier reading: the shared figure is almost entirely the engine's *own* pinned arena mapped for the GPU (the 23.42 GiB expert arena and 3.09 GiB of K/V), which is by design. On the B70 the ~15 GiB matches the 11.15 GiB mirror plus the K/V and weights closely, and the fast arm held *less* shared while mirroring *more* experts, which does not fit a spill. I presented that as "consistent, not proven" and it now looks wrong. **The mechanism is still unknown.** What is measured and standing: the expert GEMM phases are 95.8% of the GPU timeline, `wait copy` is 34 ms of 957,283, the per-expert call costs 2.3 ms with the cache cut and 54-122 ms without it, the GPU is busy throughout, the calls and their shapes are identical in every arm, and identical output tokens either way. What is now ruled out: the mirror, the prompt length, subnormals, the KV setting, and now a failing memory check. The next measurement that would help is what the driver is actually doing with 28.82 GiB of a 31.00 GiB card - whether the GEMMs are slow because they are competing for memory bandwidth with eviction traffic, or because of something about the working set at that size. The B70's own counters (`sycl/probe/`) are the place to look, and I have not run them.
Author
Owner

@demetree commented on GitHub (Oct 10, 2026):

Why the post-write check cannot fire on this backend: the OpenCL path has no free-VRAM query at all

The open question from the previous comment was why the check never fires on the B70. I traced it, and it
is not the check.

sycl/include/dpct/device.hpp, get_memory_info, a port addition:

Port addition (Windows/OpenCL bring-up): the free query needs ext_intel_free_memory (Level Zero
sysman), which the OpenCL backend does not have. STRATA_DEVICE_FREE_MIB / STRATA_DEVICE_TOTAL_MIB
override the answer when set (setup_intel.py sets them from the registry's VRAM size on Windows).

if (const char* e = std::getenv("STRATA_DEVICE_FREE_MIB")) {
    try { free_memory = (size_t)(std::stoll(e) * 1048576ll); return; } catch (...) {}
}
if (!has(sycl::aspect::ext_intel_free_memory)) {
  std::cerr << "get_memory_info: ext_intel_free_memory is not supported." << std::endl;
  free_memory = 0;
}

So with STRATA_DEVICE_FREE_MIB set the function returns that constant and returns - no query is
made, and the ext_intel_free_memory branch is never reached, which is also why the engine's log never
carries that message. sycl/setup_intel.py writes the value once, from the registry, at setup time:

env["STRATA_DEVICE_FREE_MIB"] = str(int((vram_gb - 1.0) * 1024))     # 32 GB card: 31744 MiB

That is exactly the figure my debug print saw:

expert cache auto: 31.00 GiB free, 2048 MiB reserved (+184 MiB for the draft head) -> 13283 slots
post-write free 31.00 GiB, want 2048 MiB, cache 17687 slots (28.82 GiB)

31,744 MiB = 31.00 GiB, before the allocation and after it alike. It is not a stale cache that might
clear, and not a driver misreport: it is a setup-time constant passed through an environment variable.
The Linux path has own_drm_local_bytes() as a correction, and it is Linux-only, so on Windows there is
nothing that reads the card at all.

So the post-write check on this backend compares a constant to a threshold and therefore never
fires.
Nothing in the engine protects a run from a cache that fills the card; the only constraint is
the arithmetic at sizing time, which is what the headroom in #1549 is for and why it belongs on the
SYCL side specifically. On CUDA cudaMemGetInfo is a live figure, the check works, and the knob is a
no-op there - which is what the RTX 5070 Ti measurement above shows.

Two things this does not settle, and I am not claiming them:

  • Whether a live figure would have prevented the cliff. With 28.82 GiB of experts on a 31.00 GiB
    card, a true free figure would have been short of the reserve and the check would have shrunk the
    cache. But I have not run that, so "the cliff is caused by a missing query" is a hypothesis this
    supports rather than a result.
  • What the GPU is doing with the last 2 GiB. Still open, and the honest summary is the previous
    comment's list: GEMM phases 95.8% of the timeline, wait copy 34 ms, identical calls and shapes, GPU
    busy, identical output tokens. The memory counters sample Windows' adapter figures, not the driver's
    own state, and I have not run sycl/probe/'s own tools against it.

I also left the probe that found this in the tree as sycl/probe/vram_pressure.cpp, with a
vram_pressure CMake target: it times the engine's own Gemm::f16 at the expert shapes with the card
empty and again with 28 GiB of it allocated and touched. It needs ZEL_LIBRARY_PATH pointed at a
Level Zero loader to start on this machine, as the engine does. I had not run it to completion when this
was written - the bisect that isolated the queue crash is what produced the figures above, so the
GEMM-under-pressure number is still missing.

<!-- gh-comment-id:6097809205 --> @demetree commented on GitHub (Oct 10, 2026): ### Why the post-write check cannot fire on this backend: the OpenCL path has no free-VRAM query at all The open question from the previous comment was why the check never fires on the B70. I traced it, and it is not the check. `sycl/include/dpct/device.hpp`, `get_memory_info`, a port addition: > Port addition (Windows/OpenCL bring-up): the free query needs `ext_intel_free_memory` (Level Zero > sysman), which the OpenCL backend does not have. `STRATA_DEVICE_FREE_MIB` / `STRATA_DEVICE_TOTAL_MIB` > override the answer when set (setup_intel.py sets them from the registry's VRAM size on Windows). ```cpp if (const char* e = std::getenv("STRATA_DEVICE_FREE_MIB")) { try { free_memory = (size_t)(std::stoll(e) * 1048576ll); return; } catch (...) {} } if (!has(sycl::aspect::ext_intel_free_memory)) { std::cerr << "get_memory_info: ext_intel_free_memory is not supported." << std::endl; free_memory = 0; } ``` So with `STRATA_DEVICE_FREE_MIB` set the function **returns that constant and returns** - no query is made, and the `ext_intel_free_memory` branch is never reached, which is also why the engine's log never carries that message. `sycl/setup_intel.py` writes the value once, from the registry, at setup time: ```python env["STRATA_DEVICE_FREE_MIB"] = str(int((vram_gb - 1.0) * 1024)) # 32 GB card: 31744 MiB ``` That is exactly the figure my debug print saw: ``` expert cache auto: 31.00 GiB free, 2048 MiB reserved (+184 MiB for the draft head) -> 13283 slots post-write free 31.00 GiB, want 2048 MiB, cache 17687 slots (28.82 GiB) ``` 31,744 MiB = 31.00 GiB, before the allocation and after it alike. It is not a stale cache that might clear, and not a driver misreport: it is a setup-time constant passed through an environment variable. The Linux path has `own_drm_local_bytes()` as a correction, and it is Linux-only, so on Windows there is nothing that reads the card at all. **So the post-write check on this backend compares a constant to a threshold and therefore never fires.** Nothing in the engine protects a run from a cache that fills the card; the only constraint is the arithmetic at sizing time, which is what the headroom in #1549 is for and why it belongs on the SYCL side specifically. On CUDA `cudaMemGetInfo` is a live figure, the check works, and the knob is a no-op there - which is what the RTX 5070 Ti measurement above shows. Two things this does not settle, and I am not claiming them: - **Whether a live figure would have prevented the cliff.** With 28.82 GiB of experts on a 31.00 GiB card, a true free figure would have been short of the reserve and the check would have shrunk the cache. But I have not run that, so "the cliff is caused by a missing query" is a hypothesis this supports rather than a result. - **What the GPU is doing with the last 2 GiB.** Still open, and the honest summary is the previous comment's list: GEMM phases 95.8% of the timeline, `wait copy` 34 ms, identical calls and shapes, GPU busy, identical output tokens. The memory counters sample Windows' adapter figures, not the driver's own state, and I have not run `sycl/probe/`'s own tools against it. I also left the probe that found this in the tree as `sycl/probe/vram_pressure.cpp`, with a `vram_pressure` CMake target: it times the engine's own `Gemm::f16` at the expert shapes with the card empty and again with 28 GiB of it allocated and touched. It needs `ZEL_LIBRARY_PATH` pointed at a Level Zero loader to start on this machine, as the engine does. I had not run it to completion when this was written - the bisect that isolated the queue crash is what produced the figures above, so the GEMM-under-pressure number is still missing.
Author
Owner

@demetree commented on GitHub (Oct 10, 2026):

Correction: the expert GEMMs are not slower when the card is full, so the 95.8% is mostly not GEMM work

I said above that 95.8% of the slow arm's GPU timeline is the two expert GEMM phases, and that is what
the timing prints - but the phase timing charges a gap to the first mark of the pair, and I did not
check how much of those phases is actual GEMM. I have now.

sycl/probe/vram_pressure.cpp (added, with a vram_pressure CMake target) times the engine's own
strata::prefill::Gemm::f16 at the prompt path's two shapes and routed row counts (T=10), first with
the card otherwise empty and again after allocating and touching 28 GiB of it:

card: 31.16 GiB total, 256 compute units
--- card otherwise empty ---
gate/up 1280x2560  1473.2 us/call
down 2560x640        381.9 us/call
--- after allocating and touching 28.00 GiB (free figure now 0.00 GiB) ---
gate/up 1280x2560  1462.8 us/call  (0.99x)
down 2560x640       380.7 us/call  (1.00x)

The pair costs 1.85 ms with the card empty and 1.84 ms with 28 GiB of it gone. Memory pressure does
not slow this kernel.

And the engine's own fast arm measured 2.32 ms per expert pair, which is the same kernel plus its
dequant - so the fast arm is within ~25% of what these two GEMMs cost. The slow arm measured 54-122 ms
per pair. A kernel that costs 1.85 ms under full memory pressure cannot cost 111 ms in situ, so the slow
arm's GEMM phases are almost entirely something other than the GEMMs, charged to them by the phase
timing's own rule ("a gap where the GPU waits ... lands on the phase that was waiting").

So, revising the accounting: ~6,583 expert pairs at 1.85 ms each is about 12 s of real GEMM work out
of 916 s
charged to those phases in the 255-token run. Over 98% of it is elsewhere.

What is now established, and it is a short list: the plain-SYCL fallback GEMM is not the slow thing;
the OpenCL backend has no free-VRAM query, so the post-write check cannot fire; the headroom removes the
slowdown and changes nothing else about the run (identical tokens, identical calls, identical shapes,
and the mirror is not involved either way).

What is open, restated: where the ~900 s goes. The phase marks cannot separate work from waiting, and
my GPU-utilisation sampling was not a clean percentage (the counter sums over the process's GPU Engine
instances, so ~222 mean could be a little over two engines' worth, not "busy"). The measurement that
would settle it is STRATA_PREFILL_SYNC=1, which waits at every mark and logs the phase that just
finished: real kernel times collapse, idle does not. I have not run it.

Two notes on getting here: the probe needs ZEL_LIBRARY_PATH pointed at a Level Zero loader to start
on this machine, as the engine does; and bisect.cpp in sycl/probe/ is the scratch file that isolated
that, which should be deleted before this is committed anywhere.

<!-- gh-comment-id:6097849332 --> @demetree commented on GitHub (Oct 10, 2026): ### Correction: the expert GEMMs are not slower when the card is full, so the 95.8% is mostly not GEMM work I said above that 95.8% of the slow arm's GPU timeline is the two expert GEMM phases, and that is what the timing prints - but the phase timing charges a gap to the *first* mark of the pair, and I did not check how much of those phases is actual GEMM. I have now. `sycl/probe/vram_pressure.cpp` (added, with a `vram_pressure` CMake target) times the engine's own `strata::prefill::Gemm::f16` at the prompt path's two shapes and routed row counts (T=10), first with the card otherwise empty and again after allocating **and touching** 28 GiB of it: ``` card: 31.16 GiB total, 256 compute units --- card otherwise empty --- gate/up 1280x2560 1473.2 us/call down 2560x640 381.9 us/call --- after allocating and touching 28.00 GiB (free figure now 0.00 GiB) --- gate/up 1280x2560 1462.8 us/call (0.99x) down 2560x640 380.7 us/call (1.00x) ``` The pair costs **1.85 ms with the card empty and 1.84 ms with 28 GiB of it gone.** Memory pressure does not slow this kernel. And the engine's own fast arm measured 2.32 ms per expert pair, which is the same kernel plus its dequant - so the fast arm is within ~25% of what these two GEMMs cost. The slow arm measured 54-122 ms per pair. A kernel that costs 1.85 ms under full memory pressure cannot cost 111 ms in situ, so the slow arm's GEMM phases are almost entirely **something other than the GEMMs**, charged to them by the phase timing's own rule ("a gap where the GPU waits ... lands on the phase that was waiting"). So, revising the accounting: ~6,583 expert pairs at 1.85 ms each is about **12 s of real GEMM work out of 916 s** charged to those phases in the 255-token run. Over 98% of it is elsewhere. **What is now established, and it is a short list:** the plain-SYCL fallback GEMM is not the slow thing; the OpenCL backend has no free-VRAM query, so the post-write check cannot fire; the headroom removes the slowdown and changes nothing else about the run (identical tokens, identical calls, identical shapes, and the mirror is not involved either way). **What is open, restated:** where the ~900 s goes. The phase marks cannot separate work from waiting, and my GPU-utilisation sampling was not a clean percentage (the counter sums over the process's GPU Engine instances, so ~222 mean could be a little over two engines' worth, not "busy"). The measurement that would settle it is `STRATA_PREFILL_SYNC=1`, which waits at every mark and logs the phase that just finished: real kernel times collapse, idle does not. I have not run it. Two notes on getting here: the probe needs `ZEL_LIBRARY_PATH` pointed at a Level Zero loader to start on this machine, as the engine does; and `bisect.cpp` in `sycl/probe/` is the scratch file that isolated that, which should be deleted before this is committed anywhere.
Author
Owner

@demetree commented on GitHub (Oct 10, 2026):

STRATA_PREFILL_SYNC=1: the slowdown is spread across most kernels, not the expert GEMMs

Same build, same 65-token prompt, STRATA_PREFILL_SYNC=1 (the host waits at every phase mark, so the
numbers are what the GPU actually ran rather than spans that include waiting), headroom 0 against 1/6.
The expert count is the same in both arms (3,680 resident plus streamed), and the calls and their shapes
are identical:

phase headroom 0 headroom 1/6 ratio
gdn 8,194 ms 149 ms 55x
gdn out proj 3,426 ms 65 ms 53x
qsa proj 3,659 ms 86 ms 42x
gemm gate/up + gemm down 324,988 ms 8,399 ms 39x
dequant 4,326 ms 197 ms 22x
hc read 2,028 ms 362 ms 5.6x
whole prefill 348,696 ms 9,651 ms 36x

The whole prefill is 36x slower with the same work, and it is not one kernel: the recurrent gdn block,
which runs once per layer and never touches an expert, is 55x slower, as are the QSA projections and the
GDN output projection. At the level of an individual call that is gdn 171 ms per layer against 3.1 ms.

So the trigger is not the expert path and not the GEMM: when the cache fills the card, a broad set of
kernels slows down by 20-55x.
And the previous comment's probe says a flat 28 GiB allocation does not
slow the GEMM at all (0.99x), so it is not "the card is full" in the simple sense either.

What is still unexplained is what the engine's near-full working set does that a flat allocation does
not. The difference between the two is that the engine's 28.82 GiB is being read — by the expert
dequant, the projections and the KV — while the mirror's reads run concurrently, whereas the probe's fill
was written once and then never touched again. So the candidate is contention on the memory path between
VRAM traffic and the PCIe reads, but I have not measured it, and the memory counters I can sample are
Windows' adapter figures rather than the driver's own state.

Revised list of what is established. The headroom removes a real 36x slowdown and changes nothing
observable about the run (identical tokens, identical calls, identical shapes). The mirror is not
involved: 35% of a pack mirrored over PCIe costs nothing, and the slow arm streams fewer experts than
the fast one. The GEMM kernel is not intrinsically slow. The CUDA path is unaffected because
cudaMemGetInfo is live there and its post-write check works.

And what this issue is now about is not the expert path at all: a 20-55x slowdown across ordinary
kernels when the card's memory is nearly committed. That is a smaller and more specific question than
the issue's title, and it is the one worth answering next.

<!-- gh-comment-id:6097960545 --> @demetree commented on GitHub (Oct 10, 2026): ### STRATA_PREFILL_SYNC=1: the slowdown is spread across most kernels, not the expert GEMMs Same build, same 65-token prompt, `STRATA_PREFILL_SYNC=1` (the host waits at every phase mark, so the numbers are what the GPU actually ran rather than spans that include waiting), headroom 0 against 1/6. The expert count is the same in both arms (3,680 resident plus streamed), and the calls and their shapes are identical: | phase | headroom 0 | headroom 1/6 | ratio | |---|---|---|---| | `gdn` | 8,194 ms | 149 ms | **55x** | | `gdn out proj` | 3,426 ms | 65 ms | **53x** | | `qsa proj` | 3,659 ms | 86 ms | **42x** | | `gemm gate/up` + `gemm down` | 324,988 ms | 8,399 ms | 39x | | `dequant` | 4,326 ms | 197 ms | 22x | | `hc read` | 2,028 ms | 362 ms | 5.6x | | **whole prefill** | **348,696 ms** | **9,651 ms** | **36x** | The whole prefill is 36x slower with the same work, and it is not one kernel: the recurrent `gdn` block, which runs once per layer and never touches an expert, is 55x slower, as are the QSA projections and the GDN output projection. At the level of an individual call that is `gdn` 171 ms per layer against 3.1 ms. So the trigger is not the expert path and not the GEMM: **when the cache fills the card, a broad set of kernels slows down by 20-55x.** And the previous comment's probe says a flat 28 GiB allocation does not slow the GEMM at all (0.99x), so it is not "the card is full" in the simple sense either. **What is still unexplained** is what the engine's near-full working set does that a flat allocation does not. The difference between the two is that the engine's 28.82 GiB is *being read* — by the expert dequant, the projections and the KV — while the mirror's reads run concurrently, whereas the probe's fill was written once and then never touched again. So the candidate is contention on the memory path between VRAM traffic and the PCIe reads, but I have not measured it, and the memory counters I can sample are Windows' adapter figures rather than the driver's own state. **Revised list of what is established.** The headroom removes a real 36x slowdown and changes nothing observable about the run (identical tokens, identical calls, identical shapes). The mirror is not involved: 35% of a pack mirrored over PCIe costs nothing, and the slow arm streams *fewer* experts than the fast one. The GEMM kernel is not intrinsically slow. The CUDA path is unaffected because `cudaMemGetInfo` is live there and its post-write check works. **And what this issue is now about** is not the expert path at all: a 20-55x slowdown across ordinary kernels when the card's memory is nearly committed. That is a smaller and more specific question than the issue's title, and it is the one worth answering next.
Author
Owner

@demetree commented on GitHub (Oct 10, 2026):

The mechanism: the cliff is where the engine's total VRAM demand exceeds the card

Suggested on the tracker that the leftover 2 GiB is the display. It is, partly - but it is a small part,
and the arithmetic closes the question.

Per-process GPU memory right now, with the engine running the Coder config (\GPU Process Memory,
Dedicated Usage):

process MB
strata 30,943
dwm (the display compositor) 901
explorer 121
OpenCode 100
everything else ~200

So the display holds 0.88 GiB. The engine's own non-expert VRAM is the large term: with a 23.42 GiB
expert cache the engine holds 30.22 GiB of dedicated memory, which is 6.8 GiB of weights, KV, the MTP
draft head, and the prompt and verify buffers
.

And that closes the cliff exactly. The card is 31.16 GiB. A cache is safe while it plus the engine's
other 6.8 GiB stays under that, which puts the boundary at:

31.16 (card) - 6.8 (other) = 24.36 GiB of experts

Measured on this card, same build, IQ3_XXS, auto and hand-set sizes:

expert cache prefill
23.87 GiB (14,704 slots) 9.7 s safe
24.36 GiB predicted boundary
24.95 GiB (15,382 slots) 472 s cliff

The predicted boundary lands inside the measured gap. (The Coder and IQ3_XXS differ by a few hundred MiB
of weights and KV, so this is close rather than exact.)

So the cliff is not the mirror, not the expert path, not a kernel, and not the memory query: it is
total VRAM demand crossing the card
, and the engine only slows down once the driver starts evicting.
Every kernel that touches an evicted page crawls, which is why gdn (55x), the QSA projections (42x) and
the GDN output projection (53x) slow down along with the expert GEMMs - and why wait copy stays at 34
ms, because the copies themselves never waited; the reads of what was copied did.

Why the sizing misses it. STRATA_DEVICE_FREE_MIB is written once by setup_intel.py as
(vram_gb - 1.0) * 1024 = 31,744 MiB, and dpct's get_memory_info returns that constant instead of
asking the driver - the OpenCL backend has no free-VRAM query. So the engine sizes the cache against the
whole card, as if the 0.88 GiB of display, its own 6.8 GiB of weights, KV, draft head and prompt buffers,
and anything else the desktop is running did not exist. It then allocates the cache on top of them.

A 1 GiB deduction was presumably meant to cover the display and got the order of magnitude right for that
alone. It does not cover the engine's own second allocation wave, which is the term that matters.

This predicts the fix and explains the two platforms. auto on this card picks 28.82 GiB of experts,
which is 28.82 + 6.8 = 35.6 GiB of demand against a 31.16 GiB card - 4.4 GiB over, so the driver evicts
and every request crawls. Cutting the cache to 23.8 GiB brings the total to 30.6 GiB, just inside the
card, and nothing is evicted. On CUDA the same check works because cudaMemGetInfo is live, so the cache
is shrunk after the fact and the RTX 5070 Ti saw no difference - both its arms settled within 0.3 GiB of
each other.

The one number that would still be worth having is the same per-process breakdown on the slow arm,
where I expect strata's dedicated figure to sit at the card's limit with the missing 4.4 GiB appearing in
its shared usage. I have the shared figure (about 15 GiB, of which the mirror is 11.15) but not the
per-process split of it.

<!-- gh-comment-id:6098303265 --> @demetree commented on GitHub (Oct 10, 2026): ### The mechanism: the cliff is where the engine's total VRAM demand exceeds the card Suggested on the tracker that the leftover 2 GiB is the display. It is, partly - but it is a small part, and the arithmetic closes the question. **Per-process GPU memory right now**, with the engine running the Coder config (`\GPU Process Memory`, Dedicated Usage): | process | MB | |---|---| | `strata` | 30,943 | | `dwm` (the display compositor) | 901 | | `explorer` | 121 | | `OpenCode` | 100 | | everything else | ~200 | So the display holds **0.88 GiB**. The engine's own non-expert VRAM is the large term: with a 23.42 GiB expert cache the engine holds 30.22 GiB of dedicated memory, which is **6.8 GiB of weights, KV, the MTP draft head, and the prompt and verify buffers**. **And that closes the cliff exactly.** The card is 31.16 GiB. A cache is safe while it plus the engine's other 6.8 GiB stays under that, which puts the boundary at: 31.16 (card) - 6.8 (other) = 24.36 GiB of experts Measured on this card, same build, IQ3_XXS, `auto` and hand-set sizes: | expert cache | prefill | | |---|---|---| | 23.87 GiB (14,704 slots) | 9.7 s | safe | | **24.36 GiB** | | **predicted boundary** | | 24.95 GiB (15,382 slots) | 472 s | cliff | The predicted boundary lands inside the measured gap. (The Coder and IQ3_XXS differ by a few hundred MiB of weights and KV, so this is close rather than exact.) So the cliff is not the mirror, not the expert path, not a kernel, and not the memory *query*: **it is total VRAM demand crossing the card**, and the engine only slows down once the driver starts evicting. Every kernel that touches an evicted page crawls, which is why `gdn` (55x), the QSA projections (42x) and the GDN output projection (53x) slow down along with the expert GEMMs - and why `wait copy` stays at 34 ms, because the copies themselves never waited; the *reads of what was copied* did. **Why the sizing misses it.** `STRATA_DEVICE_FREE_MIB` is written once by `setup_intel.py` as `(vram_gb - 1.0) * 1024` = 31,744 MiB, and `dpct`'s `get_memory_info` returns that constant instead of asking the driver - the OpenCL backend has no free-VRAM query. So the engine sizes the cache against the whole card, as if the 0.88 GiB of display, its own 6.8 GiB of weights, KV, draft head and prompt buffers, and anything else the desktop is running did not exist. It then allocates the cache *on top of* them. A 1 GiB deduction was presumably meant to cover the display and got the order of magnitude right for that alone. It does not cover the engine's own second allocation wave, which is the term that matters. **This predicts the fix and explains the two platforms.** `auto` on this card picks 28.82 GiB of experts, which is 28.82 + 6.8 = 35.6 GiB of demand against a 31.16 GiB card - 4.4 GiB over, so the driver evicts and every request crawls. Cutting the cache to 23.8 GiB brings the total to 30.6 GiB, just inside the card, and nothing is evicted. On CUDA the same check works because `cudaMemGetInfo` is live, so the cache is shrunk after the fact and the RTX 5070 Ti saw no difference - both its arms settled within 0.3 GiB of each other. The one number that would still be worth having is the same per-process breakdown on the *slow* arm, where I expect `strata`'s dedicated figure to sit at the card's limit with the missing 4.4 GiB appearing in its shared usage. I have the shared figure (about 15 GiB, of which the mirror is 11.15) but not the per-process split of it.
Author
Owner

@Niko1221 commented on GitHub (Oct 10, 2026):

Thank you for the profile plan and for the second comment that narrowed it to the OpenCL backend. We cannot reproduce the 72x on Windows / OpenCL (we have only a Linux B70, where the mirror reads are fine), and the Level Zero V2 measurements in your second comment (570-758 tok/s with 8.7-23 GiB mirrored) say it is not the mirror itself. The part of this report that is the PLE table (the n-gram reads on the prompt path) is changed in v0.1.42: see #1425 and #1629. For the OpenCL path we would need the profile you describe (bytes moved over PCIe per second during the prefill, with and without the mirror); if you can run STRATA_VERIFY_PROFILE=1 on a prompt with the mirror we would start there.

<!-- gh-comment-id:6099602999 --> @Niko1221 commented on GitHub (Oct 10, 2026): Thank you for the profile plan and for the second comment that narrowed it to the OpenCL backend. We cannot reproduce the 72x on Windows / OpenCL (we have only a Linux B70, where the mirror reads are fine), and the Level Zero V2 measurements in your second comment (570-758 tok/s with 8.7-23 GiB mirrored) say it is not the mirror itself. The part of this report that is the PLE table (the n-gram reads on the prompt path) is changed in v0.1.42: see #1425 and #1629. For the OpenCL path we would need the profile you describe (bytes moved over PCIe per second during the prefill, with and without the mirror); if you can run `STRATA_VERIFY_PROFILE=1` on a prompt with the mirror we would start there.
Author
Owner

@demetree commented on GitHub (Oct 10, 2026):

The profile you asked for: the mirror's PCIe traffic is 0.25% of the prefill, and 36% more of it moves the prompt by 1.3%

Arc Pro B70, Windows, OpenCL backend, eager, driver 32.0.101.8976, Flash-Next IQ3_XXS pack, 2,049-token
prompt, STRATA_PREFILL_TIMING=1 and STRATA_VERIFY_PROFILE=1, engine 0.1.41 on this branch. IQ3_XXS is
39.97 GiB of experts on a 31.16 GiB card, so a mirror is unavoidable and the arms differ in how much of
one there is:

experts mirrored streamed during the prefill wait copy (the phase waiting for the staging DMAs) prefill
A, auto with a live free figure 10,221 (16.62 GiB) 5,810 (5,494 by DMA) 77 ms of 31,695 — 0.24% 31,763 ms (64.5 tok/s)
B, --expert-cache 8000 13,878 (22.61 GiB) 7,874 (7,540 by DMA) 90 ms of 32,116 — 0.28% 32,176 ms (63.7 tok/s)

36% more mirrored bytes and 36% more experts streamed moved the prompt by 1.3%. STRATA_VERIFY_PROFILE's
own line reads 0.00 distinct experts per layer read over PCIe. On the bandwidth side: arm B moves about
7,874 x 1.7 MiB = 13.4 GiB over PCIe inside a 32.2 s prefill, which is 0.42 GB/s against the 8.3 GB/s
this card's own PCIe probe measures - the bus is at 5% of what it can do, and there is room for several
times more mirror before it would show up.

The same arms with the phases broken out, since that is where the time does go:

A: gemm gate/up 19591 (61.8%)  gemm down 7548 (23.8%)  dequant 474 (1.5%)  wait copy 77 (0.2%)  ple 67 (0.2%)
B: gemm gate/up 19600 (61.0%)  gemm down 8097 (25.2%)  dequant 446 (1.4%)  wait copy 90 (0.3%)  ple 30 (0.1%)

What this says about the report's premise. The 72x was not the mirror's PCIe traffic. The measured
cliff on this card sat at a 28.82 GiB expert cache against a 31.16 GiB card and disappeared when the free
figure the sizing reads became live - with the mirror size unchanged. In the arms above the mirror is
16.62 GiB and the prompt reads at 64.5 tok/s; in the pre-fix cliff run the mirror was smaller, 11.15
GiB, and the prompt read at 1.06 tok/s. A smaller mirror was 60x slower, which is the whole argument.

That matches what you already concluded from the Level Zero V2 figures: 570-758 tok/s with 8.7-23 GiB
mirrored says it is not the mirror itself.

One thing I should flag about the comparison rather than bury: this is engine 0.1.41, so the PLE table
is the pre-#1425/#1629 one you point at.
On this card the ple phase is 67 ms of 31,695 (0.2%) for the
whole 2,049-token prompt, so whatever those changes did to the n-gram reads on the prompt path, there
does not appear to be much there to reclaim here - but that is this card's number, not a general one.

So the OpenCL half of this report is a sizing problem, not a mirror problem, and the fix for it is in
#1390: device_free_bytes() on this backend answered from STRATA_DEVICE_FREE_MIB, a setup-time
constant, so auto sized a cache against the whole card and then allocated 6.8 GiB on top of it. With a
live figure from DXGI, auto is told 23.84 GiB rather than 31.00 and the same 2,048-token prompt reads
at 113 tok/s for the Coder with 56.3 tok/s of decode against 73.8 and 13.0 before.

Happy to run anything else you want on this card - the remaining open question here is what the GPU is
doing with the last 2 GiB when the card is over-committed, which is a different measurement from this
one and I have not done it.

<!-- gh-comment-id:6100729631 --> @demetree commented on GitHub (Oct 10, 2026): ### The profile you asked for: the mirror's PCIe traffic is 0.25% of the prefill, and 36% more of it moves the prompt by 1.3% Arc Pro B70, Windows, OpenCL backend, eager, driver 32.0.101.8976, Flash-Next IQ3_XXS pack, 2,049-token prompt, `STRATA_PREFILL_TIMING=1` and `STRATA_VERIFY_PROFILE=1`, engine 0.1.41 on this branch. IQ3_XXS is 39.97 GiB of experts on a 31.16 GiB card, so a mirror is unavoidable and the arms differ in how much of one there is: | | experts mirrored | streamed during the prefill | `wait copy` (the phase waiting for the staging DMAs) | prefill | |---|---|---|---|---| | A, `auto` with a live free figure | 10,221 (16.62 GiB) | 5,810 (5,494 by DMA) | 77 ms of 31,695 — **0.24%** | 31,763 ms (**64.5 tok/s**) | | B, `--expert-cache 8000` | 13,878 (**22.61 GiB**) | 7,874 (7,540 by DMA) | 90 ms of 32,116 — **0.28%** | 32,176 ms (**63.7 tok/s**) | 36% more mirrored bytes and 36% more experts streamed moved the prompt by 1.3%. `STRATA_VERIFY_PROFILE`'s own line reads `0.00 distinct experts per layer read over PCIe`. On the bandwidth side: arm B moves about 7,874 x 1.7 MiB = 13.4 GiB over PCIe inside a 32.2 s prefill, which is **0.42 GB/s** against the 8.3 GB/s this card's own PCIe probe measures - the bus is at 5% of what it can do, and there is room for several times more mirror before it would show up. The same arms with the phases broken out, since that is where the time does go: ``` A: gemm gate/up 19591 (61.8%) gemm down 7548 (23.8%) dequant 474 (1.5%) wait copy 77 (0.2%) ple 67 (0.2%) B: gemm gate/up 19600 (61.0%) gemm down 8097 (25.2%) dequant 446 (1.4%) wait copy 90 (0.3%) ple 30 (0.1%) ``` **What this says about the report's premise.** The 72x was not the mirror's PCIe traffic. The measured cliff on this card sat at a 28.82 GiB expert cache against a 31.16 GiB card and disappeared when the free figure the sizing reads became live - with the mirror size unchanged. In the arms above the mirror is 16.62 GiB and the prompt reads at 64.5 tok/s; in the pre-fix cliff run the mirror was *smaller*, 11.15 GiB, and the prompt read at 1.06 tok/s. A smaller mirror was 60x slower, which is the whole argument. That matches what you already concluded from the Level Zero V2 figures: 570-758 tok/s with 8.7-23 GiB mirrored says it is not the mirror itself. One thing I should flag about the comparison rather than bury: **this is engine 0.1.41, so the PLE table is the pre-#1425/#1629 one you point at.** On this card the `ple` phase is 67 ms of 31,695 (0.2%) for the whole 2,049-token prompt, so whatever those changes did to the n-gram reads on the prompt path, there does not appear to be much there to reclaim here - but that is this card's number, not a general one. So the OpenCL half of this report is a sizing problem, not a mirror problem, and the fix for it is in #1390: `device_free_bytes()` on this backend answered from `STRATA_DEVICE_FREE_MIB`, a setup-time constant, so `auto` sized a cache against the whole card and then allocated 6.8 GiB on top of it. With a live figure from DXGI, `auto` is told 23.84 GiB rather than 31.00 and the same 2,048-token prompt reads at 113 tok/s for the Coder with 56.3 tok/s of decode against 73.8 and 13.0 before. Happy to run anything else you want on this card - the remaining open question here is what the GPU is doing with the last 2 GiB when the card is over-committed, which is a different measurement from this one and I have not done it.
Author
Owner

@Niko1221 commented on GitHub (Oct 13, 2026):

Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.

If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.

<!-- gh-comment-id:6156129694 --> @Niko1221 commented on GitHub (Oct 13, 2026): Thanks for the report. To keep the tracker current we are closing issues older than three days: [0.1.44](https://github.com/Niko1221/Strata/releases/tag/v0.1.44) is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1. If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#618
No description provided.