mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1353] stager-transient-regression #547
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#547
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dag08 on GitHub (Oct 7, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1353
Prefill: the "transient source" heuristic makes RAM-resident Q8 prefill 4-7x slower
First bad commit:
361537b— "prefill: UD-Q4_K_XL prompts 2.8x faster (16K: 57 -> 160 tok/s on an RTX 5070) - 32 stager threads and a 128-deep ring when the experts are read from the GGUF in place; MMQ for its Q4_K / Q5_K / Q5_1 experts".The heuristic is still in
v0.1.40.1(src/prefill/prefill.cpp:861-862, unchanged).Environment
qwen38-q8_0plus the nativeQ8_0-0000x-of-00006.ggufshards--resident-budget-gib 240 --expert-cache 1944 --prefill auto --kv int8 --kv-resident 32768 --max-context 262144The experts are pinned in system RAM (
--resident-budget-gib 240), not read from the SSD during prefill.Symptom
A 128k-token prompt (123,885 tokens) on a fully warm page cache:
v0.1.31v0.1.32v0.1.33v0.1.34v0.1.37v0.1.40.1Every run: same machine, same model, same prompt, same seed (707), page cache preloaded with
vmtouch -tbefore each start, KV streaming and expert-cache hit rates identical (78.01% / 35-38%). Only the engine binary differs.Bisection
git bisectin a detached worktree,v0.1.31good /v0.1.32bad, one variable at a time (each candidate built with-DSTRATA_ENABLE_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=120, measured with the same warm-cache harness):505e5e9ee1e18e5ba8c5bdocs/DETAILS.md,docs/UNSLOTH_Q4.md)d058fdesetup.py, docs, tests)361537b5080b92d434c02v0.1.32)361537bis the first bad commit.Mechanism
The commit adds this to
prefill.cpp(identical inv0.1.40.1, lines 861-862):The comment states the intent: "most of a chunk's blobs are page faults on the SSD, so the copies need many reads in flight". That is right for the target case — Unsloth's UD-Q4_K_XL read in place beyond its RAM budget.
The check, however, only asks whether an expert source is
transient(), never where the bytes come from. Our Q8 setup answerstransient() == truewhile every blob is already pinned in RAM. It therefore gets the SSD profile — 32 copy threads and a 128-deep ring — and on this machine that is 4x slower than the 4-thread / 16-deep default the same commit keeps "for every other source".A second, smaller effect points the same way:
ring_slots()chose 384 slots inv0.1.31(g_pinned_share >= 0.9 ? 384 : 96) and picks 1024 inv0.1.37+(fused_ring() ? 1024 : 384). The 1024 ring is sized for the fused Q2_0 layouts, not for a Q8 pack.Verified workaround (no rebuild)
All three switches already exist in
v0.1.37andv0.1.40.1. Restoring thev0.1.31values on the same engine binary:STRATA_STAGER_THREADS=4STRATA_STAGER_RING=16+ STRATA_PREFILL_RING=384v0.1.37v0.1.40.1v0.1.37with the three variables reachesv0.1.31level (412.8 against 390-427 tok/s), 128k in 5.0 min instead of 38.3 min.Ruled out as the cause, each measured on
v0.1.37with the stager fix in place:--pcie-frac 0.29(the valuev0.1.31's probe derived): 355.9 — no change.STRATA_HC_SPLIT=0(staged hyper-connection off): 360.3 — no change.Proposed patch (not built, not measured — a suggestion)
The heuristic should ask where the bytes come from, not only whether the source is transient.
g_pinned_shareis already available at that point in the file:This keeps the UD-Q4_K_XL in-place path untouched for the machines it was written for. We have not compiled or benchmarked it — the numbers above are from the existing environment variables, which is what we run in production today.
Secondary finding
With the workaround applied,
v0.1.40.1still runs about 15% behindv0.1.37(350.3 against 412.8 tok/s) on this model and prompt. That gap is independent of the stager and is a separate, much smaller regression somewhere betweenv0.1.37andv0.1.40.1; we have not bisected it.How to reproduce
--resident-budget-gib 240 --expert-cache 1944 --prefill auto --kv int8 --kv-resident 32768.vmtouch -t <files>) so the measurement does not include SSD reads.max_tokens: 1, and readprompt eval count/prompt eval durationfrom the usage block.v0.1.31with any engine fromv0.1.32up; then re-run the newer engine withSTRATA_STAGER_THREADS=4 STRATA_STAGER_RING=16 STRATA_PREFILL_RING=384.stager-transient-fix.patch
@Niko1221 commented on GitHub (Oct 8, 2026):
Thank you for the bisect. In 0.1.41 the prompt reader checks, with
mincore, whether the GGUF experts it reads in place are in the page cache; at 90% or more it takes the RAM profile (4 threads, ring of 16) instead of the 32-thread, 128-deep SSD one.STRATA_STAGER_SSD=0/1forces either profile. On Windows and other systems where the engine cannot tell, it behaves as before. We have not measured it on a machine with as much RAM as yours, so could you run the 128K prompt on 0.1.41 and on 0.1.40.1 and post the prefill tok/s?@dag08 commented on GitHub (Oct 9, 2026):
Re: #1353 — measured on a big-RAM box (RTX 5090, 376 GiB, Linux)
You asked us to run the 128K prompt on 0.1.41 and 0.1.40.1 and post the prefill tok/s. Here they are. The headline is good — 0.1.41 closes our 7x regression. The A/B also shows that on a box that pins its experts, the
mincoreswitch does not fire, and that is fine.Setup
qwen38-q8_0+ nativeQ8_0-0000x-of-00006.gguf--resident-budget-gib 240 --expert-cache 1944 --prefill auto --kv int8 --kv-resident 32768 --max-context 262144The experts are pinned in system RAM (
--resident-budget-gib 240): the engine logsRAM budget 240.00 GiB: 22632 of the 110.08 GiB of experts the GPU cache does not hold, by profile rank; the rest are read from the files. Sotransient()is true while most blobs are pinned — the #1353 case, with one twist below.Method, identical for every run: page cache preloaded with
vmtouch -tbefore each start, one 123,885-token prompt, seed 707,max_tokens: 1, KV streaming and expert-cache hit rates identical (77.6-78.0% / 35.9-38.0%). Engines built locally withcmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_ARCHITECTURES=120 -DSTRATA_ENABLE_CUDA=ON, targetstrata.Results
STRATA_STAGER_SSD=1(forced 32 threads, ring 128, batch 8)STRATA_STAGER_SSD=1 STRATA_STAGER_BATCH=1(32 threads, ring 128, one blob per request)0.1.41 fixes it: 108.9 → 774.6 tok/s, factor 7.1, 128K in 2.7 minutes.
The twist: on a pinned-RAM box the mincore switch does not fire
In the 0.1.41 auto run the engine printed no
prefill: the GGUF experts are …% in the page cache; the stager takes the RAM profileline. Somincoredid not report ≥ 90% resident, and auto took the SSD profile (32 threads, ring 128) — the same profile asSTRATA_STAGER_SSD=1, and it was fast (774.6 against 775.3).We think the reason is the pinning:
mincorereports page-cache residency, but our experts are pinned in RAM (--resident-budget-gib 240), not sitting in the page cache. A pinned anonymous buffer is not a page-cache mapping, so the sample reads low and the switch stays off. (Ourvmtouch -tpreload warms the page cache for the file-read experts, not for the pinned ones.)What this means for the fix
mincoreRAM-profile switch did not fire on our box, because we pin the experts rather than read them through the page cache. That is not a problem here — 0.1.41 is fast on the SSD profile too — but it is a case worth knowing: a box that pins its experts (a big--resident-budget-gib) will not trip the auto switch, since pinned RAM is not page-cache residency.@qni-live commented on GitHub (Oct 10, 2026):
Another data point, from the opposite regime: all experts VRAM-resident.
Linux, 2x RTX PRO 4500 (32 GB each), all experts in VRAM (24,576 of 24,576), 61 GiB RAM, Swift IQ3_XXS. 128k prompt (120,608 tokens),
max_tokens256, cold prompt, 3 runs: v0.1.40.1 6,142 tok/s (6,139-6,152), v0.1.41 6,148 and 6,146 tok/s.No change, which I expected: with every expert in VRAM I believe the new page-cache check does not come into play. Not tested:
STRATA_STAGER_SSD, or any setup that reads experts from the GGUF or a RAM copy. The full run (4k to 248k, both versions) is in #1834.Written with AI assistance (Claude); numbers reviewed by me.
@Niko1221 commented on GitHub (Oct 13, 2026):
Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.
If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.