[GH-ISSUE #1616] Auto layer assigns only 1 layer to card dropping prefill due to prompt-chunk clamp #646

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

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

Summary

On a 4-GPU rig (RTX 5060 Ti 16GB + RTX 3090 24GB + 2x RTX 3060 12GB, no NVLink), prompt processing for
Qwen3.8-Flash-Next IQ3_XXS fell from 576 tok/s (0.1.38) to ~347 tok/s (0.1.41). The dominant cause
is the prompt-chunk clamp (#448): layer_split: auto gives a 12 GB 3060 a single layer, which
holds only 512 expert-cache slots, and that card clamps the prompt chunk for every card in the
pipeline. A manual layer_split that stops any card owning one layer roughly doubles prefill — confirmed
347 → 826 tok/s (+138%) on this box.

The clamp, from the startup log

layer split: layers 0-1 (CUDA0 3060), 2 (CUDA1 3060), 3-19 (5060 Ti), 20-47+head (3090)
expert cache slots:  CUDA1 512 (0.89 GiB)   CUDA2 6442   CUDA3 9125
WARNING: prompt chunk 1280 tokens, not 1792: CUDA1 (RTX 3060) has 512 expert-cache slots,
  and a 1792-token chunk borrows 492 of them (it must keep 128, and lend at most 90%)
  - prompts read slower than on CUDA0 alone (#448)

A 12 GB card owning 1 of 48 layers clamps the chunk to 1280 for the whole pipeline. --prefill auto would
allow 8192; the layout only reaches 1280.

Evidence (matched harness, 3 runs x 3 reps, median; baseline = live config minus --vision)

arm change prefill tok/s vs baseline gen tok/s
A0 baseline (chunk 1280) 377.5 — 105.4
A2 3090+5060Ti only, no 1-layer stage (chunk 8192) 831.2 +120% 92.6
A4 A2 + STRATA_PF_FUSED=1 883.5 +134% 94.4
A5 keep 4 cards, manual split 4,8,24 (chunk 4864) 868.2 +130% 100.6

Workaround that fixed it (confirmed in production)

Keep all four cards but stop any card owning a single layer:

"gpu": [1, 3, 0, 2],
"layer_split": "4,8,24",
"env": { "STRATA_PF_FUSED": "1" }

Each 3060 now owns 4 layers (holds ~2048 slots instead of 512). After restart the engine reports
prompt chunk auto: 6144 (was 1280) and prompt experts on the fused int8 kernels (STRATA_PF_FUSED=1).
Measured on the live server: prefill 347 -> 826 tok/s (+138%), gen 109 -> 98. A residual clamp remains
(a 12 GB 3060 only has ~2048 slots, so an 8192-token chunk borrows 1938 of them and is trimmed to 6144),
but it is far weaker than the 1-layer case.

Things that did NOT help (so they can be ruled out)

  • --pcie-frac 0.20: +0.1% (noise) once the chunk is fixed. The earlier "+15%" only appeared at a small chunk.
  • --pipeline-windows 2: no gain over the 2-card baseline.
  • --prefill auto:32768 (chunk > 8192): no gain; 8192 is the ceiling.
  • GPU power caps: already measured as not the cause.

Questions for maintainers

  1. Should layer_split: auto avoid assigning a single layer to the smallest-VRAM card? That card then
    clamps the chunk for everyone; a manual split is strictly faster on this rig.

Environment

Engine 0.1.41, model Qwen3.8-Flash-Next IQ3_XXS, 262144 ctx, --kv q4_0. Rig: RTX 5060 Ti (PCIe x8),
RTX 3090 (x4), 2x RTX 3060 (x4). Related to #448.

Originally created by @tonydiep on GitHub (Oct 8, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/1616 # Summary On a 4-GPU rig (RTX 5060 Ti 16GB + RTX 3090 24GB + 2x RTX 3060 12GB, no NVLink), prompt processing for Qwen3.8-Flash-Next IQ3_XXS fell from **576 tok/s (0.1.38)** to **~347 tok/s (0.1.41)**. The dominant cause is the **prompt-chunk clamp (#448)**: `layer_split: auto` gives a 12 GB 3060 a **single layer**, which holds only **512 expert-cache slots**, and that card clamps the prompt chunk for every card in the pipeline. A manual `layer_split` that stops any card owning one layer roughly **doubles prefill** — confirmed **347 → 826 tok/s (+138%)** on this box. ## The clamp, from the startup log ``` layer split: layers 0-1 (CUDA0 3060), 2 (CUDA1 3060), 3-19 (5060 Ti), 20-47+head (3090) expert cache slots: CUDA1 512 (0.89 GiB) CUDA2 6442 CUDA3 9125 WARNING: prompt chunk 1280 tokens, not 1792: CUDA1 (RTX 3060) has 512 expert-cache slots, and a 1792-token chunk borrows 492 of them (it must keep 128, and lend at most 90%) - prompts read slower than on CUDA0 alone (#448) ``` A 12 GB card owning 1 of 48 layers clamps the chunk to 1280 for the whole pipeline. `--prefill auto` would allow 8192; the layout only reaches 1280. ## Evidence (matched harness, 3 runs x 3 reps, median; baseline = live config minus --vision) | arm | change | prefill tok/s | vs baseline | gen tok/s | | --- | --- | --- | --- | --- | | A0 | baseline (chunk 1280) | 377.5 | — | 105.4 | | A2 | 3090+5060Ti only, no 1-layer stage (chunk 8192) | 831.2 | +120% | 92.6 | | A4 | A2 + STRATA_PF_FUSED=1 | 883.5 | +134% | 94.4 | | A5 | keep 4 cards, manual split 4,8,24 (chunk 4864) | 868.2 | +130% | 100.6 | ## Workaround that fixed it (confirmed in production) Keep all four cards but stop any card owning a single layer: ```json "gpu": [1, 3, 0, 2], "layer_split": "4,8,24", "env": { "STRATA_PF_FUSED": "1" } ``` Each 3060 now owns 4 layers (holds ~2048 slots instead of 512). After restart the engine reports `prompt chunk auto: 6144` (was 1280) and `prompt experts on the fused int8 kernels (STRATA_PF_FUSED=1)`. Measured on the live server: **prefill 347 -> 826 tok/s (+138%)**, gen 109 -> 98. A residual clamp remains (a 12 GB 3060 only has ~2048 slots, so an 8192-token chunk borrows 1938 of them and is trimmed to 6144), but it is far weaker than the 1-layer case. ## Things that did NOT help (so they can be ruled out) - `--pcie-frac 0.20`: +0.1% (noise) once the chunk is fixed. The earlier "+15%" only appeared at a small chunk. - `--pipeline-windows 2`: no gain over the 2-card baseline. - `--prefill auto:32768` (chunk > 8192): no gain; 8192 is the ceiling. - GPU power caps: already measured as not the cause. ## Questions for maintainers 1. Should `layer_split: auto` avoid assigning a single layer to the smallest-VRAM card? That card then clamps the chunk for everyone; a manual split is strictly faster on this rig. ## Environment Engine 0.1.41, model Qwen3.8-Flash-Next IQ3_XXS, 262144 ctx, `--kv q4_0`. Rig: RTX 5060 Ti (PCIe x8), RTX 3090 (x4), 2x RTX 3060 (x4). Related to #448.
Author
Owner

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

Great analysis, and the numbers made this easy to act on. The auto layer split could pick a stage with one or two layers, and a 12 GB card with one layer holds ~512 slots, which clamped the prompt chunk for every card (#448). In v0.1.42 the auto split first takes its best placement as before; if that has a stage with fewer than 3 layers (and the model has the layers for it) it searches again among placements where every stage owns at least 3 layers, uses that one if any can start, and prints both choices and why ("would give a stage fewer than 3 layers ... chose K=... instead"). If none can start, the first pick stays and the log says so. Rigs whose pick has no such stage (identical cards, for example) are untouched. We could not run your 4-GPU rig, so please check the layer split line and the prompt chunk on yours; your manual 4,8,24 split remains valid.

<!-- gh-comment-id:6099635924 --> @Niko1221 commented on GitHub (Oct 10, 2026): Great analysis, and the numbers made this easy to act on. The auto layer split could pick a stage with one or two layers, and a 12 GB card with one layer holds ~512 slots, which clamped the prompt chunk for every card (#448). In v0.1.42 the auto split first takes its best placement as before; if that has a stage with fewer than 3 layers (and the model has the layers for it) it searches again among placements where every stage owns at least 3 layers, uses that one if any can start, and prints both choices and why ("would give a stage fewer than 3 layers ... chose K=... instead"). If none can start, the first pick stays and the log says so. Rigs whose pick has no such stage (identical cards, for example) are untouched. We could not run your 4-GPU rig, so please check the layer split line and the prompt chunk on yours; your manual 4,8,24 split remains valid.
Author
Owner

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

Thanks for sharing Strata. Really loving it!


Auto layer split on the 4-GPU rig — 0.1.42, measured

Rig: RTX 5060 Ti 16 GB (CUDA0) + RTX 3090 24 GB (CUDA3) + 2× RTX 3060 12 GB (CUDA1, CUDA2), no NVLink. Model Qwen3.8-Flash-Next, IQ3_XXS, 48 layers. Engine strata 0.1.42 (source v0.1.42-13-g01b1dfaf, built 2026-10-10 16:50). Config unchanged except "layer_split": "auto".

Baseline: what the clamp was

With auto on the pre-fix build the 12 GB cards landed on 512 expert-cache slots and every card's chunk was clamped to them:

strata generate: prompt chunk 768 tokens, not 8192: CUDA1 (NVIDIA GeForce RTX 3060) has 512 expert-cache slots, and a 8-slot ring

32 occurrences of that line in my log (plus 25 for CUDA2), against 22 runs on a manual split that reported CUDA1 ... has 2048 expert-cache slots and a 6144-token chunk.

Auto split on 0.1.42 — the rule fired

strata generate: layer split across 4 GPUs: CUDA0, then CUDA1,2,3 (split auto)
strata generate: layer split auto: CUDA0 28 SMs at 1.78 GHz -> 1.46 ms per layer, 7.43 GiB free before its session carve
strata generate: layer split auto: CUDA1 28 SMs at 1.84 GHz -> 1.41 ms per layer, 7.33 GiB free before its session carve
strata generate: layer split auto: CUDA2 36 SMs at 2.62 GHz -> 0.77 ms per layer, 9.90 GiB free before its session carve
strata generate: layer split auto: CUDA3 82 SMs at 1.75 GHz -> 0.50 ms per layer, 18.12 GiB free before its session carve
strata generate: layer split auto: K=2,3,20 would give a stage fewer than 3 layers (a tiny expert cache there clamps the prompt chunk of every card, #1616); chose K=3,6,22 instead (37.3 ms per decode window, not 36.9)
strata generate: layer split auto: K=3,6,22 - predicted 37.3 ms per decode window; the caches hold 18949 of 24576 profiled pairs (~98.3% of the routed mass), best of 24319 placements
strata generate: layer split auto: L2 probe: the split is startable on the live free figures
strata generate: layer split: CUDA1 runs layers 3-5, expert cache 1536 slots (2.19 GiB), 1536 of its 1536 profiled pairs; slot 0 verified
strata generate: layer split: CUDA2 runs layers 6-21, expert cache 6511 slots (9.03 GiB), 6511 of its 8192 profiled pairs; slot 0 verified
strata generate: layer split: CUDA3 runs layers 22-47, expert cache 9039 slots (16.31 GiB), 9039 of its 13312 profiled pairs; slot 0 verified
strata serve: layer split: 76% of the experts resident, the prompt path's streamed ring 96 slots
strata serve: WARNING: prompt chunk 4096 tokens, not 6144: CUDA1 (NVIDIA GeForce RTX 3060) has 1536 expert-cache slots, and a 6144-token chunk borrows 1462 of them (it must keep 128, and lend at most 90%) - prompts read slower than on CUDA0 alone (#448)
strata serve: prompt chunk auto: 4096 tokens, a 96-slot ring
strata serve:   CUDA2 prompt path borrows 1107 of its 6511 slots (1.54 GiB)
strata serve:   CUDA3 prompt path borrows 846 of its 9039 slots (1.54 GiB)
strata serve: layer split: layers 0-2 (CUDA0), 3-5 (CUDA1), 6-21 (CUDA2), 22-47 (CUDA3), one hand-off per window

Verdict

Fixed. Auto took K=2,3,20, rejected it for the tiny stage, and chose K=3,6,22. The prompt chunk went 768 → 4096 — 5.3× — for a predicted 37.3 ms vs 36.9 ms per decode window. That is a good trade, and the pathological clamp from my report is gone.

Not optimal on this rig, but good enough. A manual split still measures better here, and the only numbers that decide it are layers per card. Auto gives each 12 GB card 3 layers → 1536 slots → chunk 4096, 76% of experts resident. A manual split gives them 4 layers → 2048 slots → chunk 6144, 78% resident. The floor itself is what sets the clamp: a 3060 caches 512 slots per layer, so 3 layers is exactly 1536 slots, and 1536 caps the chunk at 4096.

(For reading the block above: under auto the engine stages the cards in its own order, so its CUDA indices are not the same cards as in my manual run — there CUDA2 is the 5060 Ti at 15.48 GiB with layers 6-21, and CUDA0 and CUDA1 are the two 3060s.)

<!-- gh-comment-id:6102714008 --> @tonydiep commented on GitHub (Oct 10, 2026): ### Thanks for sharing Strata. Really loving it! --- # Auto layer split on the 4-GPU rig — 0.1.42, measured **Rig:** RTX 5060 Ti 16 GB (CUDA0) + RTX 3090 24 GB (CUDA3) + 2× RTX 3060 12 GB (CUDA1, CUDA2), no NVLink. Model Qwen3.8-Flash-Next, IQ3_XXS, 48 layers. Engine `strata 0.1.42` (source `v0.1.42-13-g01b1dfaf`, built 2026-10-10 16:50). Config unchanged except `"layer_split": "auto"`. ## Baseline: what the clamp was With auto on the pre-fix build the 12 GB cards landed on 512 expert-cache slots and every card's chunk was clamped to them: ``` strata generate: prompt chunk 768 tokens, not 8192: CUDA1 (NVIDIA GeForce RTX 3060) has 512 expert-cache slots, and a 8-slot ring ``` 32 occurrences of that line in my log (plus 25 for CUDA2), against 22 runs on a manual split that reported `CUDA1 ... has 2048 expert-cache slots` and a 6144-token chunk. ## Auto split on 0.1.42 — the rule fired ``` strata generate: layer split across 4 GPUs: CUDA0, then CUDA1,2,3 (split auto) strata generate: layer split auto: CUDA0 28 SMs at 1.78 GHz -> 1.46 ms per layer, 7.43 GiB free before its session carve strata generate: layer split auto: CUDA1 28 SMs at 1.84 GHz -> 1.41 ms per layer, 7.33 GiB free before its session carve strata generate: layer split auto: CUDA2 36 SMs at 2.62 GHz -> 0.77 ms per layer, 9.90 GiB free before its session carve strata generate: layer split auto: CUDA3 82 SMs at 1.75 GHz -> 0.50 ms per layer, 18.12 GiB free before its session carve strata generate: layer split auto: K=2,3,20 would give a stage fewer than 3 layers (a tiny expert cache there clamps the prompt chunk of every card, #1616); chose K=3,6,22 instead (37.3 ms per decode window, not 36.9) strata generate: layer split auto: K=3,6,22 - predicted 37.3 ms per decode window; the caches hold 18949 of 24576 profiled pairs (~98.3% of the routed mass), best of 24319 placements strata generate: layer split auto: L2 probe: the split is startable on the live free figures strata generate: layer split: CUDA1 runs layers 3-5, expert cache 1536 slots (2.19 GiB), 1536 of its 1536 profiled pairs; slot 0 verified strata generate: layer split: CUDA2 runs layers 6-21, expert cache 6511 slots (9.03 GiB), 6511 of its 8192 profiled pairs; slot 0 verified strata generate: layer split: CUDA3 runs layers 22-47, expert cache 9039 slots (16.31 GiB), 9039 of its 13312 profiled pairs; slot 0 verified strata serve: layer split: 76% of the experts resident, the prompt path's streamed ring 96 slots strata serve: WARNING: prompt chunk 4096 tokens, not 6144: CUDA1 (NVIDIA GeForce RTX 3060) has 1536 expert-cache slots, and a 6144-token chunk borrows 1462 of them (it must keep 128, and lend at most 90%) - prompts read slower than on CUDA0 alone (#448) strata serve: prompt chunk auto: 4096 tokens, a 96-slot ring strata serve: CUDA2 prompt path borrows 1107 of its 6511 slots (1.54 GiB) strata serve: CUDA3 prompt path borrows 846 of its 9039 slots (1.54 GiB) strata serve: layer split: layers 0-2 (CUDA0), 3-5 (CUDA1), 6-21 (CUDA2), 22-47 (CUDA3), one hand-off per window ``` ## Verdict **Fixed.** Auto took `K=2,3,20`, rejected it for the tiny stage, and chose `K=3,6,22`. The prompt chunk went **768 → 4096** — 5.3× — for a predicted 37.3 ms vs 36.9 ms per decode window. That is a good trade, and the pathological clamp from my report is gone. **Not optimal on this rig, but good enough.** A manual split still measures better here, and the only numbers that decide it are layers per card. Auto gives each 12 GB card **3 layers** → 1536 slots → chunk **4096**, 76% of experts resident. A manual split gives them **4 layers** → 2048 slots → chunk **6144**, 78% resident. The floor itself is what sets the clamp: a 3060 caches 512 slots per layer, so 3 layers is exactly 1536 slots, and 1536 caps the chunk at 4096. (For reading the block above: under auto the engine stages the cards in its own order, so its CUDA indices are not the same cards as in my manual run — there CUDA2 is the 5060 Ti at 15.48 GiB with layers 6-21, and CUDA0 and CUDA1 are the two 3060s.)
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#646
No description provided.