[GH-ISSUE #3976] [Engine] Layer-major prefill on a CUDA layer split: 32K prompts 2.0x faster, 0.47x drive reads (Qwen3.8-Flash-Next, v0.2.4.2) #1705

Open
opened 2026-11-04 01:53:20 +07:00 by bsakaguchi · 28 comments
Owner

Originally created by @Norhiro on GitHub (Oct 24, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3976

Summary

Layer-major prefill was proposed in #1670 by @vizdatom for one GPU, and that issue was closed. 0.2.4 (and 0.2.4.2) has a layer-major prompt path only in the DeepSeek engine (src/dsv41), also for one device. The Qwen path (src/prefill/prefill.cpp) has no layer-major mode yet.

I extended @vizdatom's layer-major prefill to the CUDA layer split:

  • Each stage runs its own layers layer-major over the same super-chunk.
  • It then hands the super-chunk's rows to the next stage.
  • The next stage starts on super-chunk k while the first stage reads super-chunk k+1, with one hand-off buffer.

On a 2-GPU split (RTX 3060 + RTX 5060 Ti) with a streamed UD-Q4_K_XL, compared with official v0.2.4.2:

prompt official 0.2.4.2 TTFT layer-major split TTFT drive reads
8K 28.9 s 18.5 s (1.6x) 25 → 19 GB
20K 54.2 s 23.5 s (2.3x) 61 → 18 GB
32K 65.0 s 33.1 s (1.96x) 75 → 35 GB

(warm runs, i.e. the second run of each size; same prompts in both arms)

Quality is unchanged against the official v0.2.4.2 build on the same split (and the same as on 0.2.2):

  • T4 needle: 9/9 in both arms, at 4K / 16K / 32K × depth 10 / 50 / 90 %.
  • HumanEval 0–39: 39/38 base/plus in both.
  • 12 Japanese questions: 11/12 in both, the same item fails.
  • Tool calls: 8/8 in both.

Decode speed is the same within run-to-run noise: on 0.2.4.2, median 24.0 tok/s official and 24.1 tok/s with this change (on 0.2.2: 27.7–29.7 and 27.8–28.2). Decode does not use this path.

Everything is opt-in. With STRATA_PREFILL_LAYER_MAJOR unset, the engine runs the official path.

Credit

The layer-major prefill itself is @vizdatom's work from #1670, branch layer-major-0.1.43.1: commits 2e69b6db, f0173382, 149b8995 and the stager / warm commits.

I ported it to 0.2.2 and then rebased it onto 0.2.4 and 0.2.4.2. The port includes:

  • an FP16 expert path for layers that MMQ does not take (all 48 layers of UD-Q4_K_XL);
  • the STRATA_HC_Q8 dequant;
  • guards for APR, NVFP4 and WMMA layers.

The layer-split part below is new.

What the change does

  1. Layer-major on a split (run_layer_major, lm_prepare_chain):
    • Every stage gets the same super-chunk size: the smallest that all stages fit.
    • The first stage reads super-chunk k for its layers and writes the rows into the next stage's pinned R_host.
    • The next stage runs on a thread (next_run_). The first stage meanwhile reads super-chunk k+1, so there is one hand-off buffer.
    • The PLE layer must be in the first stage, which holds layers 0 and 1.
  2. Even super-chunks (STRATA_PREFILL_LM_EVEN, default on when layer-major is on):
    • A prompt longer than the common super-chunk is split into equal parts. For example, 32K at a 28K fit becomes 2 × 16K, not 28K + 4K.
    • This keeps each stage's residual rows in VRAM and keeps the stages overlapping.
    • Without it, at --vram-reserve-later-mib 1700, 32K went 28672 + 3271: the stages ran almost one after the other and TTFT rose from 30 s to 36–40 s.
    • The idea is similar to --prefill-pipe (#1441), which evens the chunk-major path's chunks. Here --prefill-pipe 1 gave no gain on the official path: its 32K chunks are already 4 × 8192.
  3. A stale hand-off no longer disables layer-major:
    • run_impl leaves a later stage's hand_in_ set after a chunk-major prompt.
    • Before this fix, one short prompt (under one sub-chunk) turned layer-major off for every later prompt of the session, with the message "a layer split's chunk hand-off is in use".
    • lm_prepare_chain now clears it when no hand-off is in flight.

Why it helps

  • With --prefill auto the official path reads a 32K prompt in 4 chunks of 8192. Each chunk streams every layer's routed experts again. The plan line itself says "about 105.8 GB read from the drive per 32768-token prompt (4 chunks)".
  • Layer-major reads each layer's experts once per super-chunk. On a split, the stages' expert reads overlap.
  • #1407 reported the same re-read pattern on a layer split.

Setup

  • i7-7800X, 62 GB RAM, Fedora 44.
  • GPUs: RTX 3060 12 GB (PCIe Gen3 x16) runs layers 0–23; RTX 5060 Ti 16 GB (Gen3 x8) runs layers 24–47.
  • Model drive: Solidigm P41 Plus, Gen3 x4, about 2 GB/s O_DIRECT.
  • Qwen3.8-Flash-Next UD-Q4_K_XL (native).
  • Common flags: --resident-budget-gib 38, --expert-cache auto, "layer_split": "24", --trim-stage-weights, --kv int8, --max-context 40960, --spec 4 with MTP, STRATA_HC_Q8=1, tail skip on (default).
  • Official arm: --prefill auto, --vram-reserve-later-mib 1400.
  • Layer-major arm:
    • STRATA_PREFILL_LAYER_MAJOR=1, STRATA_PREFILL_LM_TOKENS=32768, --prefill 4096;
    • --vram-reserve-mib 1700 --vram-reserve-later-mib 1700 for the tables, or 1700 / 1400 (same speed at 32K).
  • Method:
    • Before each arm, the model's pages are dropped from the page cache and the server is started.
    • Prompts are fresh word-list prompts with a per-arm nonce, the same in both arms; each size is run twice.
    • Drive bytes come from /proc/diskstats.
    • The results were reproduced four times with different prompt sets: on 0.2.2 twice, then on 0.2.4 and on 0.2.4.2.
run 32K official 32K layer-major split
0.2.2, set 1 57–62 s, 82–85 GB 30–32 s, 34 GB
0.2.2, set 2 59–61 s, 84–90 GB 29.6 s, 35 GB
0.2.4 61.6 s, 86 GB 30.0 s, 36 GB
0.2.4.2 65.0 s, 75 GB 33.1 s, 35 GB

Limits and open points

  • Tested only on CUDA, on one 2-stage split, with one model and quant.
  • Not tested: HIP, SYCL, more than 2 stages, the peer-GPU tier (it is declined), or prompts over 40K.
  • The 3060 stage (about 19.5 s of a 32K prompt) is now the limit.
    • A second hand-off buffer, or moving the layer boundary, may help further.
    • --layer-split auto costs layers by decode time, not prefill time.
  • --prefill 4096 is used for the sub-chunk. Prompts under one sub-chunk stay on the chunk-major path, at the official speed.

The branch is a series of 12 commits on top of v0.2.4.2: https://github.com/Norhiro/Strata/compare/dfa3f402...layer-major-split-0.2.4.2 (the first 4 are @vizdatom's #1670 commits, cherry-picked with authorship kept). I can open it as a PR if you are interested.

Originally created by @Norhiro on GitHub (Oct 24, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/3976 ## Summary Layer-major prefill was proposed in #1670 by @vizdatom for one GPU, and that issue was closed. 0.2.4 (and 0.2.4.2) has a layer-major prompt path only in the DeepSeek engine (`src/dsv41`), also for one device. The Qwen path (`src/prefill/prefill.cpp`) has no layer-major mode yet. I extended @vizdatom's layer-major prefill to the CUDA **layer split**: - Each stage runs its own layers layer-major over the same super-chunk. - It then hands the super-chunk's rows to the next stage. - The next stage starts on super-chunk k while the first stage reads super-chunk k+1, with one hand-off buffer. On a 2-GPU split (RTX 3060 + RTX 5060 Ti) with a streamed UD-Q4_K_XL, compared with official **v0.2.4.2**: | prompt | official 0.2.4.2 TTFT | layer-major split TTFT | drive reads | |---|---|---|---| | 8K | 28.9 s | 18.5 s (**1.6x**) | 25 → 19 GB | | 20K | 54.2 s | 23.5 s (**2.3x**) | 61 → 18 GB | | 32K | 65.0 s | 33.1 s (**1.96x**) | 75 → 35 GB | (warm runs, i.e. the second run of each size; same prompts in both arms) Quality is unchanged against the official v0.2.4.2 build on the same split (and the same as on 0.2.2): - T4 needle: 9/9 in both arms, at 4K / 16K / 32K × depth 10 / 50 / 90 %. - HumanEval 0–39: 39/38 base/plus in both. - 12 Japanese questions: 11/12 in both, the same item fails. - Tool calls: 8/8 in both. Decode speed is the same within run-to-run noise: on 0.2.4.2, median 24.0 tok/s official and 24.1 tok/s with this change (on 0.2.2: 27.7–29.7 and 27.8–28.2). Decode does not use this path. Everything is opt-in. With `STRATA_PREFILL_LAYER_MAJOR` unset, the engine runs the official path. ## Credit The layer-major prefill itself is @vizdatom's work from #1670, branch `layer-major-0.1.43.1`: commits `2e69b6db`, `f0173382`, `149b8995` and the stager / warm commits. I ported it to 0.2.2 and then rebased it onto 0.2.4 and 0.2.4.2. The port includes: - an FP16 expert path for layers that MMQ does not take (all 48 layers of UD-Q4_K_XL); - the `STRATA_HC_Q8` dequant; - guards for APR, NVFP4 and WMMA layers. The layer-split part below is new. ## What the change does 1. **Layer-major on a split** (`run_layer_major`, `lm_prepare_chain`): - Every stage gets the same super-chunk size: the smallest that all stages fit. - The first stage reads super-chunk k for its layers and writes the rows into the next stage's pinned `R_host`. - The next stage runs on a thread (`next_run_`). The first stage meanwhile reads super-chunk k+1, so there is one hand-off buffer. - The PLE layer must be in the first stage, which holds layers 0 and 1. 2. **Even super-chunks** (`STRATA_PREFILL_LM_EVEN`, default on when layer-major is on): - A prompt longer than the common super-chunk is split into equal parts. For example, 32K at a 28K fit becomes 2 × 16K, not 28K + 4K. - This keeps each stage's residual rows in VRAM and keeps the stages overlapping. - Without it, at `--vram-reserve-later-mib 1700`, 32K went 28672 + 3271: the stages ran almost one after the other and TTFT rose from 30 s to 36–40 s. - The idea is similar to `--prefill-pipe` (#1441), which evens the chunk-major path's chunks. Here `--prefill-pipe 1` gave no gain on the official path: its 32K chunks are already 4 × 8192. 3. **A stale hand-off no longer disables layer-major**: - `run_impl` leaves a later stage's `hand_in_` set after a chunk-major prompt. - Before this fix, one short prompt (under one sub-chunk) turned layer-major off for every later prompt of the session, with the message "a layer split's chunk hand-off is in use". - `lm_prepare_chain` now clears it when no hand-off is in flight. ## Why it helps - With `--prefill auto` the official path reads a 32K prompt in 4 chunks of 8192. Each chunk streams every layer's routed experts again. The plan line itself says "about 105.8 GB read from the drive per 32768-token prompt (4 chunks)". - Layer-major reads each layer's experts once per super-chunk. On a split, the stages' expert reads overlap. - #1407 reported the same re-read pattern on a layer split. ## Setup - i7-7800X, 62 GB RAM, Fedora 44. - GPUs: RTX 3060 12 GB (PCIe Gen3 x16) runs layers 0–23; RTX 5060 Ti 16 GB (Gen3 x8) runs layers 24–47. - Model drive: Solidigm P41 Plus, Gen3 x4, about 2 GB/s O_DIRECT. - Qwen3.8-Flash-Next UD-Q4_K_XL (native). - Common flags: `--resident-budget-gib 38`, `--expert-cache auto`, `"layer_split": "24"`, `--trim-stage-weights`, `--kv int8`, `--max-context 40960`, `--spec 4` with MTP, `STRATA_HC_Q8=1`, tail skip on (default). - Official arm: `--prefill auto`, `--vram-reserve-later-mib 1400`. - Layer-major arm: - `STRATA_PREFILL_LAYER_MAJOR=1`, `STRATA_PREFILL_LM_TOKENS=32768`, `--prefill 4096`; - `--vram-reserve-mib 1700 --vram-reserve-later-mib 1700` for the tables, or `1700 / 1400` (same speed at 32K). - Method: - Before each arm, the model's pages are dropped from the page cache and the server is started. - Prompts are fresh word-list prompts with a per-arm nonce, the same in both arms; each size is run twice. - Drive bytes come from `/proc/diskstats`. - The results were reproduced four times with different prompt sets: on 0.2.2 twice, then on 0.2.4 and on 0.2.4.2. | run | 32K official | 32K layer-major split | |---|---|---| | 0.2.2, set 1 | 57–62 s, 82–85 GB | 30–32 s, 34 GB | | 0.2.2, set 2 | 59–61 s, 84–90 GB | 29.6 s, 35 GB | | 0.2.4 | 61.6 s, 86 GB | 30.0 s, 36 GB | | 0.2.4.2 | 65.0 s, 75 GB | 33.1 s, 35 GB | ## Limits and open points - Tested only on CUDA, on one 2-stage split, with one model and quant. - Not tested: HIP, SYCL, more than 2 stages, the peer-GPU tier (it is declined), or prompts over 40K. - The 3060 stage (about 19.5 s of a 32K prompt) is now the limit. - A second hand-off buffer, or moving the layer boundary, may help further. - `--layer-split auto` costs layers by decode time, not prefill time. - `--prefill 4096` is used for the sub-chunk. Prompts under one sub-chunk stay on the chunk-major path, at the official speed. The branch is a series of 12 commits on top of v0.2.4.2: https://github.com/Norhiro/Strata/compare/dfa3f402...layer-major-split-0.2.4.2 (the first 4 are @vizdatom's #1670 commits, cherry-picked with authorship kept). I can open it as a PR if you are interested.
Author
Owner

@oscarlius commented on GitHub (Oct 25, 2026):

We have a related workload on Qwen3.8-Flash-Next IQ3_S, four RTX 4090s, four stages and 16 slots. Our recorded 128K run had a median cold prompt read of 20.453 s; a 16-request wave (15 cold, one warmed) had TTFT p50 of 164.776 s. The first tokens arrived roughly one prompt-read interval apart. Stage-copy improvements in #4002 help cache hits, but the cold-admission queue remains.

Before extending the work by vizdatom and Norhiro here: is an opt-in Qwen split layer-major prefill path within the direction you want to maintain?

The proposed boundary is one prompt at a time, with the existing chunk-major path unchanged by default. It would preserve MTP/on_chunk and BYIELD state, fall back for incompatible checkpoint boundaries or concurrent-reader mode, and cap temporary device/pinned memory. This would reduce individual read cost, not introduce multi-sequence admission.

We have only a partial local port, with no new engine build or hardware validation and no performance claim. If this scope is useful, we can narrow the patch around your preferred interface and supply bounded same-hardware correctness/resource/performance comparisons. If the preference is to retain chunk-major Qwen prefill, we will keep this experiment out of a new PR and focus on the existing cache-copy work.

<!-- gh-comment-id:6393466772 --> @oscarlius commented on GitHub (Oct 25, 2026): We have a related workload on Qwen3.8-Flash-Next IQ3_S, four RTX 4090s, four stages and 16 slots. Our recorded 128K run had a median cold prompt read of 20.453 s; a 16-request wave (15 cold, one warmed) had TTFT p50 of 164.776 s. The first tokens arrived roughly one prompt-read interval apart. Stage-copy improvements in #4002 help cache hits, but the cold-admission queue remains. Before extending the work by vizdatom and Norhiro here: is an **opt-in Qwen split layer-major prefill path** within the direction you want to maintain? The proposed boundary is one prompt at a time, with the existing chunk-major path unchanged by default. It would preserve MTP/on_chunk and BYIELD state, fall back for incompatible checkpoint boundaries or concurrent-reader mode, and cap temporary device/pinned memory. This would reduce individual read cost, not introduce multi-sequence admission. We have only a partial local port, with no new engine build or hardware validation and no performance claim. If this scope is useful, we can narrow the patch around your preferred interface and supply bounded same-hardware correctness/resource/performance comparisons. If the preference is to retain chunk-major Qwen prefill, we will keep this experiment out of a new PR and focus on the existing cache-copy work.
Author
Owner

@oscarlius commented on GitHub (Oct 25, 2026):

We opened a separate diagnostic report in #4069 to keep the observations and validation limits distinct from this layer-major proposal.

On the ordinary chunk-major path, two fixed-config 130,658-token, prefill=2048 A/A requests matched at three early state checkpoints (first-token logits NRMSE=0, KL=0) and returned identical output, but had different per-verify timings and a later recorded suffix/MTP path difference. We stopped before the 8192 or MTP-off arms. The report includes the matched-window data, source/binary identity, instrumentation caveats and measurement gaps.

This was an instrumented older baseline, not current main/v0.2.4.2 and not your layer-major branch. It neither validates nor disproves the speedup here, and does not establish a shared root cause. Linking only as validation-method context; no fix is claimed.

<!-- gh-comment-id:6395321299 --> @oscarlius commented on GitHub (Oct 25, 2026): We opened a separate diagnostic report in #4069 to keep the observations and validation limits distinct from this layer-major proposal. On the ordinary chunk-major path, two fixed-config 130,658-token, prefill=2048 A/A requests matched at three early state checkpoints (first-token logits NRMSE=0, KL=0) and returned identical output, but had different per-verify timings and a later recorded suffix/MTP path difference. We stopped before the 8192 or MTP-off arms. The report includes the matched-window data, source/binary identity, instrumentation caveats and measurement gaps. This was an instrumented older baseline, not current main/v0.2.4.2 and not your layer-major branch. It neither validates nor disproves the speedup here, and does not establish a shared root cause. Linking only as validation-method context; no fix is claimed.
Author
Owner

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

Thank you both. The layer-major prefill is in 0.2.7 and is on by default for a layer split over two CUDA cards. On two RTX A4000 (Qwen IQ3_XXS, experts streamed from RAM, five paired runs) the first word after a 32K prompt came after 27.7 s instead of 141.8 s, after 20K after 17.5 s instead of 98.8 s, after 8K after 15.2 s instead of 41.8 s, and decode speed is the same (38.6 against 38.4 tok/s). The first-token probabilities moved by 0.0007 to 0.009 (KL) with the same top choice, 12 of 12 needles were found and the 19-task quick suite passed 18 of 19 with and without it. It reads the old way when a card has no room, on one card, on Radeon and in the approximate-read mode. Off: STRATA_PREFILL_LAYER_MAJOR=0 (STRATA_DEFAULTS=026 gives the old path). We only had two A4000 and two A6000; could you try 0.2.7 on your cards and tell us what you get?

Release: https://github.com/Niko1221/Strata/releases/tag/v0.2.7

<!-- gh-comment-id:6446115172 --> @Niko1221 commented on GitHub (Oct 27, 2026): Thank you both. The layer-major prefill is in 0.2.7 and is on by default for a layer split over two CUDA cards. On two RTX A4000 (Qwen IQ3_XXS, experts streamed from RAM, five paired runs) the first word after a 32K prompt came after 27.7 s instead of 141.8 s, after 20K after 17.5 s instead of 98.8 s, after 8K after 15.2 s instead of 41.8 s, and decode speed is the same (38.6 against 38.4 tok/s). The first-token probabilities moved by 0.0007 to 0.009 (KL) with the same top choice, 12 of 12 needles were found and the 19-task quick suite passed 18 of 19 with and without it. It reads the old way when a card has no room, on one card, on Radeon and in the approximate-read mode. Off: STRATA_PREFILL_LAYER_MAJOR=0 (STRATA_DEFAULTS=026 gives the old path). We only had two A4000 and two A6000; could you try 0.2.7 on your cards and tell us what you get? Release: https://github.com/Niko1221/Strata/releases/tag/v0.2.7
Author
Owner

@udqe commented on GitHub (Oct 28, 2026):

Note

AI-assisted — model: Qwen3.8-Flash-Next (Unsloth UD-Q4_K_XL) served by this repo's own engine 0.1.52, driven by a DeepSeek-based harness. The maintainer reproduced and cross-checked every claim below against the 0.1.52/v0.2.7 source and this machine's own logs.

Adding 2x4090 field data: the shipped default-off-for-tight-reserve behaviour means the walk from this thread never engages unless opted in. Windows 11, 2x RTX 4090 24 GiB (PCIe 4.0 x16 both, probe 26.3-26.4 GB/s), 128 GiB RAM, engine 0.1.52 / v0.2.7, UD-Q4_K_XL, --layer-split auto (K=22) --pipeline-windows 2 --spec 4 --max-context 307200 --vram-reserve-mib 1728 --vram-reserve-later-mib 972 --conversation-cache-mib 12288.

Startup says it is on, then every prompt declines (17 identical-family lines in one agent-workday):

strata prefill: layer-major prefill is on for this layer split (each layer's experts are read once per super-chunk of up to 32768 tokens, ...)
strata prefill: layer-major off for this prompt: layers 22..48: no VRAM for a super-chunk (1171 MiB free)

Reading lm_prepare() (prefill.cpp ~5905-6036, 0.1.52): the default needs 2 x auto chunk (8192) = 16384 tokens minimum, keeps a 512 MiB default margin, and in auto mode uses VRAM mode only if the whole target fits — on a box that holds #2065-recommended reserves the room is ~500-700 MiB, below the ~725 MiB host geometry, so nothing ever fits. The asymmetry: an explicit STRATA_PREFILL_LAYER_MAJOR=1 gets the 96 MiB margin — the untouched default is stricter than the opt-in. The decline text ("no VRAM") also names the wrong knob when what failed was the pinned-host fit, and the live MiB free value defeats the once-per-reason dedup (hence the log spam).

Controlled A/B on this machine (same model, same prompts, env-only change, reproduced locally): adding STRATA_PREFILL_LM_MARGIN_MIB=96 -> the CUDA0 stage now engages (its decline line gone); the later stage still declines with 734 MiB free, since --vram-reserve-later-mib 972 leaves it less free — a partial, safe win. Honest caveat: on this box cold 170-185K prompts read at ~3,200-3,290 tok/s before and after (experts are ~97% VRAM-resident, so the drive-read win from your thread does not apply here); the gain should show on streamed/expert-miss workloads like yours. Suggested fixes for the default path: try partial VRAM fits (sv < S), scale the default margin with observed free VRAM instead of a fixed 512 MiB, allow min_s = chunk when room is the binder, name the failed mode, dedup on a stable prefix.

<!-- gh-comment-id:6459022158 --> @udqe commented on GitHub (Oct 28, 2026): > [!NOTE] > AI-assisted — model: **Qwen3.8-Flash-Next (Unsloth UD-Q4_K_XL)** served by this repo's own engine 0.1.52, driven by a DeepSeek-based harness. The maintainer reproduced and cross-checked every claim below against the 0.1.52/v0.2.7 source and this machine's own logs. Adding 2x4090 field data: **the shipped default-off-for-tight-reserve behaviour means the walk from this thread never engages unless opted in.** Windows 11, 2x RTX 4090 24 GiB (PCIe 4.0 x16 both, probe 26.3-26.4 GB/s), 128 GiB RAM, engine 0.1.52 / v0.2.7, UD-Q4_K_XL, `--layer-split auto (K=22) --pipeline-windows 2 --spec 4 --max-context 307200 --vram-reserve-mib 1728 --vram-reserve-later-mib 972 --conversation-cache-mib 12288`. Startup says it is on, then every prompt declines (17 identical-family lines in one agent-workday): ``` strata prefill: layer-major prefill is on for this layer split (each layer's experts are read once per super-chunk of up to 32768 tokens, ...) strata prefill: layer-major off for this prompt: layers 22..48: no VRAM for a super-chunk (1171 MiB free) ``` Reading `lm_prepare()` (prefill.cpp ~5905-6036, 0.1.52): the default needs `2 x auto chunk (8192) = 16384` tokens minimum, keeps a **512 MiB default margin**, and in auto mode uses VRAM mode **only if the whole target fits** — on a box that holds #2065-recommended reserves the room is ~500-700 MiB, below the ~725 MiB host geometry, so nothing ever fits. The asymmetry: an explicit `STRATA_PREFILL_LAYER_MAJOR=1` gets the **96 MiB** margin — the untouched default is stricter than the opt-in. The decline text ("no VRAM") also names the wrong knob when what failed was the pinned-host fit, and the live `MiB free` value defeats the once-per-reason dedup (hence the log spam). Controlled A/B on this machine (same model, same prompts, env-only change, reproduced locally): adding `STRATA_PREFILL_LM_MARGIN_MIB=96` -> the CUDA0 stage now engages (its decline line gone); the later stage still declines with `734 MiB free`, since `--vram-reserve-later-mib 972` leaves it less free — a partial, safe win. Honest caveat: on this box cold 170-185K prompts read at ~3,200-3,290 tok/s **before and after** (experts are ~97% VRAM-resident, so the drive-read win from your thread does not apply here); the gain should show on streamed/expert-miss workloads like yours. Suggested fixes for the default path: try partial VRAM fits (`sv < S`), scale the default margin with observed free VRAM instead of a fixed 512 MiB, allow `min_s = chunk` when room is the binder, name the failed mode, dedup on a stable prefix.
Author
Owner

@fioruccione commented on GitHub (Oct 28, 2026):

Same thing as @udqe's 4090s, on a smaller pair: on 2x RTX 4060 Ti 16 GB the default walk never starts.

v0.2.7.1 built here, Qwen3.8-Flash-Next UD-IQ4_XS, --layer-split auto, --expert-cache auto, MTP on. Cold prompts of 20K, 32K and 69K tokens. Startup says layer-major prefill is on, then every long prompt logs layer-major off for this prompt: no VRAM for a super-chunk (309-354 MiB free). I tried three ways to make room, each one with fresh starts:

  1. Default: CUDA1 starts with 381 MiB free and the walk declines.
  2. STRATA_STAGE_TRIM=1 with an explicit split 23: every card drops the other stage's dense weights, so 25% more experts fit in VRAM (7618 -> 9557). But --expert-cache auto takes all of it, CUDA1 is still at about 380 MiB, and the walk still declines.
  3. STRATA_PREFILL_LM_MARGIN_MIB=96 plus --vram-reserve-later-mib 1100: CUDA1 now starts with 781 MiB free and the LOW warning is gone, but the walk still declines at 311-353 MiB. The line doesn't name the card; since CUDA1 had 781 MiB, I read it as CUDA0, which stays at about 400 MiB. That part is my reading, not something the log says.

So on a 16 GB pair with the expert cache on auto, neither card has room for a super-chunk unless VRAM comes out of the experts on both. For reference, the chunk-major path here reads 20K at 1768, 32K at 2039 and 69K at 2302 tok/s.

Not run: a bigger --vram-reserve-mib on CUDA0 as well. Without it the walk never ran on this pair, so I have no speed number for the walk itself. If you want it, I can run that arm.

I did this with an AI coding assistant: it wrote the scripts and helped me read the engine code. I ran everything on my machine and checked the numbers.

<!-- gh-comment-id:6471359149 --> @fioruccione commented on GitHub (Oct 28, 2026): Same thing as @udqe's 4090s, on a smaller pair: on 2x RTX 4060 Ti 16 GB the default walk never starts. `v0.2.7.1` built here, Qwen3.8-Flash-Next UD-IQ4_XS, `--layer-split auto`, `--expert-cache auto`, MTP on. Cold prompts of 20K, 32K and 69K tokens. Startup says `layer-major prefill is on`, then every long prompt logs `layer-major off for this prompt: no VRAM for a super-chunk (309-354 MiB free)`. I tried three ways to make room, each one with fresh starts: 1. **Default:** CUDA1 starts with 381 MiB free and the walk declines. 2. **`STRATA_STAGE_TRIM=1` with an explicit split 23:** every card drops the other stage's dense weights, so 25% more experts fit in VRAM (7618 -> 9557). But `--expert-cache auto` takes all of it, CUDA1 is still at about 380 MiB, and the walk still declines. 3. **`STRATA_PREFILL_LM_MARGIN_MIB=96` plus `--vram-reserve-later-mib 1100`:** CUDA1 now starts with 781 MiB free and the LOW warning is gone, but the walk still declines at 311-353 MiB. The line doesn't name the card; since CUDA1 had 781 MiB, I read it as CUDA0, which stays at about 400 MiB. That part is my reading, not something the log says. So on a 16 GB pair with the expert cache on `auto`, neither card has room for a super-chunk unless VRAM comes out of the experts on both. For reference, the chunk-major path here reads 20K at 1768, 32K at 2039 and 69K at 2302 tok/s. **Not run:** a bigger `--vram-reserve-mib` on CUDA0 as well. Without it the walk never ran on this pair, so I have no speed number for the walk itself. If you want it, I can run that arm. I did this with an AI coding assistant: it wrote the scripts and helped me read the engine code. I ran everything on my machine and checked the numbers.
Author
Owner

@coryjett commented on GitHub (Oct 28, 2026):

Same picture on 2x RTX 3090 (24 GB each, PCIe 3.0 x16, one per socket) with the official 0.2.7 release (engine 0.1.52), Flash-Next IQ3_S, layer_split 25 with --trim-stage-weights, --expert-cache auto (~78% of the experts resident across the two cards), MTP on, --vram-reserve-mib 1400: every one of 71 starts prints that layer-major "is on for this layer split", and every long prompt then declines it, e.g. strata prefill: layer-major off for this prompt: no VRAM for a super-chunk (1120 MiB free) (998-1,122 MiB free across our logs). The expert cache fills the cards, so the super-chunk buffer never finds room; the decline line prints the free MiB but not what it needed. With STRATA_PREFILL_HELP=1 it declines for every prompt with a different reason, "a peer GPU". A 32K benchmark prompt would not trigger it anyway (32,650 tokens is below the 2 x chunk minimum at --prefill 16384); only our ~66K cold reads qualify, and those all declined. We'll try a larger --vram-reserve-mib / smaller STRATA_PREFILL_LM_MARGIN_MIB on a 66K read and report. Logs are in #4468 (bench/results/2026-10-28-community-t630-2x3090-pcie3/raw/).

<!-- gh-comment-id:6472753463 --> @coryjett commented on GitHub (Oct 28, 2026): Same picture on 2x RTX 3090 (24 GB each, PCIe 3.0 x16, one per socket) with the official 0.2.7 release (engine 0.1.52), Flash-Next IQ3_S, `layer_split` 25 with `--trim-stage-weights`, `--expert-cache auto` (~78% of the experts resident across the two cards), MTP on, `--vram-reserve-mib 1400`: every one of 71 starts prints that layer-major "is on for this layer split", and every long prompt then declines it, e.g. `strata prefill: layer-major off for this prompt: no VRAM for a super-chunk (1120 MiB free)` (998-1,122 MiB free across our logs). The expert cache fills the cards, so the super-chunk buffer never finds room; the decline line prints the free MiB but not what it needed. With `STRATA_PREFILL_HELP=1` it declines for every prompt with a different reason, "a peer GPU". A 32K benchmark prompt would not trigger it anyway (32,650 tokens is below the 2 x chunk minimum at `--prefill 16384`); only our ~66K cold reads qualify, and those all declined. We'll try a larger `--vram-reserve-mib` / smaller `STRATA_PREFILL_LM_MARGIN_MIB` on a 66K read and report. Logs are in #4468 (`bench/results/2026-10-28-community-t630-2x3090-pcie3/raw/`).
Author
Owner

@udqe commented on GitHub (Oct 28, 2026):

Two things from our 2x 4090 that may close both reports.

Your reading is right, and here is where the number comes from. Each stage evaluates the walk on its own GPU (prefill.cpp ~5944: "a layer split's later stage is sized on its own GPU"), and a later-stage decline prints its layer range with its own free - our own log:

strata prefill: layer-major off for this prompt: layers 22..48: no VRAM for a super-chunk (734 MiB free)

while the primary's decline prints no range, so your 311-353 is CUDA0's evaluator (agreed with @coryjett: the line should name the card and print the needed bytes too).

The decline has a quantitative floor. With chunk 8192 the walk's smallest super-chunk is 2 chunks = 16,384 tokens, whose device side needs ~0.9-1.1 GiB even in host-rows mode (room = free - margin, prefill.cpp ~5999/~6016-6036). Our box matches the decline side exactly: declines at CUDA1 free 734/634 (room 638/538, below the floor). On your pair CUDA0 at ~400 simply cannot host the minimum, so the arm you did not run (--vram-reserve-mib on CUDA0) plus margin 96 gets there. Or - STRATA_PREFILL_LM_TOKENS: the source says an explicit value may drop the super-chunk to ONE chunk (~5998-5999), halving the floor to ~0.5 GiB, which your arm-3 figure of CUDA1 at 781 already clears.

Correction (2026-10-29). We previously wrote here that our box "engaged at CUDA0 ~1220" and that the 3,239.7 tok/s cold read was an engaged run - that was wrong, and the follow-up comment has the full audit. Not one engage line appears anywhere in our log before this morning's reserve change (47 engine starts): with margin 96 CUDA0 passed but the stage-1 decline (the 734 line above) forced every prompt back to chunk-major, so the 3,239.7 was a chunk-major figure. What finally engaged the walk was --vram-reserve-later-mib 972 -> 1500 - the per-card reserve, not the global margin; Gen3/Gen4 A/B in the next comment.

@coryjett: with --prefill 16384 that floor doubles (~2 GiB), which is why 1,120 MiB still declines - STRATA_PREFILL_LM_TOKENS=16384 (floor ~0.9 GiB, under your room at margin 96) or --prefill 8192 would be the deciding arm. Your STRATA_PREFILL_HELP=1 decline ("a peer GPU") is a different rule entirely: peer-prefill and helper configurations are ineligible (~5950).

(AI-assisted static analysis on our side too, cross-checked against our own logs - Qwen3.8-Flash-Next UD-Q4_K_XL served by this repo's engine 0.1.52; numbers measured locally.)

<!-- gh-comment-id:6473012700 --> @udqe commented on GitHub (Oct 28, 2026): Two things from our 2x 4090 that may close both reports. **Your reading is right, and here is where the number comes from.** Each stage evaluates the walk **on its own GPU** (prefill.cpp ~5944: "a layer split's later stage is sized on its own GPU"), and a later-stage decline prints its layer range with its own free - our own log: ``` strata prefill: layer-major off for this prompt: layers 22..48: no VRAM for a super-chunk (734 MiB free) ``` while the primary's decline prints no range, so your 311-353 is CUDA0's evaluator (agreed with @coryjett: the line should name the card and print the needed bytes too). **The decline has a quantitative floor.** With chunk 8192 the walk's smallest super-chunk is 2 chunks = 16,384 tokens, whose device side needs ~0.9-1.1 GiB even in host-rows mode (`room = free - margin`, prefill.cpp ~5999/~6016-6036). Our box matches the decline side exactly: declines at CUDA1 free 734/634 (room 638/538, below the floor). On your pair CUDA0 at ~400 simply cannot host the minimum, so the arm you did not run (`--vram-reserve-mib` on CUDA0) plus margin 96 gets there. **Or** - `STRATA_PREFILL_LM_TOKENS`: the source says an explicit value may drop the super-chunk to ONE chunk (~5998-5999), halving the floor to ~0.5 GiB, which your arm-3 figure of CUDA1 at 781 already clears. **Correction (2026-10-29).** We previously wrote here that our box "engaged at CUDA0 ~1220" and that the 3,239.7 tok/s cold read was an engaged run - that was wrong, and the follow-up comment has the full audit. Not one engage line appears anywhere in our log **before this morning's reserve change** (47 engine starts): with margin 96 CUDA0 passed but the stage-1 decline (the 734 line above) forced every prompt back to chunk-major, so the 3,239.7 was a chunk-major figure. What finally engaged the walk was `--vram-reserve-later-mib 972 -> 1500` - the per-card reserve, not the global margin; Gen3/Gen4 A/B in the next comment. @coryjett: with `--prefill 16384` that floor doubles (~2 GiB), which is why 1,120 MiB still declines - `STRATA_PREFILL_LM_TOKENS=16384` (floor ~0.9 GiB, under your room at margin 96) or `--prefill 8192` would be the deciding arm. Your `STRATA_PREFILL_HELP=1` decline ("a peer GPU") is a different rule entirely: peer-prefill and helper configurations are ineligible (~5950). (AI-assisted static analysis on our side too, cross-checked against our own logs - Qwen3.8-Flash-Next UD-Q4_K_XL served by this repo's engine 0.1.52; numbers measured locally.)
Author
Owner

@coryjett commented on GitHub (Oct 28, 2026):

@udqe thanks, the floor arithmetic was right. With --prefill 8192 and STRATA_PREFILL_LM_MARGIN_MIB=96 the walk engages on our pair:

strata prefill: layer-major (layers 25..48): 16384 tokens in 1 super-chunk(s) of up to 16384 (R in pinned RAM, 1005 MiB VRAM free before)
strata prefill: layer-major (layers 0..25): 32691 tokens in 2 super-chunk(s) of up to 16384 (R in pinned RAM, 1030 MiB VRAM free before)

At the default margin (512) the same prompts still decline at 1,034-1,122 MiB free, as you computed.

Engaged, it halves prompt reading here. Same server, same hour, 2 runs each (2x RTX 3090 on PCIe 3.0 x16, one per socket, 0.2.7 / engine 0.1.52, IQ3_S, split 25 with --trim-stage-weights, ~78% of the experts resident, --prefill 8192, STRATA_SPLIT_RING=384, STRATA_SPLIT_MTP_BATCH=1):

32K prompt read cold ~66K read decode after the read
chunk-major (default walk declined) 2,764-2,778 tok/s 22.7-23.0 s (2,870-2,910 tok/s) 107-111 tok/s
layer-major engaged (margin 96) 1,335 tok/s 44.7 s (1,478 tok/s) 108 tok/s

So on a PCIe 3.0 pair the walk costs rather than pays: the later stage keeps its rows in host memory and moves them over the link per layer, which is twice as expensive here as on the PCIe 4.0 pairs it was measured on. Your 2x and the 5x on the A4000s are not in doubt; the rule just needs the link in it before it engages by default. Raw files (engine logs with the walk lines, per-run outputs) are in our benchmark log (section 30); I can attach the two engine logs here if useful.

<!-- gh-comment-id:6480031754 --> @coryjett commented on GitHub (Oct 28, 2026): @udqe thanks, the floor arithmetic was right. With `--prefill 8192` and `STRATA_PREFILL_LM_MARGIN_MIB=96` the walk engages on our pair: ``` strata prefill: layer-major (layers 25..48): 16384 tokens in 1 super-chunk(s) of up to 16384 (R in pinned RAM, 1005 MiB VRAM free before) strata prefill: layer-major (layers 0..25): 32691 tokens in 2 super-chunk(s) of up to 16384 (R in pinned RAM, 1030 MiB VRAM free before) ``` At the default margin (512) the same prompts still decline at 1,034-1,122 MiB free, as you computed. Engaged, it halves prompt reading here. Same server, same hour, 2 runs each (2x RTX 3090 on PCIe 3.0 x16, one per socket, 0.2.7 / engine 0.1.52, IQ3_S, split 25 with `--trim-stage-weights`, ~78% of the experts resident, `--prefill 8192`, `STRATA_SPLIT_RING=384`, `STRATA_SPLIT_MTP_BATCH=1`): | | 32K prompt read | cold ~66K read | decode after the read | |---|---|---|---| | chunk-major (default walk declined) | 2,764-2,778 tok/s | 22.7-23.0 s (2,870-2,910 tok/s) | 107-111 tok/s | | layer-major engaged (margin 96) | **1,335 tok/s** | **44.7 s (1,478 tok/s)** | 108 tok/s | So on a PCIe 3.0 pair the walk costs rather than pays: the later stage keeps its rows in host memory and moves them over the link per layer, which is twice as expensive here as on the PCIe 4.0 pairs it was measured on. Your 2x and the 5x on the A4000s are not in doubt; the rule just needs the link in it before it engages by default. Raw files (engine logs with the walk lines, per-run outputs) are in our benchmark log (section 30); I can attach the two engine logs here if useful.
Author
Owner

@udqe commented on GitHub (Oct 29, 2026):

@coryjett your run confirmed the arithmetic, and taking the hint we went one step further to make the walk engage on our box for the first time - then ran a single-variable link test. Two corrections and one table.

Correction first (our previous comment, now edited): our 2x 4090 had not one engage line before this morning - CUDA0 passed at margin 96 but the last stage always declined (the layers 22..48 ... (734 MiB free) line), so every prompt fell back to chunk-major and our 3,239.7 tok/s "engaged" figure was chunk-major. The evaluator is per-stage (as above); the fallback is whole-prompt.

What engaged it: --vram-reserve-later-mib 972 -> 1500 (stage-1 free 734 -> ~1260, room ~1160 >= the ~1.1 GiB floor). First engage lines in our log:

strata prefill: layer-major (layers 22..48): 32768 tokens in 1 super-chunk(s) of up to 32768 (R in pinned RAM, 1260 MiB VRAM free before), 9572 expert blobs streamed (29977.6 MB), 3593 resident ...

The lever is the later card's reserve - the same last-card gap @cobra91's #4549 (keep the draft head's room out of the last stage's cache) fixes from the inside, and one more data point for per-card reserves (#2522).

Single-variable link test - same machine (2x 4090, single-socket TRX40), same config, same salted prompts, only the BIOS slot setting changed; cold 32K/66K/150K x2 each, median prompt ... read in rate; margin 96 in all four arms, walk arms at later-reserve 1500 and chunk arms at 972 (which makes the comparison conservative against the walk):

read tok/s 32K 66K 150K
Gen4 x16 (link probe 26.4) chunk-major 2,597 3,083 3,369
Gen4 x16 layer-major 2,428 (-6.5%) 3,391 (+10.0%) 3,913 (+16.1%)
Gen3 x16 (probe 13.2) chunk-major 2,019 2,411 2,695
Gen3 x16 layer-major 1,654 (-18.1%) 2,271 (-5.8%) 2,653 (-1.6%)

Decode held 120-150 tok/s in all four arms - the link cost is prefill-only, as you saw.

What this adds to your rule proposal: on a single-socket pair the walk degrades with the link but barely flips sign (-1.6% at 150K on Gen3); on your dual-Xeon pair (one card per socket) it collapses (-49%) - so beyond "the link must be in the rule" the route the R_host rows take matters, and a measured per-card gate is the right shape. The engine already probes each card's link at startup (26.4 vs 13.2 - it distinguishes the generations), though we saw the probe read ~4x low (6.7) twice when it caught the link at its idle Gen1 negotiation, so a gate would want a re-probe or a floor, not a single sample. (Edit: the Gen1 label was wrong and the trigger is now pinned - the misread fires on the FIRST start shortly after resume-from-sleep, always the display-attached card, always exactly half the true value: #4610 #issuecomment-6532493954. The floor/re-probe advice stands, strengthened.) A cheaper variant: run one super-chunk both ways at startup and pick the winner - the check is one prompt.

(AI-assisted again on our side - the model served by this repo's engine 0.1.52 ran the measurements and the log audit; all figures local.)

<!-- gh-comment-id:6484683205 --> @udqe commented on GitHub (Oct 29, 2026): @coryjett your run confirmed the arithmetic, and taking the hint we went one step further to make the walk engage **on our box for the first time** - then ran a single-variable link test. Two corrections and one table. **Correction first** (our previous comment, now edited): our 2x 4090 had **not one engage line before this morning** - CUDA0 passed at margin 96 but the last stage always declined (the `layers 22..48 ... (734 MiB free)` line), so every prompt fell back to chunk-major and our 3,239.7 tok/s "engaged" figure was chunk-major. The evaluator is per-stage (as above); the fallback is whole-prompt. **What engaged it:** `--vram-reserve-later-mib 972 -> 1500` (stage-1 free 734 -> ~1260, room ~1160 >= the ~1.1 GiB floor). First engage lines in our log: ``` strata prefill: layer-major (layers 22..48): 32768 tokens in 1 super-chunk(s) of up to 32768 (R in pinned RAM, 1260 MiB VRAM free before), 9572 expert blobs streamed (29977.6 MB), 3593 resident ... ``` The lever is the **later card's** reserve - the same last-card gap @cobra91's #4549 (keep the draft head's room out of the last stage's cache) fixes from the inside, and one more data point for per-card reserves (#2522). **Single-variable link test** - same machine (2x 4090, single-socket TRX40), same config, same salted prompts, only the BIOS slot setting changed; cold 32K/66K/150K x2 each, median `prompt ... read in` rate; margin 96 in all four arms, walk arms at later-reserve 1500 and chunk arms at 972 (which makes the comparison conservative against the walk): | read tok/s | 32K | 66K | 150K | |---|---|---|---| | Gen4 x16 (link probe 26.4) chunk-major | 2,597 | 3,083 | 3,369 | | Gen4 x16 layer-major | 2,428 (-6.5%) | 3,391 (+10.0%) | **3,913 (+16.1%)** | | Gen3 x16 (probe 13.2) chunk-major | 2,019 | 2,411 | 2,695 | | Gen3 x16 layer-major | 1,654 (-18.1%) | 2,271 (-5.8%) | 2,653 (-1.6%) | Decode held 120-150 tok/s in all four arms - the link cost is prefill-only, as you saw. **What this adds to your rule proposal:** on a single-socket pair the walk degrades with the link but barely flips sign (-1.6% at 150K on Gen3); on your dual-Xeon pair (one card per socket) it collapses (-49%) - so beyond "the link must be in the rule" the **route the R_host rows take** matters, and a measured per-card gate is the right shape. The engine already probes each card's link at startup (26.4 vs 13.2 - it distinguishes the generations), though we saw the probe read ~4x low (6.7) twice when it caught the link at its idle Gen1 negotiation, so a gate would want a re-probe or a floor, not a single sample. (Edit: the Gen1 label was wrong and the trigger is now pinned - the misread fires on the FIRST start shortly after resume-from-sleep, always the display-attached card, always exactly half the true value: #4610 #issuecomment-6532493954. The floor/re-probe advice stands, strengthened.) A cheaper variant: run one super-chunk both ways at startup and pick the winner - the check is one prompt. (AI-assisted again on our side - the model served by this repo's engine 0.1.52 ran the measurements and the log audit; all figures local.)
Author
Owner

@coryjett commented on GitHub (Oct 29, 2026):

@udqe the route was a good guess, and it's part of the answer. We ran it on our pair this morning (2x RTX 3090 on PCIe 3.0 x16, card 0 on node 0, card 1 on node 1, dual E5-2620 v3, 0.2.7 / engine 0.1.52, IQ3_S, split 25 with trim, --prefill 8192, layer-major engaged at margin 96).

Pinned copy bandwidth per card and node (256 MiB, cudaMemcpyAsync x10):

Memory on Card 0 up / down Card 1 up / down
node 0 10.1 / 10.3 GB/s 4.8 / 3.5
node 1 4.4 / 3.4 9.9 / 10.3
interleaved 7.4 / 4.6 7.6 / 3.0

We run under numactl --interleave=all, and the arena and R_host are plain pinned allocations, so they follow it (the engine says as much: "memory is not placed per node (known limitation)"). Switching the whole process to one node, 2 runs each, per-stage times from the walk lines:

Layer-major interleaved all on node 1 all on node 0
later stage (card 1), each 16K super-chunk 7.6-7.9 s 5.2-5.8 s (local) 10.6-11.9 s (remote)
first stage (card 0), 32K / 66K 15.2 / 39.9 s 21.7 / 50.8 s (remote) 17.0 / 51.4 s (local)
32K read overall 1,353-1,403 tok/s 1,120-1,157 1,082-1,091
  • The later stage moves ±40% with placement, almost all of it in "waiting for the attention halves" (6.8 s interleaved, 4.0 s local per super-chunk): the rows to and from R_host each layer.
  • Card 0 did not get faster with everything on node 0; its "enqueueing the attention halves" grew instead (1.8 to 7.2 s at 32K). Our reading is that both cards' copies plus the CPU pool saturate node 0's four channels, so a whole-process policy can't produce a clean "card 0 local" arm. What this points to is per-stage placement: each stage's arena share and R_host on its card's node.
  • Even the best layer-major arm stays ~2x behind chunk-major here (2,774-2,941 tok/s at 32K, interleaved). So placement explains part of our -49%, not all of it.
  • Chunk-major is only mildly sensitive: interleaved is the best whole-process policy (-7% at 32K with everything on node 1, -14% on node 0). Decode was unchanged in every arm.

So for the gate: a per-card measured probe would catch the cross-socket cost as well as the link generation, provided the probe's buffer sits where the stage's memory will sit. Raw logs and the copy test are in our benchmark log (section 32).

<!-- gh-comment-id:6491805241 --> @coryjett commented on GitHub (Oct 29, 2026): @udqe the route was a good guess, and it's part of the answer. We ran it on our pair this morning (2x RTX 3090 on PCIe 3.0 x16, card 0 on node 0, card 1 on node 1, dual E5-2620 v3, 0.2.7 / engine 0.1.52, IQ3_S, split 25 with trim, `--prefill 8192`, layer-major engaged at margin 96). Pinned copy bandwidth per card and node (256 MiB, cudaMemcpyAsync x10): | Memory on | Card 0 up / down | Card 1 up / down | |---|---|---| | node 0 | 10.1 / 10.3 GB/s | 4.8 / 3.5 | | node 1 | 4.4 / 3.4 | 9.9 / 10.3 | | interleaved | 7.4 / 4.6 | 7.6 / 3.0 | We run under `numactl --interleave=all`, and the arena and `R_host` are plain pinned allocations, so they follow it (the engine says as much: "memory is not placed per node (known limitation)"). Switching the whole process to one node, 2 runs each, per-stage times from the walk lines: | Layer-major | interleaved | all on node 1 | all on node 0 | |---|---|---|---| | later stage (card 1), each 16K super-chunk | 7.6-7.9 s | **5.2-5.8 s** (local) | 10.6-11.9 s (remote) | | first stage (card 0), 32K / 66K | 15.2 / 39.9 s | 21.7 / 50.8 s (remote) | 17.0 / 51.4 s (local) | | 32K read overall | 1,353-1,403 tok/s | 1,120-1,157 | 1,082-1,091 | - The later stage moves ±40% with placement, almost all of it in "waiting for the attention halves" (6.8 s interleaved, 4.0 s local per super-chunk): the rows to and from `R_host` each layer. - Card 0 did not get faster with everything on node 0; its "enqueueing the attention halves" grew instead (1.8 to 7.2 s at 32K). Our reading is that both cards' copies plus the CPU pool saturate node 0's four channels, so a whole-process policy can't produce a clean "card 0 local" arm. What this points to is per-stage placement: each stage's arena share and `R_host` on its card's node. - Even the best layer-major arm stays ~2x behind chunk-major here (2,774-2,941 tok/s at 32K, interleaved). So placement explains part of our -49%, not all of it. - Chunk-major is only mildly sensitive: interleaved is the best whole-process policy (-7% at 32K with everything on node 1, -14% on node 0). Decode was unchanged in every arm. So for the gate: a per-card measured probe would catch the cross-socket cost as well as the link generation, provided the probe's buffer sits where the stage's memory will sit. Raw logs and the copy test are in our benchmark log (section 32).
Author
Owner

@cobra91 commented on GitHub (Oct 29, 2026):

A data point from a single-socket pair (different from the dual-Xeon above): RTX 5080 + RTX 4060 Ti, both 16 GB, the Ti in a chipset slot, Ryzen 7 9800X3D, 32 GB RAM, Windows 11, engine 0.1.53 built from main at 46c152a1, IQ2_XS, 64K context, q4_0 KV, --prefill 8192.

On this rig the layer-major walk also falls back, but the blocker is free VRAM on the later card, not memory placement. Three configurations, same 49,361-token prompt, engine-log rates:

config last card free prefill tok/s
stock main (auto split) 408 MiB 228
+ per-card weight trim (#4522) 420 MiB 1,181
+ trim + --vram-reserve-later-mib 1500 437 MiB 932

The trim frees 2.86 GiB of dense weights and the expert caches grow from ~6,800 to ~8,200 + 7,500 slots, which is where the prefill gain comes from (fewer expert blobs read from the SSD). But the caches absorb the freed VRAM: the last card ends at 420 MiB free either way, and the super-chunk's R rows need ~1.1 GiB there, so the walk still declines (layer-major off for this prompt: no VRAM for a super-chunk). Raising the later reserve to 1500 did not free enough (437 MiB - other allocations eat the reserved space) and shrank the cache, which is why prefill went down.

So on a single-socket pair the engagement gate could be a VRAM budget in the cache sizing (leave the super-chunk's R rows out of the last stage's cache, the way #4549 does for the draft head) rather than a link or placement probe. We have not measured layer-major engaged on this rig, so we cannot say what it would give here.

<!-- gh-comment-id:6492332210 --> @cobra91 commented on GitHub (Oct 29, 2026): A data point from a single-socket pair (different from the dual-Xeon above): RTX 5080 + RTX 4060 Ti, both 16 GB, the Ti in a chipset slot, Ryzen 7 9800X3D, 32 GB RAM, Windows 11, engine 0.1.53 built from main at 46c152a1, IQ2_XS, 64K context, q4_0 KV, `--prefill 8192`. On this rig the layer-major walk also falls back, but the blocker is free VRAM on the later card, not memory placement. Three configurations, same 49,361-token prompt, engine-log rates: | config | last card free | prefill tok/s | |---|---|---:| | stock main (auto split) | 408 MiB | 228 | | + per-card weight trim (#4522) | 420 MiB | **1,181** | | + trim + `--vram-reserve-later-mib 1500` | 437 MiB | 932 | The trim frees 2.86 GiB of dense weights and the expert caches grow from ~6,800 to ~8,200 + 7,500 slots, which is where the prefill gain comes from (fewer expert blobs read from the SSD). But the caches absorb the freed VRAM: the last card ends at 420 MiB free either way, and the super-chunk's R rows need ~1.1 GiB there, so the walk still declines (`layer-major off for this prompt: no VRAM for a super-chunk`). Raising the later reserve to 1500 did not free enough (437 MiB - other allocations eat the reserved space) and shrank the cache, which is why prefill went down. So on a single-socket pair the engagement gate could be a VRAM budget in the cache sizing (leave the super-chunk's R rows out of the last stage's cache, the way #4549 does for the draft head) rather than a link or placement probe. We have not measured layer-major engaged on this rig, so we cannot say what it would give here.
Author
Owner

@udqe commented on GitHub (Oct 29, 2026):

@coryjett @cobra91 a data point from the single-socket arm of this picture: 2x RTX 4090, TR3970X single socket, 128 GiB, UD-Q4_K_XL, engine 0.1.52, full matrix in #4573. Your decomposition matches ours from the other side:

  • With NUMA out of the picture the walk tracks chunk almost exactly when the link halves: Gen3 walk@150K 2,673 vs chunk 2,720 tok/s (-1.7%); the same walk at Gen4 is 3,913 vs 3,369 (+16.1%, engaged with 1,260 MiB free on the later card). So on our pair the super-chunk cost is basically link-bandwidth-shaped and placement costs nothing, while yours adds a cross-socket R_host tax on top. A single-socket rig cannot tell you whether that tax is per-hop or per-transaction; your copy matrix (local ~10 vs remote 4.4-4.8 GB/s) says the hop roughly halves it, and the walk's "waiting for the attention halves" phrase is exactly the per-layer rows you measured.
  • On the gate: agreed with both of you, and our history adds one wrinkle - our startup probe read 6.7 GB/s twice on a machine whose steady pinned copy is 26.4 (single socket, so not placement). If a gate is to trust a probe, it needs a floor or a re-probe at first super-chunk anyway; a per-card probe with the buffer where the stage memory sits still passes that bar, it just does not fix the post-sleep misread (later pinned: first start after resume, display-attached card, half-value fingerprint - #4610 #issuecomment-6532493954).
  • cobra91's numbers are the lever that actually changed our view: on our rig the whole engagement moved on +288 MiB of later-card free (later reserve 972 to 1500), while your trim freed 2.86 GiB and multiplied prefill 5x - on small-card rigs the cache-sizing budget (leave R out of the last stage's cache) will engage far more rigs than any reserve tuning. Our production stays reserve 972 + chunk for now since the walk only wins at 66K+ here.

The one honest outlier left on the board: your best walk arm is still ~2x behind chunk even on the local placement. One suspect we can now rule out is generic memory-side saturation: we starved our rig's memory side (4 pinned-copy workers, about 32 GB/s sustained against the engine, engine otherwise untouched) and chunk@150K fell 24.0% while walk fell only 17.7% - walk still beat chunk under contention, 3,099 vs 2,564 tok/s. So the residual is not "walk is DRAM-hungry". What is left points at the attention-row feed rate itself: our Gen4 walk hides the per-layer rows inside 3.0 s of "waiting for the attention halves" per 24,576-token super-chunk at 26 GB/s pinned copy, while your card feeds at 10.1 local and 4.4 remote - the same wait term turned into wall time by the card's own copy rate rather than by DRAM. That also predicts your residual would shrink with Gen-class copies on the same dual-socket board, if you ever get a second rig to check it on.

<!-- gh-comment-id:6495985378 --> @udqe commented on GitHub (Oct 29, 2026): @coryjett @cobra91 a data point from the single-socket arm of this picture: 2x RTX 4090, TR3970X single socket, 128 GiB, UD-Q4_K_XL, engine 0.1.52, full matrix in [#4573](https://github.com/Niko1221/Strata/issues/4573). Your decomposition matches ours from the other side: - With NUMA out of the picture the walk tracks chunk almost exactly when the link halves: Gen3 walk@150K 2,673 vs chunk 2,720 tok/s (-1.7%); the same walk at Gen4 is 3,913 vs 3,369 (+16.1%, engaged with 1,260 MiB free on the later card). So on our pair the super-chunk cost is basically link-bandwidth-shaped and placement costs nothing, while yours adds a cross-socket R_host tax on top. A single-socket rig cannot tell you whether that tax is per-hop or per-transaction; your copy matrix (local ~10 vs remote 4.4-4.8 GB/s) says the hop roughly halves it, and the walk's "waiting for the attention halves" phrase is exactly the per-layer rows you measured. - On the gate: agreed with both of you, and our history adds one wrinkle - our startup probe read 6.7 GB/s twice on a machine whose steady pinned copy is 26.4 (single socket, so not placement). If a gate is to trust a probe, it needs a floor or a re-probe at first super-chunk anyway; a per-card probe with the buffer where the stage memory sits still passes that bar, it just does not fix the post-sleep misread (later pinned: first start after resume, display-attached card, half-value fingerprint - #4610 #issuecomment-6532493954). - cobra91's numbers are the lever that actually changed our view: on our rig the whole engagement moved on +288 MiB of later-card free (later reserve 972 to 1500), while your trim freed 2.86 GiB and multiplied prefill 5x - on small-card rigs the cache-sizing budget (leave R out of the last stage's cache) will engage far more rigs than any reserve tuning. Our production stays reserve 972 + chunk for now since the walk only wins at 66K+ here. The one honest outlier left on the board: your best walk arm is still ~2x behind chunk even on the local placement. One suspect we can now rule out is generic memory-side saturation: we starved our rig's memory side (4 pinned-copy workers, about 32 GB/s sustained against the engine, engine otherwise untouched) and chunk@150K fell 24.0% while walk fell only 17.7% - walk still beat chunk under contention, 3,099 vs 2,564 tok/s. So the residual is not "walk is DRAM-hungry". What is left points at the attention-row feed rate itself: our Gen4 walk hides the per-layer rows inside 3.0 s of "waiting for the attention halves" per 24,576-token super-chunk at 26 GB/s pinned copy, while your card feeds at 10.1 local and 4.4 remote - the same wait term turned into wall time by the card's own copy rate rather than by DRAM. That also predicts your residual would shrink with Gen-class copies on the same dual-socket board, if you ever get a second rig to check it on.
Author
Owner

@fioruccione commented on GitHub (Oct 29, 2026):

@udqe thanks for the source reading, that settles the 311-353 MiB line as CUDA0.

One data point for the gate, with no new runs: on this pair the cards are PCIe 4.0 but x8 (the RTX 4060 Ti is x8 by design), and the engine measures them like your Gen3 x16 slot. Every one of 28 starts on v0.2.7.1 logs layer split auto: CUDA0 link 13.3 GB/s and CUDA1 link 13.3 GB/s, and the PCIe probe gives 13.3 GB/s best of four (11.6-13.3). None of the 28 read low, so I didn't see the idle-link reading you got.

So a gate based on the PCIe generation would put these cards on the Gen4 side, while by your Gen3 x16 numbers the walk would lose or break even here. A gate on the measured link, which the engine already has at startup, would treat them correctly. For that reason I'm not going to run the extra CUDA0 reserve arm: on this pair it would take VRAM from the experts for a walk that, by your table, wouldn't pay.

I did this with an AI coding assistant: it read the logs and the thread and drafted this text. I checked the numbers.

<!-- gh-comment-id:6497809701 --> @fioruccione commented on GitHub (Oct 29, 2026): @udqe thanks for the source reading, that settles the 311-353 MiB line as CUDA0. One data point for the gate, with no new runs: on this pair the cards are PCIe 4.0 but x8 (the RTX 4060 Ti is x8 by design), and the engine measures them like your Gen3 x16 slot. Every one of 28 starts on v0.2.7.1 logs `layer split auto: CUDA0 link 13.3 GB/s` and `CUDA1 link 13.3 GB/s`, and the PCIe probe gives 13.3 GB/s best of four (11.6-13.3). None of the 28 read low, so I didn't see the idle-link reading you got. So a gate based on the PCIe generation would put these cards on the Gen4 side, while by your Gen3 x16 numbers the walk would lose or break even here. A gate on the measured link, which the engine already has at startup, would treat them correctly. For that reason I'm not going to run the extra CUDA0 reserve arm: on this pair it would take VRAM from the experts for a walk that, by your table, wouldn't pay. I did this with an AI coding assistant: it read the logs and the thread and drafted this text. I checked the numbers.
Author
Owner

@agurrrrr commented on GitHub (Oct 29, 2026):

Note

AI-assisted — an agent drafted this text from our own engine logs and from this thread. Every number below was measured on this machine and each one is quoted from an engine log line in the Evidence section. Nothing here is copied or modelled.

V100×2 field data: the walk engages on every long prompt and still loses

@Niko1221 asked 0.2.7 testers to try their own cards. Here is our pair. This is a third shape on the board, different from @coryjett's dual Xeon (NUMA placement) and from @cobra91's last-card VRAM block: on this box the walk engages for every long prompt at stock settings, and it is slower than chunk-major. No gate tuning was needed to make it run. It runs and costs time.

Problem

On 2× Tesla V100-SXM2-16GB (sm_70) in a CUDA layer split, the 0.2.7 default (layer-major prefill on) reads a cold prompt 26 % slower at ~9K tokens and 10 % slower at ~37K tokens than the same engine binary with STRATA_PREFILL_LAYER_MAJOR=0. One variable changed, same day.

Environment

item value
Strata v0.2.7.1 (46c152a1) + 5 local commits; strata --version → strata 0.1.53
engine identity the prefill path we measured is upstream's own code: git diff --name-only v0.2.7.1..HEAD touches nothing under src/prefill, include/strata/prefill or src/kernels (only serve/server.py, slot logic in src/program/generate.cpp, a STRATA_HIP_GFX906 guard in src/core/dflash2.cpp, apps and docs)
OS CachyOS (Arch), kernel 7.2.8-1-cachyos
CPU / RAM AMD EPYC 7452, 32 cores, one NUMA node · 125 GB DDR4
cards 2× Tesla V100-SXM2-16GB (sm_70), driver 580.178.04, built against CUDA 12.8, both PCIe Gen3 x16 (nvidia-smi)
model Qwen3.8-Flash-Next GSQ-RCO IQ3_S native pack + PLE gguf, MTP drafter
settings --layer-split 23 (CUDA0 layers 0–22, CUDA1 23–47) · --expert-cache auto · --prefill 2048 · --spec 4 --spec-min-p 0.5 · --kv int8 --kv-resident 32768 · --max-context 262144 · --vram-reserve-mib 1200 · --pool-workers 27 · --pcie-frac 0.1 · --shared-expert-arena /dev/shm/strata-iq3_s.arena · STRATA_SM70_TABLE=1 · STRATA_STAGE_TRIM=1
expert residency the VRAM caches hold nearly all of the routed mass. On an auto-split start on this box: layer split auto: K=23 … the caches hold 9351 of 24576 profiled pairs (~97.1 % of the routed mass). At the measured explicit split: CUDA0 expert cache 5327 slots, 9.57 GiB, CUDA1 expert cache 4448 slots (8.89 GiB), and the decode hit rate in production sits at 87–93 %.
role one of two production instances on this box; the other is a Radeon MI50 on the HIP build, so not affected (prefill.cpp treats STRATA_HIP_GFX906 as HIP)

Reproduce

  1. Start with the settings above and STRATA_PREFILL_LAYER_MAJOR unset. Startup prints layer-major prefill is on for this layer split.
  2. Send a fresh prompt built from random salt, so nothing can be reused (max_tokens 16, temperature 0). One pass sends one ~9K-token and one ~37K-token system prompt.
  3. Restart with STRATA_PREFILL_LAYER_MAJOR=0 in the engine environment and send the same two sizes again.
  4. Read the engine's own strata serve: prompt … read in … (… tok/s) line for each request.

We dropped any pass that overlapped live router traffic. The image-prompt decline is real and separate: layer-major off for this prompt: an image prompt.

Actual (engine log lines, both arms)

on = the 0.2.7 default, off = STRATA_PREFILL_LAYER_MAJOR=0:

prompt on (default) off turning it off gives back
~9K tokens 611.2 tok/s (9,067 tok), 727.8 tok/s (9,242 tok) 858.0 tok/s (9,067 tok), 825.3 tok/s (8,892 tok) +26 % (mean 670 → 842)
~37K tokens 835.5 tok/s (37,067 tok), 848.6 tok/s (37,067 tok) 925.9 tok/s (37,067 tok), 924.0 tok/s (35,667 tok) +10 % (mean 842 → 925)

Raw lines for the ~9K pair:

on : strata serve: prompt 9067  tokens = 0 reused + 9067  read in 14835 ms (611.2 tok/s), 16 generated in 194 ms (82.4 tok/s), drafts accepted 12 of 15, 2 checkpoints
on : strata serve: prompt 9242  tokens = 0 reused + 9242  read in 12698 ms (727.8 tok/s), 16 generated in 179 ms (89.3 tok/s), drafts accepted 12 of 15, 2 checkpoints
off: strata serve: prompt 9067  tokens = 0 reused + 9067  read in 10568 ms (858.0 tok/s), 16 generated in 238 ms (67.3 tok/s), drafts accepted 14 of 17, 2 checkpoints
off: strata serve: prompt 8892  tokens = 0 reused + 8892  read in 10775 ms (825.3 tok/s), 16 generated in 182 ms (88.1 tok/s), drafts accepted 12 of 15, 2 checkpoints

Raw lines for the ~37K pair:

on : strata serve: prompt 37067 tokens = 0 reused + 37067 read in 44364 ms (835.5 tok/s), 16 generated in 203 ms (78.7 tok/s), drafts accepted 12 of 15, 4 checkpoints
on : strata serve: prompt 37067 tokens = 0 reused + 37067 read in 43682 ms (848.6 tok/s), 16 generated in 186 ms (85.8 tok/s), drafts accepted 12 of 15, 4 checkpoints
off: strata serve: prompt 37067 tokens = 0 reused + 37067 read in 40033 ms (925.9 tok/s), 16 generated in 191 ms (83.8 tok/s), drafts accepted 12 of 15, 4 checkpoints
off: strata serve: prompt 35667 tokens = 0 reused + 35667 read in 38600 ms (924.0 tok/s), 16 generated in 193 ms (83.0 tok/s), drafts accepted 12 of 15, 4 checkpoints

The two arms differ only in that one environment key. The token counts are not identical across arms on purpose — each prompt carries a fresh salt — and the rate is the engine's own per-token read rate.

Cross-check against live traffic. On the previous engine (0.1.47, chunk-major only), cold reads from token 0 in real traffic had medians of 836 tok/s at 8–16K (127 requests) and 923 tok/s at 32–64K (238 requests). The off arm lands on those same numbers, so the off arm is not a lucky run and the box has not drifted.

Why the walk engages here, and where it loses time

Engagement is not the problem on this rig. With --prefill 2048 the super-chunks fit at the default margin on both stages, with 829–882 MiB free:

strata prefill: layer-major (layers 0..23): 9044 tokens in 1 super-chunk(s) of up to 10240 (R in pinned RAM, 859 MiB VRAM free before), 6268 expert blobs streamed (12168.0 MB), 3629 resident, 629 expert groups (0 on the FP16 path); 5744 ms (host: enqueueing the attention halves 591, the experts 5038: waiting for the attention halves 4951, the routing tables 20)
strata prefill: layer-major (layers 23..48): 9044 tokens in 1 super-chunk(s) of up to 10240 (R in pinned RAM, 882 MiB VRAM free before), 8529 expert blobs streamed (18313.7 MB), 3192 resident, 744 expert groups (0 on the FP16 path); 8156 ms (host: enqueueing the attention halves 985, the experts 7171: waiting for the attention halves 7064, the routing tables 22)

Pairing those stage lines with their prompt line gives the PCIe bill directly:

prompt expert blobs streamed across both stages read wall time implied stream rate
9,067 tok (on) 29.8 GB (12168.0 + 18313.7 MB) 14.8 s 2.0 GB/s
37,067 tok (on) 139.4 GB (CUDA0 54,838 MB over 3 super-chunks + CUDA1 87,883 MB over 5) 44.4 s 3.1 GB/s

The walk's own timing puts almost all of that wall time in waiting for the attention halves. On the chunk path the same box moves almost no expert bytes at all: the caches hold ~97 % of the routed mass and the KV stream hits VRAM at 99 %+ (KV streaming: 99.83 % of 753540 block reads hit VRAM, 5.3 MiB read from RAM).

Our reading, flagged as unconfirmed static analysis: this box has little expert traffic left for the walk to save. Chunk-major reads cached experts and barely touches PCIe; layer-major sends each layer's expert blobs once per super-chunk instead, so with ~97 % residency the walk can only add a PCIe cost. Upstream's win was measured with experts mostly streamed from RAM (2× RTX A4000, 16 GB each), where the re-read saving is large. That fits @udqe's link-shaped picture from the other side — our cost looks like those 30–139 GB divided by a Gen3 x16 link. We did not profile it, so the cause is a hypothesis, not an observed fault in the walk.

Two points for the gate

@fioruccione, @cobra91 and @coryjett are right that a measured per-card gate is the right shape. Our data adds two things:

  1. A link or placement gate would not predict the sign on this box. The walk engages cleanly, sits on a single NUMA node, and still loses 10–26 %. What separates our rig from @udqe's Gen4 4090 pair (+16 % at 150K) is not the link alone — it is that the experts are already resident. A gate that also reads what the cache sizing decided (share of the routed mass resident) may predict "do not walk" on high-residency rigs even when the link looks fast. That number is already in the planner's own output: the caches hold 9351 of 24576 profiled pairs (~97.1 % of the routed mass).
  2. The link probe does not run on an explicit split. Every measured start here used --layer-split 23, and none of them prints a CUDA0 link … GB/s line — those lines appear only on layer split auto starts. So a gate built on the startup link probe would have no sample to read on rigs like ours that pin the split by hand.

Validation

  • Passed: the A/B above (2 sizes × 2 arms, engine log rates quoted); strata --version → 0.1.53; git diff --name-only v0.2.7.1..HEAD shows no change under src/prefill, include/strata/prefill or src/kernels; the live-traffic cross-check on engine 0.1.47 (365 requests).
  • Failed: nothing failed. No crash, no watchdog, no decline line except the image-prompt one.
  • Not run: decode A/B (each measured request generated only 16 tokens, so we cannot say what layer-major does to decode here); quality, needle and KL A/B on V100; concurrency and --batch; STRATA_PREFILL_LM_MARGIN_MIB and --vram-reserve-later-mib tuning; prompts above ~37K in both arms (this box reads 130K cold at 905.8 tok/s on the chunk path, but we did not run that size in both arms).

What we do now

We run STRATA_PREFILL_LAYER_MAJOR=0 in the V100 instance's environment and keep the chunk path. We are not asking for a default change; we only want to change a default where a measurement supports it, so we are reporting our numbers instead. If it helps, we can run a longer A/B — decode included, and 66K/130K in both arms — on request in this thread.

<!-- gh-comment-id:6501516870 --> @agurrrrr commented on GitHub (Oct 29, 2026): > [!NOTE] > AI-assisted — an agent drafted this text from our own engine logs and from this thread. Every number below was measured on this machine and each one is quoted from an engine log line in the Evidence section. Nothing here is copied or modelled. ## V100×2 field data: the walk engages on every long prompt and still loses @Niko1221 asked 0.2.7 testers to try their own cards. Here is our pair. This is a third shape on the board, different from @coryjett's dual Xeon (NUMA placement) and from @cobra91's last-card VRAM block: **on this box the walk engages for every long prompt at stock settings, and it is slower than chunk-major.** No gate tuning was needed to make it run. It runs and costs time. ### Problem On 2× Tesla V100-SXM2-16GB (`sm_70`) in a CUDA layer split, the 0.2.7 default (layer-major prefill on) reads a cold prompt **26 % slower at ~9K tokens** and **10 % slower at ~37K tokens** than the same engine binary with `STRATA_PREFILL_LAYER_MAJOR=0`. One variable changed, same day. ### Environment | item | value | |---|---| | Strata | v0.2.7.1 (`46c152a1`) + 5 local commits; `strata --version` → `strata 0.1.53` | | engine identity | the prefill path we measured is upstream's own code: `git diff --name-only v0.2.7.1..HEAD` touches nothing under `src/prefill`, `include/strata/prefill` or `src/kernels` (only `serve/server.py`, slot logic in `src/program/generate.cpp`, a `STRATA_HIP_GFX906` guard in `src/core/dflash2.cpp`, apps and docs) | | OS | CachyOS (Arch), kernel 7.2.8-1-cachyos | | CPU / RAM | AMD EPYC 7452, 32 cores, **one NUMA node** · 125 GB DDR4 | | cards | 2× Tesla V100-SXM2-16GB (`sm_70`), driver 580.178.04, built against CUDA 12.8, both PCIe **Gen3 x16** (`nvidia-smi`) | | model | Qwen3.8-Flash-Next GSQ-RCO **IQ3_S** native pack + PLE gguf, MTP drafter | | settings | `--layer-split 23` (CUDA0 layers 0–22, CUDA1 23–47) · `--expert-cache auto` · `--prefill 2048` · `--spec 4 --spec-min-p 0.5` · `--kv int8 --kv-resident 32768` · `--max-context 262144` · `--vram-reserve-mib 1200` · `--pool-workers 27` · `--pcie-frac 0.1` · `--shared-expert-arena /dev/shm/strata-iq3_s.arena` · `STRATA_SM70_TABLE=1` · `STRATA_STAGE_TRIM=1` | | expert residency | the VRAM caches hold nearly all of the routed mass. On an auto-split start on this box: `layer split auto: K=23 … the caches hold 9351 of 24576 profiled pairs (~97.1 % of the routed mass)`. At the measured explicit split: CUDA0 `expert cache 5327 slots, 9.57 GiB`, CUDA1 `expert cache 4448 slots (8.89 GiB)`, and the decode hit rate in production sits at **87–93 %**. | | role | one of two production instances on this box; the other is a Radeon MI50 on the HIP build, so not affected (`prefill.cpp` treats `STRATA_HIP_GFX906` as HIP) | ### Reproduce 1. Start with the settings above and `STRATA_PREFILL_LAYER_MAJOR` unset. Startup prints `layer-major prefill is on for this layer split`. 2. Send a fresh prompt built from random salt, so nothing can be reused (`max_tokens 16`, `temperature 0`). One pass sends one ~9K-token and one ~37K-token system prompt. 3. Restart with `STRATA_PREFILL_LAYER_MAJOR=0` in the engine environment and send the same two sizes again. 4. Read the engine's own `strata serve: prompt … read in … (… tok/s)` line for each request. We dropped any pass that overlapped live router traffic. The image-prompt decline is real and separate: `layer-major off for this prompt: an image prompt`. ### Actual (engine log lines, both arms) `on` = the 0.2.7 default, `off` = `STRATA_PREFILL_LAYER_MAJOR=0`: | prompt | on (default) | off | turning it off gives back | |---|---:|---:|---:| | ~9K tokens | 611.2 tok/s (9,067 tok), 727.8 tok/s (9,242 tok) | 858.0 tok/s (9,067 tok), 825.3 tok/s (8,892 tok) | **+26 %** (mean 670 → 842) | | ~37K tokens | 835.5 tok/s (37,067 tok), 848.6 tok/s (37,067 tok) | 925.9 tok/s (37,067 tok), 924.0 tok/s (35,667 tok) | **+10 %** (mean 842 → 925) | Raw lines for the ~9K pair: ``` on : strata serve: prompt 9067 tokens = 0 reused + 9067 read in 14835 ms (611.2 tok/s), 16 generated in 194 ms (82.4 tok/s), drafts accepted 12 of 15, 2 checkpoints on : strata serve: prompt 9242 tokens = 0 reused + 9242 read in 12698 ms (727.8 tok/s), 16 generated in 179 ms (89.3 tok/s), drafts accepted 12 of 15, 2 checkpoints off: strata serve: prompt 9067 tokens = 0 reused + 9067 read in 10568 ms (858.0 tok/s), 16 generated in 238 ms (67.3 tok/s), drafts accepted 14 of 17, 2 checkpoints off: strata serve: prompt 8892 tokens = 0 reused + 8892 read in 10775 ms (825.3 tok/s), 16 generated in 182 ms (88.1 tok/s), drafts accepted 12 of 15, 2 checkpoints ``` Raw lines for the ~37K pair: ``` on : strata serve: prompt 37067 tokens = 0 reused + 37067 read in 44364 ms (835.5 tok/s), 16 generated in 203 ms (78.7 tok/s), drafts accepted 12 of 15, 4 checkpoints on : strata serve: prompt 37067 tokens = 0 reused + 37067 read in 43682 ms (848.6 tok/s), 16 generated in 186 ms (85.8 tok/s), drafts accepted 12 of 15, 4 checkpoints off: strata serve: prompt 37067 tokens = 0 reused + 37067 read in 40033 ms (925.9 tok/s), 16 generated in 191 ms (83.8 tok/s), drafts accepted 12 of 15, 4 checkpoints off: strata serve: prompt 35667 tokens = 0 reused + 35667 read in 38600 ms (924.0 tok/s), 16 generated in 193 ms (83.0 tok/s), drafts accepted 12 of 15, 4 checkpoints ``` The two arms differ only in that one environment key. The token counts are not identical across arms on purpose — each prompt carries a fresh salt — and the rate is the engine's own per-token read rate. **Cross-check against live traffic.** On the previous engine (0.1.47, chunk-major only), cold reads from token 0 in real traffic had medians of **836 tok/s at 8–16K (127 requests)** and **923 tok/s at 32–64K (238 requests)**. The `off` arm lands on those same numbers, so the `off` arm is not a lucky run and the box has not drifted. ### Why the walk engages here, and where it loses time Engagement is not the problem on this rig. With `--prefill 2048` the super-chunks fit at the default margin on both stages, with 829–882 MiB free: ``` strata prefill: layer-major (layers 0..23): 9044 tokens in 1 super-chunk(s) of up to 10240 (R in pinned RAM, 859 MiB VRAM free before), 6268 expert blobs streamed (12168.0 MB), 3629 resident, 629 expert groups (0 on the FP16 path); 5744 ms (host: enqueueing the attention halves 591, the experts 5038: waiting for the attention halves 4951, the routing tables 20) strata prefill: layer-major (layers 23..48): 9044 tokens in 1 super-chunk(s) of up to 10240 (R in pinned RAM, 882 MiB VRAM free before), 8529 expert blobs streamed (18313.7 MB), 3192 resident, 744 expert groups (0 on the FP16 path); 8156 ms (host: enqueueing the attention halves 985, the experts 7171: waiting for the attention halves 7064, the routing tables 22) ``` Pairing those stage lines with their prompt line gives the PCIe bill directly: | prompt | expert blobs streamed across both stages | read wall time | implied stream rate | |---|---:|---:|---:| | 9,067 tok (`on`) | 29.8 GB (`12168.0 + 18313.7 MB`) | 14.8 s | 2.0 GB/s | | 37,067 tok (`on`) | 139.4 GB (CUDA0 `54,838 MB` over 3 super-chunks + CUDA1 `87,883 MB` over 5) | 44.4 s | 3.1 GB/s | The walk's own timing puts almost all of that wall time in `waiting for the attention halves`. On the chunk path the same box moves almost no expert bytes at all: the caches hold ~97 % of the routed mass and the KV stream hits VRAM at 99 %+ (`KV streaming: 99.83 % of 753540 block reads hit VRAM, 5.3 MiB read from RAM`). **Our reading, flagged as unconfirmed static analysis: this box has little expert traffic left for the walk to save.** Chunk-major reads cached experts and barely touches PCIe; layer-major sends each layer's expert blobs once per super-chunk instead, so with ~97 % residency the walk can only add a PCIe cost. Upstream's win was measured with experts mostly streamed from RAM (2× RTX A4000, 16 GB each), where the re-read saving is large. That fits @udqe's link-shaped picture from the other side — our cost looks like those 30–139 GB divided by a Gen3 x16 link. We did not profile it, so the cause is a hypothesis, not an observed fault in the walk. ### Two points for the gate @fioruccione, @cobra91 and @coryjett are right that a measured per-card gate is the right shape. Our data adds two things: 1. **A link or placement gate would not predict the sign on this box.** The walk engages cleanly, sits on a single NUMA node, and still loses 10–26 %. What separates our rig from @udqe's Gen4 4090 pair (+16 % at 150K) is not the link alone — it is that **the experts are already resident**. A gate that also reads what the cache sizing decided (share of the routed mass resident) may predict "do not walk" on high-residency rigs even when the link looks fast. That number is already in the planner's own output: `the caches hold 9351 of 24576 profiled pairs (~97.1 % of the routed mass)`. 2. **The link probe does not run on an explicit split.** Every measured start here used `--layer-split 23`, and none of them prints a `CUDA0 link … GB/s` line — those lines appear only on `layer split auto` starts. So a gate built on the startup link probe would have no sample to read on rigs like ours that pin the split by hand. ### Validation - Passed: the A/B above (2 sizes × 2 arms, engine log rates quoted); `strata --version` → 0.1.53; `git diff --name-only v0.2.7.1..HEAD` shows no change under `src/prefill`, `include/strata/prefill` or `src/kernels`; the live-traffic cross-check on engine 0.1.47 (365 requests). - Failed: nothing failed. No crash, no watchdog, no decline line except the image-prompt one. - Not run: decode A/B (each measured request generated only 16 tokens, so we cannot say what layer-major does to decode here); quality, needle and KL A/B on V100; concurrency and `--batch`; `STRATA_PREFILL_LM_MARGIN_MIB` and `--vram-reserve-later-mib` tuning; prompts above ~37K in both arms (this box reads 130K cold at 905.8 tok/s on the chunk path, but we did not run that size in both arms). ### What we do now We run `STRATA_PREFILL_LAYER_MAJOR=0` in the V100 instance's environment and keep the chunk path. We are not asking for a default change; we only want to change a default where a measurement supports it, so we are reporting our numbers instead. If it helps, we can run a longer A/B — decode included, and 66K/130K in both arms — on request in this thread.
Author
Owner

@udqe commented on GitHub (Oct 29, 2026):

Two knobs from the closed benchmark reports transferred cleanly to our pair; one did not, and the failure mode is a design input for the gate @cobra91 is proposing. Same rig as our matrix above (2x RTX 4090, TR3970X, 128 GiB, UD-Q4_K_XL, engine 0.1.52), same discipline: salted fixed prompts, engine-log rates, adopt-rule stated up front (adopt if any axis >= +3% median, no axis <= -3%).

change (single-variable) decode median 150K prefill verdict
production before tonight 117.3 3,423 reference
STRATA_ARENA_PIN_GIB 24 -> 40 (whole 33 GiB arena pins) 116.0 (-1.1%) 3,540 (+3.4%) adopted
+ STRATA_STAGE_TRIM=1 with layer_split fixed at 22 123.2 (+5.0%) 3,622 (+5.8%) adopted - now production

The trim result is the gate argument made concrete. Slots went 4,275 -> 5,069 and 4,889 -> 5,739 (+17-19%) - exactly the cache-budget mechanism cobra91 describes, on a box with twice the VRAM of his. But the win only exists with a fixed K, and the reason it only exists is a trap we hit first-hand: with layer_split: auto, the first card is never trimmed - and it is worse than that, auto MOVED our split on its own today (22 -> 23 -> 22 across three same-config starts, we caught it because it silently confounded a different A/B). A gate or a bench that reads "auto" has no stable subject to measure; every recommendation written against auto should carry the K it assumed, and the standard-report proposal in #4610 is the right place to pin that fact down. agurrrrr's second point is the same blind spot from the gate side: an explicit --layer-split prints no startup link line at all (their V100 box confirms ours), so a gate keyed on that probe is simply blind on rigs whose owner pinned K.

pipeline-windows is box-dependent, and the engine states its price. The engine logs its own tax on our box: --pipeline-windows 2: 265 MiB of CUDA0 kept out of the expert cache. Our first measurement of it was confounded by the auto-drift above; the clean single-variable arm (K=22 pinned, placement line identical) says pw2 BEATS pw0 here: decode median 123.6 vs 114.8 (+7.1%), prefill equal. #4603 measured the opposite sign (-14%, same layout: draft head on the last card). So a rule like "pw2 is off when the draft shares the last card" would be wrong for exactly the two boxes that published data - the honest version is that it is a per-box trade between the cache tax and the window overlap, which puts it in the same probe-or-measure bucket as the link discussion, not the generation-rule bucket.

agurrrrr's report adds the second axis a gate has to read. Their walk loses on Gen3 (-26% / -10%) with the experts 97.1% resident - the chunk path streams almost nothing there, so the walk can only add cost. Our pair is the same-axis control with only the link moved: same machine, same caches, Gen3 -1.7% against Gen4 +16.1%, and our walk arms stream ~30 GB per 32K-token super-chunk (real mass worth saving). Read the two boxes together and the sign is a function of link rate AND streamed-mass share, not either alone: the planner's caches hold ... % of the routed mass line is the right residency input, and the walk's own per-super-chunk streamed MB is the number a gate would need for the other half.

Caveats: single-session arms (day drift), decode probe's first iteration after a long prefill runs ~10 tok/s low (medians absorb it), and pin 40 on our box equals "pin everything" because the arena is 33 GiB - #4603's whole-arena arm regressed on their pack, so read our +3.4% as pack-specific, not a general "pin more" rule.

(AI-assisted as before: the model served by this repo's engine ran the arms and wrote this; every number is an engine-log line from the machine described.)

<!-- gh-comment-id:6501916411 --> @udqe commented on GitHub (Oct 29, 2026): Two knobs from the closed benchmark reports transferred cleanly to our pair; one did not, and the failure mode is a design input for the gate @cobra91 is proposing. Same rig as our matrix above (2x RTX 4090, TR3970X, 128 GiB, UD-Q4_K_XL, engine 0.1.52), same discipline: salted fixed prompts, engine-log rates, adopt-rule stated up front (adopt if any axis >= +3% median, no axis <= -3%). | change (single-variable) | decode median | 150K prefill | verdict | |---|---|---|---| | production before tonight | 117.3 | 3,423 | reference | | `STRATA_ARENA_PIN_GIB` 24 -> 40 (whole 33 GiB arena pins) | 116.0 (-1.1%) | 3,540 (+3.4%) | adopted | | + `STRATA_STAGE_TRIM=1` with `layer_split` fixed at 22 | 123.2 (+5.0%) | 3,622 (+5.8%) | adopted - now production | **The trim result is the gate argument made concrete.** Slots went 4,275 -> 5,069 and 4,889 -> 5,739 (+17-19%) - exactly the cache-budget mechanism cobra91 describes, on a box with twice the VRAM of his. But the win only exists with a fixed K, and the reason it only exists is a trap we hit first-hand: with `layer_split: auto`, the first card is never trimmed - and it is worse than that, auto MOVED our split on its own today (22 -> 23 -> 22 across three same-config starts, we caught it because it silently confounded a different A/B). A gate or a bench that reads "auto" has no stable subject to measure; every recommendation written against auto should carry the K it assumed, and the standard-report proposal in #4610 is the right place to pin that fact down. agurrrrr's second point is the same blind spot from the gate side: an explicit `--layer-split` prints no startup link line at all (their V100 box confirms ours), so a gate keyed on that probe is simply blind on rigs whose owner pinned K. **pipeline-windows is box-dependent, and the engine states its price.** The engine logs its own tax on our box: `--pipeline-windows 2: 265 MiB of CUDA0 kept out of the expert cache`. Our first measurement of it was confounded by the auto-drift above; the clean single-variable arm (K=22 pinned, placement line identical) says pw2 BEATS pw0 here: decode median 123.6 vs 114.8 (+7.1%), prefill equal. #4603 measured the opposite sign (-14%, same layout: draft head on the last card). So a rule like "pw2 is off when the draft shares the last card" would be wrong for exactly the two boxes that published data - the honest version is that it is a per-box trade between the cache tax and the window overlap, which puts it in the same probe-or-measure bucket as the link discussion, not the generation-rule bucket. **agurrrrr's report adds the second axis a gate has to read.** Their walk loses on Gen3 (-26% / -10%) with the experts 97.1% resident - the chunk path streams almost nothing there, so the walk can only add cost. Our pair is the same-axis control with only the link moved: same machine, same caches, Gen3 -1.7% against Gen4 +16.1%, and our walk arms stream ~30 GB per 32K-token super-chunk (real mass worth saving). Read the two boxes together and the sign is a function of link rate AND streamed-mass share, not either alone: the planner's `caches hold ... % of the routed mass` line is the right residency input, and the walk's own per-super-chunk streamed MB is the number a gate would need for the other half. Caveats: single-session arms (day drift), decode probe's first iteration after a long prefill runs ~10 tok/s low (medians absorb it), and pin 40 on our box equals "pin everything" because the arena is 33 GiB - #4603's whole-arena arm regressed on their pack, so read our +3.4% as pack-specific, not a general "pin more" rule. (AI-assisted as before: the model served by this repo's engine ran the arms and wrote this; every number is an engine-log line from the machine described.)
Author
Owner

@fioruccione commented on GitHub (Oct 29, 2026):

A third data point for the residency axis, from my 2x RTX 4060 Ti 16 GB (PCIe 4.0 x8, engine measures 13.3 GB/s per card, 1 NUMA node), v0.2.7.1 (46c152a1, engine 0.1.53), UD-IQ4_XS, --layer-split auto. I only read my engine log, I ran nothing new for this.

  • Residency is like @agurrrrr's V100s. My production start says K=23 ... the caches hold 7877 of 24576 profiled pairs (~96.6% of the routed mass) (7835-7899 across the K=23 starts, 96.5% on the two K=24 ones). The link is also in the same range as their Gen3 x16.
  • The walk never ran here. Startup prints layer-major prefill is on for this layer split, but in the log since 28/10 (31 starts, production config plus a few single-flag tests) there are 0 layer-major (layers ...) lines and 57 layer-major off for this prompt: no VRAM for a super-chunk, with 238-434 MiB free, plus the image-prompt declines. Cold prompts went up to 192K tokens. So on my box the VRAM check already keeps it on the chunk path, which by agurrrrr's numbers is the faster side for this residency. I can't say what the walk would do here, because it never started.
  • The explicit split prints no link line, confirmed. My 4 starts with --layer-split 23 have no CUDA0/CUDA1 link ... GB/s line; all 27 auto starts have both.
  • Auto did not drift here. 25 of 27 auto starts gave K=23. The two K=24 ones are the two where I had added --vram-reserve-later-mib 1100, so a different config, not drift. That doesn't contradict @udqe, it just says the drift is not on every box, and it's one more reason to write the K that was used in the report (#4610).

My opinion, not measured: on a link like ours, with most of the routed mass already in VRAM, the chunk path we have now is the right one, and anything that costs expert cache slots to save PCIe traffic doesn't pay here, because there is little traffic left to save.

I have not tried STRATA_STAGE_TRIM=1 with a fixed K yet; this is my production instance, and I'd run that A/B only as a separate test.

I did this with an AI coding assistant: it searched my engine log and drafted this text. The numbers are from my log and I checked them.

<!-- gh-comment-id:6502517511 --> @fioruccione commented on GitHub (Oct 29, 2026): A third data point for the residency axis, from my 2x RTX 4060 Ti 16 GB (PCIe 4.0 x8, engine measures 13.3 GB/s per card, 1 NUMA node), v0.2.7.1 (`46c152a1`, engine 0.1.53), UD-IQ4_XS, `--layer-split auto`. I only read my engine log, I ran nothing new for this. - **Residency is like @agurrrrr's V100s.** My production start says `K=23 ... the caches hold 7877 of 24576 profiled pairs (~96.6% of the routed mass)` (7835-7899 across the K=23 starts, 96.5% on the two K=24 ones). The link is also in the same range as their Gen3 x16. - **The walk never ran here.** Startup prints `layer-major prefill is on for this layer split`, but in the log since 28/10 (31 starts, production config plus a few single-flag tests) there are 0 `layer-major (layers ...)` lines and 57 `layer-major off for this prompt: no VRAM for a super-chunk`, with 238-434 MiB free, plus the image-prompt declines. Cold prompts went up to 192K tokens. So on my box the VRAM check already keeps it on the chunk path, which by agurrrrr's numbers is the faster side for this residency. I can't say what the walk would do here, because it never started. - **The explicit split prints no link line, confirmed.** My 4 starts with `--layer-split 23` have no `CUDA0/CUDA1 link ... GB/s` line; all 27 auto starts have both. - **Auto did not drift here.** 25 of 27 auto starts gave K=23. The two K=24 ones are the two where I had added `--vram-reserve-later-mib 1100`, so a different config, not drift. That doesn't contradict @udqe, it just says the drift is not on every box, and it's one more reason to write the K that was used in the report (#4610). My opinion, not measured: on a link like ours, with most of the routed mass already in VRAM, the chunk path we have now is the right one, and anything that costs expert cache slots to save PCIe traffic doesn't pay here, because there is little traffic left to save. I have not tried `STRATA_STAGE_TRIM=1` with a fixed K yet; this is my production instance, and I'd run that A/B only as a separate test. I did this with an AI coding assistant: it searched my engine log and drafted this text. The numbers are from my log and I checked them.
Author
Owner

@cobra91 commented on GitHub (Oct 29, 2026):

A small follow-up for anyone who wants to reproduce the trim numbers from our earlier comment: the mechanism is PR #4522, standalone against current main. It extends the per-card weight trimming that main already has for explicit splits to --layer-split auto (and adds CUDA0's trimmed reload, which main never does). The prefill gain comes from the freed dense-weight VRAM going to the expert caches — on our rig the caches grow from ~6,800 to ~8,200 + ~7,500 slots, which moves most expert reads from the SSD into VRAM. No code from the fork's other changes is needed for this piece.

<!-- gh-comment-id:6509077354 --> @cobra91 commented on GitHub (Oct 29, 2026): A small follow-up for anyone who wants to reproduce the trim numbers from our earlier comment: the mechanism is PR #4522, standalone against current main. It extends the per-card weight trimming that main already has for explicit splits to `--layer-split auto` (and adds CUDA0's trimmed reload, which main never does). The prefill gain comes from the freed dense-weight VRAM going to the expert caches — on our rig the caches grow from ~6,800 to ~8,200 + ~7,500 slots, which moves most expert reads from the SSD into VRAM. No code from the fork's other changes is needed for this piece.
Author
Owner

@cedrik-fuoco commented on GitHub (Oct 30, 2026):

I think I found a correctness bug in this path, and it only appears when STRATA_HC_REQ8 is enabled. The quality evidence in this thread was collected without that switch, so nothing below contradicts it, but it does mark where the walk stops being reliable.

I have been testing the walk on a single RTX 3070 Ti with both the Q2_0 pack and IQ3_XXS, using a simple needle probe: a six-character code placed a short way into the prompt, the question at the end, greedy decoding, and a check for whether the code appears in the answer. With STRATA_PREFILL_LAYER_MAJOR=1 and STRATA_HC_REQ8=1 it never appears, at 1,567, 4,045, 12,037 or 100,003 tokens, and the failure is not subtle, since the model replies in Chinese or asks about "the image you provided" as though it had never been given the prompt. With HC_REQ8 turned off the same prompts answer exactly.

I could rule out everything except that switch. Both packs behave the same way, and the failure reproduces at the walk's minimum size of one super-chunk, so nothing about prompt length is involved. Moving the needle to the start, middle or end of the prompt changes nothing either. It is not the expert path as well: with STRATA_PREFILL_MMQ=0, which puts every layer on the FP16 path, it fails identically.

The cause turned out to be small. The three hyper-connection bf16_proj calls in run_layer_major do not pass the optional stream argument, and under HC_REQ8 those projections are stored as int8, which bf16_proj expands into a static scratch buffer on whichever stream it is handed. Without the argument that is the default stream, while the GEMM that reads the buffer runs on the prompt path's own stream, so the GEMM reads the matrix before it has been expanded. run_impl passes m.cs at the equivalent call sites and the layer-major path does not.

Passing the stream at those three call sites is the entire fix, and I have opened #4715 with it. The PR also adds a small test for the expansion primitive, since bf16_proj is file-static and no test can reach it.

Hardware and settings:

GPU RTX 3070 Ti, 8 GiB, cc 8.6, one GPU, no layer split
CPU, RAM Ryzen 9 9900X, 61.6 GiB DDR5-6000
OS Windows 11
Engine 0.1.53 from the 0.2.7.1 tree plus this fix, -DCMAKE_CUDA_ARCHITECTURES=86, CUDA 12.6, MSVC 18.4
Model Qwen3.8-Flash-Next GSQ-RCO, Q2_0 pack, --native Q2_0 GGUF shards, --ple-gguf, --expert-profile data/expert-profile.bin
Flags --expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5 --mtp --max-context 131072 --kv int8 --kv-resident 16384 --vram-reserve-mib 1400
Env STRATA_HC_REQ8=1, STRATA_PREFILL_LAYER_MAJOR=1 for the arm under test and =0 for every control, plus the config's STRATA_ADAPT_NOWAIT=1, STRATA_ADAPT_LAG=2, STRATA_CPU_IQ_ALL_EXACT1=1, STRATA_SIDE_MIXER=2, STRATA_ATTN_DAILY=1, STRATA_GR_UP75=1, STRATA_GU_SWIGLU=1, STRATA_QSA_ROWS=1, STRATA_B6_MMVQ_ROWS=1
<!-- gh-comment-id:6526643917 --> @cedrik-fuoco commented on GitHub (Oct 30, 2026): I think I found a correctness bug in this path, and it only appears when `STRATA_HC_REQ8` is enabled. The quality evidence in this thread was collected without that switch, so nothing below contradicts it, but it does mark where the walk stops being reliable. I have been testing the walk on a single RTX 3070 Ti with both the Q2_0 pack and IQ3_XXS, using a simple needle probe: a six-character code placed a short way into the prompt, the question at the end, greedy decoding, and a check for whether the code appears in the answer. With `STRATA_PREFILL_LAYER_MAJOR=1` and `STRATA_HC_REQ8=1` it never appears, at 1,567, 4,045, 12,037 or 100,003 tokens, and the failure is not subtle, since the model replies in Chinese or asks about "the image you provided" as though it had never been given the prompt. With `HC_REQ8` turned off the same prompts answer exactly. I could rule out everything except that switch. Both packs behave the same way, and the failure reproduces at the walk's minimum size of one super-chunk, so nothing about prompt length is involved. Moving the needle to the start, middle or end of the prompt changes nothing either. It is not the expert path as well: with `STRATA_PREFILL_MMQ=0`, which puts every layer on the FP16 path, it fails identically. The cause turned out to be small. The three hyper-connection `bf16_proj` calls in `run_layer_major` do not pass the optional `stream` argument, and under `HC_REQ8` those projections are stored as int8, which `bf16_proj` expands into a static scratch buffer on whichever stream it is handed. Without the argument that is the default stream, while the GEMM that reads the buffer runs on the prompt path's own stream, so the GEMM reads the matrix before it has been expanded. `run_impl` passes `m.cs` at the equivalent call sites and the layer-major path does not. Passing the stream at those three call sites is the entire fix, and I have opened #4715 with it. The PR also adds a small test for the expansion primitive, since `bf16_proj` is file-static and no test can reach it. Hardware and settings: | | | | --- | --- | | GPU | RTX 3070 Ti, 8 GiB, cc 8.6, one GPU, no layer split | | CPU, RAM | Ryzen 9 9900X, 61.6 GiB DDR5-6000 | | OS | Windows 11 | | Engine | 0.1.53 from the 0.2.7.1 tree plus this fix, `-DCMAKE_CUDA_ARCHITECTURES=86`, CUDA 12.6, MSVC 18.4 | | Model | Qwen3.8-Flash-Next GSQ-RCO, Q2_0 pack, `--native` Q2_0 GGUF shards, `--ple-gguf`, `--expert-profile data/expert-profile.bin` | | Flags | `--expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5 --mtp --max-context 131072 --kv int8 --kv-resident 16384 --vram-reserve-mib 1400` | | Env | `STRATA_HC_REQ8=1`, `STRATA_PREFILL_LAYER_MAJOR=1` for the arm under test and `=0` for every control, plus the config's `STRATA_ADAPT_NOWAIT=1`, `STRATA_ADAPT_LAG=2`, `STRATA_CPU_IQ_ALL_EXACT1=1`, `STRATA_SIDE_MIXER=2`, `STRATA_ATTN_DAILY=1`, `STRATA_GR_UP75=1`, `STRATA_GU_SWIGLU=1`, `STRATA_QSA_ROWS=1`, `STRATA_B6_MMVQ_ROWS=1` |
Author
Owner

@udqe commented on GitHub (Oct 30, 2026):

cedrik-fuoco's stream finding (#4715) - one independent tree confirmation: the three call sites are still missing the stream argument in the 0.2.8 tree, so every 0.2.8 build ships with the race.

We read our installed 0.2.8 source (Terminal CLI self-report strata 0.2.8 (build 0.1.54 ...), the tree the update wrote in today):

  • bf16_proj's signature takes void* stream = nullptr as the 11th argument (prefill.cpp:2702-2704), and the int8 expansion comment says "the GEMM takes bf16, so the int8 codes are expanded into one reused scratch on this stream" (2708) - a static scratch under STRATA_HC_REQ8, exactly as he describes.
  • run_impl passes it: the down/up/inject calls end with m.cs (3744, 3773-3774).
  • run_layer_major (starts 6150) does not: the same three calls - 6781 (hc_attn_down), 6783 (hc_*_up), 6784 (hc_ffn_inject) - stop at m.xn16_lo / m.lo16_lo with no stream, so the expansion lands on the default stream while the path's kernels run on cs.

Three sites, the same ones he fixed in #4715. This is static reading of the source only - unconfirmed static analysis in the repo's words: we did not build the engine and did not reproduce the needle failure (our box runs STRATA_HC_REQ8 off and the chunk path, so we are outside the affected combination; our env's STRATA_HC_Q8 is the different, upstream switch).

We also checked main (870aedd9, the only commit after the 0.2.8 release): the three sites are unchanged there too, and #4715 has no review yet - every 0.2.8 user who turns on HC_REQ8 + walk is exposed until it lands.

Two things the thread could take from this cheaply:

  1. Until #4715 merges, the affected combination for any 0.2.8 user is STRATA_HC_REQ8=1 + STRATA_PREFILL_LAYER_MAJOR=1 - one line worth having where walk users read.
  2. His needle probe (six-character code, greedy, presence check) looks like the right tripwire for walk correctness in general - it caught a stream bug no throughput test would.

We are reporting from the Windows/CUDA 0.2.8 tree as installed; no claim about whether the fix in #4715 is complete beyond the three sites he named - the tree still matching his diagnosis is the whole of our claim. (His PR's patch anchors at the same lines we quote, so the fix and our reading are of identical code.)

(AI-assisted: the model served by this repo's engine read the tree and drafted this; the line numbers are ours from the installed 0.2.8 source.)

<!-- gh-comment-id:6529270835 --> @udqe commented on GitHub (Oct 30, 2026): cedrik-fuoco's stream finding (#4715) - one independent tree confirmation: the three call sites are still missing the stream argument in the 0.2.8 tree, so every 0.2.8 build ships with the race. We read our installed 0.2.8 source (Terminal CLI self-report `strata 0.2.8 (build 0.1.54 ...)`, the tree the update wrote in today): - `bf16_proj`'s signature takes `void* stream = nullptr` as the 11th argument (prefill.cpp:2702-2704), and the int8 expansion comment says "the GEMM takes bf16, so the int8 codes are expanded into one reused scratch on this stream" (2708) - a static scratch under `STRATA_HC_REQ8`, exactly as he describes. - `run_impl` passes it: the down/up/inject calls end with `m.cs` (3744, 3773-3774). - `run_layer_major` (starts 6150) does not: the same three calls - 6781 (`hc_attn_down`), 6783 (`hc_*_up`), 6784 (`hc_ffn_inject`) - stop at `m.xn16_lo` / `m.lo16_lo` with no stream, so the expansion lands on the default stream while the path's kernels run on `cs`. Three sites, the same ones he fixed in #4715. **This is static reading of the source only - unconfirmed static analysis in the repo's words: we did not build the engine and did not reproduce the needle failure** (our box runs `STRATA_HC_REQ8` off and the chunk path, so we are outside the affected combination; our env's `STRATA_HC_Q8` is the different, upstream switch). We also checked main (870aedd9, the only commit after the 0.2.8 release): the three sites are unchanged there too, and #4715 has no review yet - every 0.2.8 user who turns on `HC_REQ8` + walk is exposed until it lands. Two things the thread could take from this cheaply: 1. Until #4715 merges, the affected combination for any 0.2.8 user is `STRATA_HC_REQ8=1` + `STRATA_PREFILL_LAYER_MAJOR=1` - one line worth having where walk users read. 2. His needle probe (six-character code, greedy, presence check) looks like the right tripwire for walk correctness in general - it caught a stream bug no throughput test would. We are reporting from the Windows/CUDA 0.2.8 tree as installed; no claim about whether the fix in #4715 is complete beyond the three sites he named - the tree still matching his diagnosis is the whole of our claim. (His PR's patch anchors at the same lines we quote, so the fix and our reading are of identical code.) (AI-assisted: the model served by this repo's engine read the tree and drafted this; the line numbers are ours from the installed 0.2.8 source.)
Author
Owner

@Norhiro commented on GitHub (Oct 31, 2026):

Field data (requested for 0.2.7, measured on 0.2.8). One unequal card pair, RTX 3060 12 GB + RTX 5060 Ti 16 GB, on two hosts. Qwen UD-Q4_K_XL, source build of v0.2.8 (870aedd), explicit split K=24 with --trim-stage-weights, order 3060 → 5060 Ti.

Host A: i7-7800X, 62 GB RAM, one NUMA node, AVX-512 build. 2 runs per size.
Host B: 2 x E5-2630 v2, 251 GB RAM, AVX only (STRATA_ISA_FLOOR=avx), both cards PCIe Gen3 x8 on node 0 (engine probe 6.0-6.7 GB/s), process bound to node 0, 3 runs per size.

Time to first token, second run. Off = STRATA_PREFILL_LAYER_MAJOR=0, --vram-reserve-later-mib 1400. Tuned = --vram-reserve-mib 1700 --vram-reserve-later-mib 1700 --prefill 4096 STRATA_PREFILL_LM_MARGIN_MIB=96.

host, arm 8K 20K 32K 32K drive reads decode median, n = 40
A, off 24.3 s 42.7 s 51.3 s 87 GB 26.85 tok/s
A, tuned 24.2 s 23.4 s 29.8 s 39 GB 21.8 tok/s
B, off 24.8 s 49.1 s 62.7 s 39 GB 28.05 tok/s
B, tuned 22.7 s 24.2 s 30.9 s 0.1 GB 26.9 tok/s

The walk ran in both tuned arms. On host B it halved the 20K and 32K reads on a Gen3 x8 link, unlike the Gen3 pairs above; I did not test why, and the 3060 holds far fewer experts in VRAM than those cards.

Limits: on host B the tuned arm ran after the off arm, and its near-zero reads include the page cache. T5 ran once per arm, off first, so -4% may be noise. On host A the extra reserve cost 19% decode; expert slots fell 2335 → 2001 on the 3060 and 2952 → 2851 on the 5060 Ti, the suspected cause, not isolated.

Quality, off against tuned, same on both hosts: needle 9/9 both, HumanEval 0-39 39/38 both, Japanese 11/12 both, tool calls 8/8 both. All with STRATA_HC_Q8=1; STRATA_HC_REQ8 was not set, so #4715 does not apply.

Host A only: with the defaults, and with --layer-split auto in both card orders (K=18 and K=34), layer-major declined and 32K took 50-65 s; no OOM. The startup line says layer-major is on in every default arm. Host B did not run these arms.

<!-- gh-comment-id:6542151055 --> @Norhiro commented on GitHub (Oct 31, 2026): Field data (requested for 0.2.7, measured on 0.2.8). One unequal card pair, RTX 3060 12 GB + RTX 5060 Ti 16 GB, on two hosts. Qwen UD-Q4_K_XL, source build of v0.2.8 (870aedd), explicit split K=24 with `--trim-stage-weights`, order 3060 → 5060 Ti. **Host A:** i7-7800X, 62 GB RAM, one NUMA node, AVX-512 build. 2 runs per size. **Host B:** 2 x E5-2630 v2, 251 GB RAM, AVX only (`STRATA_ISA_FLOOR=avx`), both cards PCIe Gen3 x8 on node 0 (engine probe 6.0-6.7 GB/s), process bound to node 0, 3 runs per size. Time to first token, second run. Off = `STRATA_PREFILL_LAYER_MAJOR=0`, `--vram-reserve-later-mib 1400`. Tuned = `--vram-reserve-mib 1700 --vram-reserve-later-mib 1700 --prefill 4096 STRATA_PREFILL_LM_MARGIN_MIB=96`. | host, arm | 8K | 20K | 32K | 32K drive reads | decode median, n = 40 | |---|---|---|---|---|---| | A, off | 24.3 s | 42.7 s | 51.3 s | 87 GB | 26.85 tok/s | | A, tuned | 24.2 s | 23.4 s | 29.8 s | 39 GB | 21.8 tok/s | | B, off | 24.8 s | 49.1 s | 62.7 s | 39 GB | 28.05 tok/s | | B, tuned | 22.7 s | 24.2 s | 30.9 s | 0.1 GB | 26.9 tok/s | The walk ran in both tuned arms. On host B it halved the 20K and 32K reads on a Gen3 x8 link, unlike the Gen3 pairs above; I did not test why, and the 3060 holds far fewer experts in VRAM than those cards. Limits: on host B the tuned arm ran after the off arm, and its near-zero reads include the page cache. T5 ran once per arm, off first, so -4% may be noise. On host A the extra reserve cost 19% decode; expert slots fell 2335 → 2001 on the 3060 and 2952 → 2851 on the 5060 Ti, the suspected cause, not isolated. Quality, off against tuned, same on both hosts: needle 9/9 both, HumanEval 0-39 39/38 both, Japanese 11/12 both, tool calls 8/8 both. All with `STRATA_HC_Q8=1`; `STRATA_HC_REQ8` was not set, so #4715 does not apply. Host A only: with the defaults, and with `--layer-split auto` in both card orders (K=18 and K=34), layer-major declined and 32K took 50-65 s; no OOM. The startup line says layer-major is on in every default arm. Host B did not run these arms.
Author
Owner

@Norhiro commented on GitHub (Nov 4, 2026):

Follow-up on the same machine (RTX 3060 12 GB + RTX 5060 Ti 16 GB layer split, both PCIe 3.0 x8, 2 × Xeon E5-2630 v2 AVX only, 251 GiB RAM), UD-Q4_K_XL, now on 0.2.9 and 0.2.10. On this machine the 2.0x from this issue no longer holds. That matches 0.2.10's change to chunk-major by default on a layer split.

What changed since this issue. The numbers above were taken with --resident-budget-gib 38, so about 30 GiB of experts came from the SSD for every chunk, and layer-major mostly saved drive reads (0.47x). Now the config is setup.py's default for this file: all 71.7 GiB of experts in RAM, --max-context 65536 --prefill auto --expert-cache auto --spec 4, STRATA_HC_Q8=1 STRATA_ROUTE_TAIL_SKIP=0, auto split (K=19-21), no NUMA binding. Chunk-major alone now reads a 32K prompt in 44.6 s (this issue: 65.0 s chunk-major, 33.1 s layer-major).

Chunk-major is PCIe-bound here. During a prompt read both cards receive at the link's speed (nvidia-smi dmon 5-7 GB/s; the engine's probe 6.0 / 6.7 GB/s): about 70-80 GB for the first 6,912-token chunk and about 50-70 GB for each further one. TTFT is about 13 s + 7 s per further chunk:

Prompt tokens 0.2.9 chunk-major 0.2.9 layer-major (forced, see below) 0.2.10 default
0.8-4.7K 10.7-15.5 s 11.2-16.0 s 10.5-15.5 s
7.6-10.3K 19.5-21.7 s 20.0-23.0 s 19.8-21.9 s
14.3-19.5K 26.9-29.8 s 27.6-32.3 s 27.2-30.0 s
31.3-31.5K 44.5-44.7 s 46.4-46.8 s 44.6-45.0 s
48.9-49.0K 64.0-65.0 s 62.1-62.9 s 64.4-65.3 s

(3 rounds each, unique prompts, 0 tokens reused, temperature 0, no thinking.)

Layer-major on 0.2.9. It was the default for this split, but it never ran: the first long prompt logged layer-major off for this prompt: no VRAM for a super-chunk (619 MiB free), and nothing after it, because that line is printed once per reason. It ran only with --vram-reserve-mib 1500 --vram-reserve-later-mib 2600 STRATA_PREFILL_LM_R=host; the start-up hint --vram-reserve-later-mib 1341 was not enough. Once it ran, the expert bytes fell to about a third (49K: 95 GB on the 3060 stage), but TTFT did not move (table). The engine's breakdown shows the 3060 stage (layers 0..21) waiting for its attention halves: 26.0 s of a 50.1 s stage. STRATA_MMQ_KQ=1 moved every expert group off the FP16 path ("0 on the FP16 path"), but the same stage then waited 37.5 s of 50.5 s for attention, so TTFT was again unchanged. With chunk-major, STRATA_MMQ_KQ=1 also changed nothing (the link is the limit). The VRAM reserves cost about 13% of decode after long prompts (31.9 → 27.6 tok/s); short-prompt decode did not change.

0.2.10 with the same config: TTFT as 0.2.9 chunk-major (table), decode after long prompts 31.7 tok/s (0.2.9 31.9).

So on this pair, with the experts in RAM, chunk-major is the right default. Layer-major would only pay off here where the experts come from the drive, as in the original numbers. Not run: an explicit --layer-split with fewer layers on the 3060, STRATA_PREFILL_LM_TOKENS, #4875's data-parallel prompt read. Passed: all requests answered, no errors, summaries read as correct. Failed: none.

If it helps someone who sets STRATA_PREFILL_LAYER_MAJOR=1: a small patch makes the "no VRAM for a super-chunk" line say how many MiB the smallest super-chunk needs, and repeats it every 16th prompt. It is not built or tested yet; happy to open a PR if wanted.

<!-- gh-comment-id:6619950697 --> @Norhiro commented on GitHub (Nov 4, 2026): Follow-up on the same machine (RTX 3060 12 GB + RTX 5060 Ti 16 GB layer split, both PCIe 3.0 x8, 2 × Xeon E5-2630 v2 AVX only, 251 GiB RAM), UD-Q4_K_XL, now on 0.2.9 and 0.2.10. **On this machine the 2.0x from this issue no longer holds.** That matches 0.2.10's change to chunk-major by default on a layer split. **What changed since this issue.** The numbers above were taken with `--resident-budget-gib 38`, so about 30 GiB of experts came from the SSD for every chunk, and layer-major mostly saved drive reads (0.47x). Now the config is setup.py's default for this file: all 71.7 GiB of experts in RAM, `--max-context 65536 --prefill auto --expert-cache auto --spec 4`, `STRATA_HC_Q8=1 STRATA_ROUTE_TAIL_SKIP=0`, auto split (K=19-21), no NUMA binding. Chunk-major alone now reads a 32K prompt in 44.6 s (this issue: 65.0 s chunk-major, 33.1 s layer-major). **Chunk-major is PCIe-bound here.** During a prompt read both cards receive at the link's speed (nvidia-smi dmon 5-7 GB/s; the engine's probe 6.0 / 6.7 GB/s): about 70-80 GB for the first 6,912-token chunk and about 50-70 GB for each further one. TTFT is about 13 s + 7 s per further chunk: | Prompt tokens | 0.2.9 chunk-major | 0.2.9 layer-major (forced, see below) | 0.2.10 default | |---|---|---|---| | 0.8-4.7K | 10.7-15.5 s | 11.2-16.0 s | 10.5-15.5 s | | 7.6-10.3K | 19.5-21.7 s | 20.0-23.0 s | 19.8-21.9 s | | 14.3-19.5K | 26.9-29.8 s | 27.6-32.3 s | 27.2-30.0 s | | 31.3-31.5K | 44.5-44.7 s | 46.4-46.8 s | 44.6-45.0 s | | 48.9-49.0K | 64.0-65.0 s | 62.1-62.9 s | 64.4-65.3 s | (3 rounds each, unique prompts, 0 tokens reused, temperature 0, no thinking.) **Layer-major on 0.2.9.** It was the default for this split, but it never ran: the first long prompt logged `layer-major off for this prompt: no VRAM for a super-chunk (619 MiB free)`, and nothing after it, because that line is printed once per reason. It ran only with `--vram-reserve-mib 1500 --vram-reserve-later-mib 2600 STRATA_PREFILL_LM_R=host`; the start-up hint `--vram-reserve-later-mib 1341` was not enough. Once it ran, the expert bytes fell to about a third (49K: 95 GB on the 3060 stage), but TTFT did not move (table). The engine's breakdown shows the 3060 stage (layers 0..21) waiting for its attention halves: 26.0 s of a 50.1 s stage. `STRATA_MMQ_KQ=1` moved every expert group off the FP16 path ("0 on the FP16 path"), but the same stage then waited 37.5 s of 50.5 s for attention, so TTFT was again unchanged. With chunk-major, `STRATA_MMQ_KQ=1` also changed nothing (the link is the limit). The VRAM reserves cost about 13% of decode after long prompts (31.9 → 27.6 tok/s); short-prompt decode did not change. **0.2.10** with the same config: TTFT as 0.2.9 chunk-major (table), decode after long prompts 31.7 tok/s (0.2.9 31.9). So on this pair, with the experts in RAM, chunk-major is the right default. Layer-major would only pay off here where the experts come from the drive, as in the original numbers. Not run: an explicit `--layer-split` with fewer layers on the 3060, `STRATA_PREFILL_LM_TOKENS`, #4875's data-parallel prompt read. Passed: all requests answered, no errors, summaries read as correct. Failed: none. If it helps someone who sets `STRATA_PREFILL_LAYER_MAJOR=1`: a small patch makes the "no VRAM for a super-chunk" line say how many MiB the smallest super-chunk needs, and repeats it every 16th prompt. It is not built or tested yet; happy to open a PR if wanted.
Author
Owner

@udqe commented on GitHub (Nov 4, 2026):

@Norhiro your follow-up reads as the cleanest statement of when layer-major pays (drive-fed experts) and when it does not (RAM-resident), and our 2x 4090 log turned out to be an independent second machine for two of your points, plus the use-case your patch is asking for.

  1. The 0.2.10 default flip: our log spans 161 engine boots across the 0.2.8/0.2.9/0.2.10 apps on a CUDA auto layer split. Through the last 0.2.9-era boot every start printed 'layer-major prefill is on for this layer split', and every prompt that could not use it printed why. From the boot where we took 0.2.10 (11-03 13:38, engine 0.1.56) there is not one layer-major line - ON, off-for-this-prompt, none of it, across thirteen boots and every prompt size up to 150K. Silent in exactly the way your 'chunk-major by default on a layer split' sentence predicts.

  2. Your patch would have answered a question our own log cannot. We hold 221 swap-off lines, and every one of them prints the free side ('no VRAM for a super-chunk (732 MiB free)') and none the need side. Our free-MiB values are bimodal across the logged history: roughly 1,005-1,224 in the early era, 632/634/732/734 in the later one (the pipeline-windows and MTP layer ate the headroom). And we DO have boots where it ran: last weekend (10-29), with 1,260 MiB free, '32768 tokens in 1 super-chunk(s) of up to 32768 (R in pinned RAM, 1260 MiB VRAM free before)', a 122,749-token prompt in four super-chunks. From then on it never fit again at ~730. Your line would have told us when it stopped fitting and what it wanted; we had to reverse-engineer the threshold out of run lines, and a user without those run lines - which is what 0.2.10 ships now - cannot even see the feature exists.

  3. Your negative result with RAM-resident experts reproduces on our pair from the opposite direction. Our forced-LM boots (the only era where it ran here) happened to be the boots where we measured a PCIe-generation A/B for the Qwen decode question - so we have LM-era prefill numbers against chunk-era anchors on the same model: LM-era 32K reads ~2,4xx tok/s, chunk-era anchors 2,568 and 2,46x-2,72x on the same probe family - overlapping ranges, i.e. with the expert stream pinned in RAM, layer-major moved our prefill speed by nothing beyond noise, while your drive-fed setup gained 2.0x. A different pair, quant, OS and swap direction, same conclusion. (Discipline note we are adopting from your table: we now stamp which prefill mode each row's era ran, and your thread is why.)

(ai-assisted; every quoted line verbatim from our engine log - 161 boots, 2x RTX 4090 Windows/CUDA, auto layer split, UD-Q4_K_XL streamed from RAM; this is log archaeology, not a new benchmark run; the Gen A/B prefill numbers carry the same caveats as posted on the decode thread.)

<!-- gh-comment-id:6620898742 --> @udqe commented on GitHub (Nov 4, 2026): @Norhiro your follow-up reads as the cleanest statement of when layer-major pays (drive-fed experts) and when it does not (RAM-resident), and our 2x 4090 log turned out to be an independent second machine for two of your points, plus the use-case your patch is asking for. 1) The 0.2.10 default flip: our log spans 161 engine boots across the 0.2.8/0.2.9/0.2.10 apps on a CUDA auto layer split. Through the last 0.2.9-era boot every start printed 'layer-major prefill is on for this layer split', and every prompt that could not use it printed why. From the boot where we took 0.2.10 (11-03 13:38, engine 0.1.56) there is not one layer-major line - ON, off-for-this-prompt, none of it, across thirteen boots and every prompt size up to 150K. Silent in exactly the way your 'chunk-major by default on a layer split' sentence predicts. 2) Your patch would have answered a question our own log cannot. We hold 221 swap-off lines, and every one of them prints the free side ('no VRAM for a super-chunk (732 MiB free)') and none the need side. Our free-MiB values are bimodal across the logged history: roughly 1,005-1,224 in the early era, 632/634/732/734 in the later one (the pipeline-windows and MTP layer ate the headroom). And we DO have boots where it ran: last weekend (10-29), with 1,260 MiB free, '32768 tokens in 1 super-chunk(s) of up to 32768 (R in pinned RAM, 1260 MiB VRAM free before)', a 122,749-token prompt in four super-chunks. From then on it never fit again at ~730. Your line would have told us when it stopped fitting and what it wanted; we had to reverse-engineer the threshold out of run lines, and a user without those run lines - which is what 0.2.10 ships now - cannot even see the feature exists. 3) Your negative result with RAM-resident experts reproduces on our pair from the opposite direction. Our forced-LM boots (the only era where it ran here) happened to be the boots where we measured a PCIe-generation A/B for the Qwen decode question - so we have LM-era prefill numbers against chunk-era anchors on the same model: LM-era 32K reads ~2,4xx tok/s, chunk-era anchors 2,568 and 2,46x-2,72x on the same probe family - overlapping ranges, i.e. with the expert stream pinned in RAM, layer-major moved our prefill speed by nothing beyond noise, while your drive-fed setup gained 2.0x. A different pair, quant, OS and swap direction, same conclusion. (Discipline note we are adopting from your table: we now stamp which prefill mode each row's era ran, and your thread is why.) (ai-assisted; every quoted line verbatim from our engine log - 161 boots, 2x RTX 4090 Windows/CUDA, auto layer split, UD-Q4_K_XL streamed from RAM; this is log archaeology, not a new benchmark run; the Gen A/B prefill numbers carry the same caveats as posted on the decode thread.)
Author
Owner

@fioruccione commented on GitHub (Nov 4, 2026):

@Norhiro @udqe a third pair for the same picture, from this morning.

Box: 2x RTX 4060 Ti 16 GB (sm_89, Gen4 x8, probe 13.3 GB/s each), TR PRO 3975WX, 128 GB, UD-IQ4_XS, auto layer split, experts RAM-resident with --pcie-frac 0.00, VRAM memory offset +2000 in every arm. A/B with a fresh server per start, order A T U V V U T A, prefill 20K / 32K / 69K, two starts per arm.

  • 0.2.7.1: layer-major was announced at every start and gave up on every long prompt: no VRAM for a super-chunk with 310-360 MiB free. Same as I reported earlier in this thread: it never ran here.
  • 0.2.10 (source build, sm_89): across six starts, not one layer-major line, on or off. That matches the chunk-major default on a layer split.
  • Prefill, 0.2.7.1 vs 0.2.10 with the same config and MTP: 1765 / 2076 / 2346 against 1786 / 2071 / 2330 tok/s. No change, as expected if layer-major never ran before either.

So with RAM-resident experts the default flip costs nothing on this pair, and +1 to the patch that prints the need side of the "no VRAM for a super-chunk" line. Here the gap was never small enough to try, but I only know that because I went looking.

<!-- gh-comment-id:6629095018 --> @fioruccione commented on GitHub (Nov 4, 2026): @Norhiro @udqe a third pair for the same picture, from this morning. Box: 2x RTX 4060 Ti 16 GB (sm_89, Gen4 x8, probe 13.3 GB/s each), TR PRO 3975WX, 128 GB, UD-IQ4_XS, auto layer split, experts RAM-resident with `--pcie-frac 0.00`, VRAM memory offset +2000 in every arm. A/B with a fresh server per start, order A T U V V U T A, prefill 20K / 32K / 69K, two starts per arm. - **0.2.7.1:** layer-major was announced at every start and gave up on every long prompt: `no VRAM for a super-chunk` with 310-360 MiB free. Same as I reported earlier in this thread: it never ran here. - **0.2.10 (source build, sm_89):** across six starts, not one layer-major line, on or off. That matches the chunk-major default on a layer split. - **Prefill, 0.2.7.1 vs 0.2.10 with the same config and MTP:** 1765 / 2076 / 2346 against 1786 / 2071 / 2330 tok/s. No change, as expected if layer-major never ran before either. So with RAM-resident experts the default flip costs nothing on this pair, and +1 to the patch that prints the need side of the "no VRAM for a super-chunk" line. Here the gap was never small enough to try, but I only know that because I went looking.
Author
Owner

@cobra91 commented on GitHub (Nov 4, 2026):

@Norhiro @udqe @fioruccione a fourth pair with a different constraint: on a 32 GB box the resident RAM tier changes size between starts, and that alone moves decode more than any prefill-mode A/B we could run on top of it.

Box: RTX 5080 + RTX 4060 Ti 16 GB, 8c/16t, 32 GB RAM, Swift-Qwen3.8-Flash-Next IQ2_XS, auto layer split, pipeline-windows 2, source builds of engine 0.1.53 and 0.1.56, Windows/CUDA. Same config, same 32K probe (greedy, 2500-token generation), all on 04-11:

  • start seeing 5.88 GB available: WARNING: the whole resident RAM mode does not fit (... resident complement 11.56 GiB exceeds available RAM (5.88 GiB) minus the 4 GiB safety headroom); 1.62 GiB of the experts the GPU does not hold, the hottest by the expert profile, are kept in RAM and the rest are read from the model folder -> 82.5 tok/s decode (that start also sat 434 MiB from full, so WDDM shares the blame)
  • start seeing 14.96 GB: capped, then resident RAM mode: 10.71 GiB of experts in RAM (locked), 8224 in the GPU cache; adaptive swaps exchange them with the GPU cache (no file reads) -> 107.1 tok/s
  • start seeing ~19 GB: resident RAM mode: 13.29 GiB of experts in RAM (locked), 8365 in the GPU cache; ... -> 139.2 tok/s

Same binary in the last two arms; the only thing that changed is what the desktop was holding at load time (a music app and a browser move "available" by 8-13 GB here). So a prefill-mode A/B whose arms booted into different tier sizes measures the tier, not the mode. Extending @udqe's era-stamping: we now stamp the resident-tier line of every start and re-run any A/B whose arms disagree on it.

One more data point for the 0.2.10 flip: our engine-only builds show the layer-major announcement disappears between engine 0.1.53 and 0.1.56 -- one layer-major prefill is on for this layer split line at the 0.1.53 start, not one layer-major line of any kind across five 0.1.56 starts -- so the chunk-major default lives in the engine, below the app. And +1 to the need-side patch: with the tier this mobile on small-RAM boxes, a silent no VRAM for a super-chunk is one more state a user cannot diagnose from run lines alone.

(ai-assisted; quoted lines verbatim from our engine logs; the tok/s numbers are one run per arm, greedy, same prompt each time -- the deltas sit far outside our run-to-run noise on this rig, and the tier lines move with them.)

Edit: these engines are source builds of 0.1.53/0.1.56 carrying our in-review patches (trim #4522 and related); the resident-tier sizing and its boot-time available-RAM gate are upstream code either way, and every quoted line is verbatim engine output.

<!-- gh-comment-id:6630375336 --> @cobra91 commented on GitHub (Nov 4, 2026): @Norhiro @udqe @fioruccione a fourth pair with a different constraint: on a 32 GB box the resident RAM tier changes **size** between starts, and that alone moves decode more than any prefill-mode A/B we could run on top of it. Box: RTX 5080 + RTX 4060 Ti 16 GB, 8c/16t, 32 GB RAM, Swift-Qwen3.8-Flash-Next IQ2_XS, auto layer split, pipeline-windows 2, source builds of engine 0.1.53 and 0.1.56, Windows/CUDA. Same config, same 32K probe (greedy, 2500-token generation), all on 04-11: - start seeing 5.88 GB available: `WARNING: the whole resident RAM mode does not fit (... resident complement 11.56 GiB exceeds available RAM (5.88 GiB) minus the 4 GiB safety headroom); 1.62 GiB of the experts the GPU does not hold, the hottest by the expert profile, are kept in RAM and the rest are read from the model folder` -> 82.5 tok/s decode (that start also sat 434 MiB from full, so WDDM shares the blame) - start seeing 14.96 GB: capped, then `resident RAM mode: 10.71 GiB of experts in RAM (locked), 8224 in the GPU cache; adaptive swaps exchange them with the GPU cache (no file reads)` -> 107.1 tok/s - start seeing ~19 GB: `resident RAM mode: 13.29 GiB of experts in RAM (locked), 8365 in the GPU cache; ...` -> 139.2 tok/s Same binary in the last two arms; the only thing that changed is what the desktop was holding at load time (a music app and a browser move "available" by 8-13 GB here). So a prefill-mode A/B whose arms booted into different tier sizes measures the tier, not the mode. Extending @udqe's era-stamping: we now stamp the resident-tier line of every start and re-run any A/B whose arms disagree on it. One more data point for the 0.2.10 flip: our engine-only builds show the layer-major announcement disappears between engine 0.1.53 and 0.1.56 -- one `layer-major prefill is on for this layer split` line at the 0.1.53 start, not one layer-major line of any kind across five 0.1.56 starts -- so the chunk-major default lives in the engine, below the app. And +1 to the need-side patch: with the tier this mobile on small-RAM boxes, a silent `no VRAM for a super-chunk` is one more state a user cannot diagnose from run lines alone. (ai-assisted; quoted lines verbatim from our engine logs; the tok/s numbers are one run per arm, greedy, same prompt each time -- the deltas sit far outside our run-to-run noise on this rig, and the tier lines move with them.) Edit: these engines are source builds of 0.1.53/0.1.56 carrying our in-review patches (trim #4522 and related); the resident-tier sizing and its boot-time available-RAM gate are upstream code either way, and every quoted line is verbatim engine output.
Author
Owner

@Norhiro commented on GitHub (Nov 4, 2026):

Follow-up, now on my other box: the same RTX 3060 12 GB + RTX 5060 Ti 16 GB moved to an i7-7800X (125 GiB RAM, Fedora 44; 3060 on PCIe 3.0 x16, probe 12.3 GB/s; 5060 Ti on 3.0 x8). UD-Q4_K_XL, 0.2.10 (engine 0.1.56, source build), all 71.7 GiB of experts in RAM, same config as in my last comment (--max-context 65536 --prefill auto --expert-cache auto --spec 4, MTP, STRATA_HC_Q8=1 STRATA_ROUTE_TAIL_SKIP=0).

1. Two cards, layer split: same result as on the Xeon. I compared 0.2.10's default (chunk-major) with layer-major forced (STRATA_PREFILL_LAYER_MAJOR=1, --vram-reserve-mib 1500 --vram-reserve-later-mib 2600, STRATA_PREFILL_LM_R=host). 3 rounds each, unique prompts:

Prompt tokens default layer-major forced
~31K 39.2-39.5 s 44.3-44.9 s
~49K 59.6-60.0 s 60.2-60.5 s

Decode after long prompts was 33.0 tok/s with the default and 29.6 forced (−10%). So with the experts in RAM, chunk-major is the right default on this layer split too. That is one more machine for the picture @udqe and @fioruccione described above.

2. One small card: the small-card prompt path (fd59c9c3) runs by default, and it is faster. I used the same config with only the 3060 visible. The engine picks the path on its own (expert cache 884 slots, 2.57 GiB of VRAM):

small expert cache: the default prompt path would read in chunks of 4096 tokens (under 8192), so prompts read with the unfused experts and, from two chunks, the layer-major walk (chunk 4096 tokens)

The A/B is the default vs STRATA_PREFILL_LAYER_MAJOR=0. With =0 the line still says "read with the unfused experts (chunk 4096 tokens)", so the only difference between the arms is the walk. Both arms booted into the same tier: --ple-io ram, an expert arena of 71.7 GiB, 884 cache slots. One start per arm, temperature 0, no thinking:

Prompt tokens default (walk) STRATA_PREFILL_LAYER_MAJOR=0
3.8-4.0K (1 chunk) 8.65 / 9.24 s 8.64 / 9.26 s 0%
12.8K 25.35 s 28.60 s −11%
15.5K 28.42 s 33.41 s −15%
20.9K 39.90 s 45.51 s −12%
31.2K 57.44 s 66.81 s −14%
  • The walk ran on every prompt of two or more chunks. For example: layer-major (layers 0..48): 31232 tokens in 4 super-chunk(s) of up to 8192 (R in pinned RAM, 529 MiB VRAM free before), 90560 expert blobs streamed (283689.1 MB), 618 resident, 5787 expert groups (5787 on the FP16 path); 56404 ms. One-chunk prompts logged layer-major off for this prompt: a short prompt.
  • Every expert group went the FP16 path, and no layer guard refused a prompt.
  • The gain is smaller than in the commit message. The commit has −26% at 20K for a 12 GB 5070. Here it is −12% at 20.9K and −14% at 31K, on a slower card with a smaller cache.
  • Decode after long prompts did not change (19.1-23.1 vs 20.8-22.8 tok/s).
  • Correctness: a needle probe like the one @cedrik-fuoco used above. One sentence ("the password in this document is X") sits in the middle of a 15.5K / 31.6K-token document, asked for at temperature 0 and checked for presence. It was answered in 4/4 runs on the 3060 and 4/4 on the 5060 Ti. I ran STRATA_HC_Q8, not STRATA_HC_REQ8, so the #4715 combination was not tested. For what it is worth, in the 0.2.10 tree the three hyper-connection bf16_proj calls in lm_run pass cs (prefill.cpp 7359-7362). This is static reading only. The output text was not identical between the arms, and not even between two arms on the 5060 Ti that take the same path. That is why I used the needle and did not compare the text.
  • On #5104: this is a 512-expert pack, and none of the four single-card logs has a could not copy experts line. That fits @acmebiella-spec's note there that only the 256-expert Coder pack aborts.

5060 Ti alone does not meet the condition. Its auto cache is larger, and the default chunk stays at 8192. No small-card line is printed, and the default and =0 take the same time to within 0.1 s (31.2K: 46.19 / 46.21 s). That matches the 8,192 boundary in the commit message.

Not run:

  • other cards between 12 and 16 GB
  • STRATA_PF_SMALL=0
  • a machine short of RAM. My two-card --resident-budget-gib 38 arm still read the rest of the experts through the file cache, so it was not one.

Passed: all requests on the single-card runs answered, and the needle probe above.

Failed: none on the single-card runs. On the two-card layer split, --resident-budget-gib 38 with chunk-major lost 4 of 18 short requests to mtp: round capture: out of memory. That is a VRAM-tight config of mine, not the small-card path.

<!-- gh-comment-id:6642265346 --> @Norhiro commented on GitHub (Nov 4, 2026): Follow-up, now on my other box: the same RTX 3060 12 GB + RTX 5060 Ti 16 GB moved to an i7-7800X (125 GiB RAM, Fedora 44; 3060 on PCIe 3.0 x16, probe 12.3 GB/s; 5060 Ti on 3.0 x8). UD-Q4_K_XL, 0.2.10 (engine 0.1.56, source build), all 71.7 GiB of experts in RAM, same config as in my last comment (`--max-context 65536 --prefill auto --expert-cache auto --spec 4`, MTP, `STRATA_HC_Q8=1 STRATA_ROUTE_TAIL_SKIP=0`). **1. Two cards, layer split: same result as on the Xeon.** I compared 0.2.10's default (chunk-major) with layer-major forced (`STRATA_PREFILL_LAYER_MAJOR=1`, `--vram-reserve-mib 1500 --vram-reserve-later-mib 2600`, `STRATA_PREFILL_LM_R=host`). 3 rounds each, unique prompts: | Prompt tokens | default | layer-major forced | |---|---|---| | ~31K | 39.2-39.5 s | 44.3-44.9 s | | ~49K | 59.6-60.0 s | 60.2-60.5 s | Decode after long prompts was 33.0 tok/s with the default and 29.6 forced (−10%). So with the experts in RAM, chunk-major is the right default on this layer split too. That is one more machine for the picture @udqe and @fioruccione described above. **2. One small card: the small-card prompt path (fd59c9c3) runs by default, and it is faster.** I used the same config with only the 3060 visible. The engine picks the path on its own (`expert cache 884 slots, 2.57 GiB of VRAM`): ``` small expert cache: the default prompt path would read in chunks of 4096 tokens (under 8192), so prompts read with the unfused experts and, from two chunks, the layer-major walk (chunk 4096 tokens) ``` The A/B is the default vs `STRATA_PREFILL_LAYER_MAJOR=0`. With `=0` the line still says "read with the unfused experts (chunk 4096 tokens)", so the only difference between the arms is the walk. Both arms booted into the same tier: `--ple-io ram`, an expert arena of 71.7 GiB, 884 cache slots. One start per arm, temperature 0, no thinking: | Prompt tokens | default (walk) | `STRATA_PREFILL_LAYER_MAJOR=0` | | |---|---|---|---| | 3.8-4.0K (1 chunk) | 8.65 / 9.24 s | 8.64 / 9.26 s | 0% | | 12.8K | 25.35 s | 28.60 s | −11% | | 15.5K | 28.42 s | 33.41 s | −15% | | 20.9K | 39.90 s | 45.51 s | −12% | | 31.2K | 57.44 s | 66.81 s | −14% | - **The walk ran on every prompt of two or more chunks.** For example: `layer-major (layers 0..48): 31232 tokens in 4 super-chunk(s) of up to 8192 (R in pinned RAM, 529 MiB VRAM free before), 90560 expert blobs streamed (283689.1 MB), 618 resident, 5787 expert groups (5787 on the FP16 path); 56404 ms`. One-chunk prompts logged `layer-major off for this prompt: a short prompt`. - **Every expert group went the FP16 path, and no layer guard refused a prompt.** - **The gain is smaller than in the commit message.** The commit has −26% at 20K for a 12 GB 5070. Here it is −12% at 20.9K and −14% at 31K, on a slower card with a smaller cache. - **Decode after long prompts did not change** (19.1-23.1 vs 20.8-22.8 tok/s). - **Correctness: a needle probe like the one @cedrik-fuoco used above.** One sentence ("the password in this document is X") sits in the middle of a 15.5K / 31.6K-token document, asked for at temperature 0 and checked for presence. It was answered in 4/4 runs on the 3060 and 4/4 on the 5060 Ti. I ran `STRATA_HC_Q8`, not `STRATA_HC_REQ8`, so the #4715 combination was not tested. For what it is worth, in the 0.2.10 tree the three hyper-connection `bf16_proj` calls in `lm_run` pass `cs` (prefill.cpp 7359-7362). This is static reading only. The output text was not identical between the arms, and not even between two arms on the 5060 Ti that take the same path. That is why I used the needle and did not compare the text. - **On #5104:** this is a 512-expert pack, and none of the four single-card logs has a `could not copy experts` line. That fits @acmebiella-spec's note there that only the 256-expert Coder pack aborts. **5060 Ti alone does not meet the condition.** Its auto cache is larger, and the default chunk stays at 8192. No small-card line is printed, and the default and `=0` take the same time to within 0.1 s (31.2K: 46.19 / 46.21 s). That matches the 8,192 boundary in the commit message. Not run: - other cards between 12 and 16 GB - `STRATA_PF_SMALL=0` - a machine short of RAM. My two-card `--resident-budget-gib 38` arm still read the rest of the experts through the file cache, so it was not one. Passed: all requests on the single-card runs answered, and the needle probe above. Failed: none on the single-card runs. On the two-card layer split, `--resident-budget-gib 38` with chunk-major lost 4 of 18 short requests to `mtp: round capture: out of memory`. That is a VRAM-tight config of mine, not the small-card path.
Author
Owner

@fioruccione commented on GitHub (Nov 4, 2026):

@Norhiro thank you, this is the cleanest single-card data in the thread, and it matches what I saw this afternoon from the other side: with one card and all experts in RAM, prefill pays for the missing card (−25/−41% here at 20K/69K) and decode barely notices (−4%).

One thing your two boxes can show that nobody else here can: the same cards and the same UD-Q4_K_XL on an AVX-only Xeon and on an AVX-512 i7-7800X. Reading the CPU expert kernels I found that IQ4_XS has only an AVX2 kernel and falls back to ggml on AVX-512, and that Q4_K goes through the ggml dot. Details and a short list of what would help are in #4610 (https://github.com/Niko1221/Strata/issues/4610#issuecomment-6642881834), if you feel like it; no hurry at all.

<!-- gh-comment-id:6642883938 --> @fioruccione commented on GitHub (Nov 4, 2026): @Norhiro thank you, this is the cleanest single-card data in the thread, and it matches what I saw this afternoon from the other side: with one card and all experts in RAM, prefill pays for the missing card (−25/−41% here at 20K/69K) and decode barely notices (−4%). One thing your two boxes can show that nobody else here can: the same cards and the same UD-Q4_K_XL on an AVX-only Xeon and on an AVX-512 i7-7800X. Reading the CPU expert kernels I found that IQ4_XS has only an AVX2 kernel and falls back to ggml on AVX-512, and that Q4_K goes through the ggml dot. Details and a short list of what would help are in #4610 (https://github.com/Niko1221/Strata/issues/4610#issuecomment-6642881834), if you feel like it; no hurry at all.
Author
Owner

@fioruccione commented on GitHub (Nov 4, 2026):

@Norhiro please ignore my request above, it was wrong: Strata's AVX-512 gate also asks for VNNI and VBMI, so your i7-7800X runs the AVX-2 kernels and STRATA_FORCE_AVX2=1 would change nothing. I wrote the correction in #4610. Sorry, and thanks again for the single-card numbers.

<!-- gh-comment-id:6643268219 --> @fioruccione commented on GitHub (Nov 4, 2026): @Norhiro please ignore my request above, it was wrong: Strata's AVX-512 gate also asks for VNNI and VBMI, so your i7-7800X runs the AVX-2 kernels and `STRATA_FORCE_AVX2=1` would change nothing. I wrote the correction in #4610. Sorry, and thanks again for the single-card numbers.
Author
Owner

@Norhiro commented on GitHub (Nov 4, 2026):

@fioruccione no problem, thanks for checking the gate and for the quick correction.

<!-- gh-comment-id:6643343040 --> @Norhiro commented on GitHub (Nov 4, 2026): @fioruccione no problem, thanks for checking the gate and for the quick correction.
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#1705
No description provided.