mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #2065] Engine hangs at layer 48 during decode when VRAM headroom drops below ~500 MiB #824
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#824
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 @bang-imvt on GitHub (Oct 12, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2065
Summary
Engine reproducibly hangs during decode with
--batch 2+ 262144 context on asingle RTX 4090 D (24 GB). Two occurrences on 2026-10-12, both caught by the #29
watchdog ("no progress for 60 s during a request (decode -1)"), both leaving
thread-stack dumps.
Environment
strata.exe --serve --pack ... --expert-cache auto --prefill auto:8192
--spec 4 --spec-min-p 0.5 --mtp ... --max-context 262144 --kv int8
--kv-resident 32768 --vram-reserve-mib 1021 --batch-mtp --batch 2
Symptoms
Both stalls are identical:
Key finding: VRAM exhaustion
Startup leaves very little headroom:
strata serve: 538 MiB of VRAM free with everything loaded
strata verify: capturing the 4-token window (500 MiB of VRAM free)
strata verify: capturing the 1-token window (477 MiB of VRAM free)
strata verify: capturing the 3-token window (462 MiB of VRAM free)
strata verify: capturing the 2-token window (422 MiB of VRAM free)
strata verify: capturing the 6-token window (413 MiB of VRAM free)
strata verify: capturing the 5-token window (395 MiB of VRAM free)
Decode speed collapses right before each hang:
60,902 tok prompt -> 82.0 tok/s
66,375 tok prompt -> 90.9 tok/s
70,118 tok prompt -> 3.3 tok/s <- collapse
70,494 tok prompt -> 6.0 tok/s <- then hang
Dumps
(I can attach both.)
Suspected cause
VRAM headroom hitting ~400 MiB prevents the GPU from completing a kernel at
layer 48; the host and CPU expert pool are both fully idle while waiting.
Question
Would you recommend raising --vram-reserve-mib and/or dropping to --batch 1, or
is there a known issue with layer 48 under low VRAM?
strata-stall-60340.dmp
strata-stall-64352.dmp
@Niko1221 commented on GitHub (Oct 12, 2026):
Thank you, the VRAM trend in your log is the key. I read both dumps against the 0.1.41 strata.exe: the main thread is spinning in the MTP drafter, waiting for the first draft token of the round (
MtpDrafter::draft), i.e. the GPU did not finish the MTP round graph in 60 s. The expert pool is idle (288/288 done), so it is not the CPU side. Thehost at layer step 48; the GPU rang 48line is the last verify window, which had finished; it is not where the engine is waiting.Your suspicion is right in spirit. With ~400 MiB free the card is in the shape docs/DETAILS.md describes for WDDM (the driver pages GPU memory to system RAM instead of failing): the collapse from 91 to 3.3 tok/s at 70K is the tell, and then one round takes so long that the watchdog fires. The 538 MiB at
everything loadedis read before the verify windows are captured, each capture and each--batchlayout takes more (your 538 -> 395), so the engine's own LOW warning (below 256 MiB) never appeared. I cannot reproduce WDDM paging on my Linux boxes, so this is the mechanism that fits, not a proof.Please try:
--vram-reserve-mib 1500(keeps about 1.2 GB free after the captures, costs a few hundred expert slots) and/or--batch 1; settingCUDA - Sysmem Fallback PolicytoPrefer No Sysmem Fallbackfor strata.exe in the NVIDIA control panel makes an over-full card fail with an error instead of crawling, which would confirm it. If it still stalls with more than 1 GB free, that is a different bug and the next dump is worth a lot.On the fix branch (not released): every request re-reads the free VRAM and warns under 1 GiB on Windows (512 MiB elsewhere) with the
--vram-reserve-mibthat would leave room, the stall report prints the figure, and the stage is nowmtp draft: waiting for the GPUinstead ofdecode. It only says it; nothing is capped or refused.@Spinoza0 commented on GitHub (Nov 4, 2026):
Same condition on Apple Silicon, with a second outcome I have not seen described anywhere: not only the stall, but an abort in the conversation-parking path.
Hardware and config: Apple M4 Pro 48 GB, macOS 27.0.1, Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS,
--max-context 262144 --expert-cache 64 --vram-reserve-mib 1024; the engine reports "0 MiB of VRAM free with everything loaded".1. The stall you describe — reproduced:
tools/batch_interleave_test.pywedged in a batch window, "no progress for 60 s during a request", stall report stage "idle -1", verify window "the GPU rang 0", 13 of 13 pool workers parked, aggregate decode 5-6 tok/s instead of the usual 20-26.2. The abort — the engine died inside the conversation cache, not in a kernel:
strata metal runtime: a copy touches a device allocation of 7043.4 MB that was given back (STRATA_METAL_KEEP_HOST_WEIGHTS=1 keeps it), thenstd::abort()incheck_purged(metal/src/gpu/runtime.cpp:261), reached fromcopy_nonblocking→conversation_kv_save→conversation_snapshot_save. The allocation is given back bystream_arena(metal/src/engine/window.cpp:1583), which marks every device allocation of 32 MB or more purgeable-empty at the first request. Parkings before the crash had succeeded (parked=4, evictions=7), so which park aborts depends on which allocation it touches - the copy that reads a device allocation after it was given back is what the guard reports.With the reserve this issue recommends (1536 MiB, passed through
--extra, the test itself runs--batch 3), the same battery passes whole: 10/10 IDENTICAL.Nothing here is related to the IQ1_M kernel instantiations in #4886, which is what this engine is running - the crash path is host code. If the parking/purge race belongs in a separate issue, say so and I'll move it there.
@Retarel commented on GitHub (Nov 4, 2026):
A data point for the warning that cites this issue, on the current release: Strata 0.2.10 / engine 0.1.56 (
windows-x86_64-cuda-cuda13), one RTX 5080 16 GB under WDDM (it also drives the display), Windows 11, driver 617.42. Settings: single request,--expert-cache auto, no--vram-reserve-mib, so the default 700 MiB.On defaults, the engine warns about its own sizing. Every run without a reserve printed
WARNING: only N MiB of VRAM free at the start of this request (below 1024 MiB) ... Add --vram-reserve-mib 1472. That covers 9 runs of a hand-made config, 38 requests each (standard-v1 plus a short Russian probe), and 3 starts of a setup-made preset:--kv-resident 32768, MTP or DFlash2expert cache auto: 10.23 GiB free, 700 MiB reserved (+106 MiB for the draft head, +256 MiB for what is allocated after the cache) -> 4533 slotsqwen-128kpreset (Unsloth UD-IQ4_XS, DFlash2 Auto)8.86 GiB free, 700 MiB reserved (+283 MiB for the draft head, +256 MiB for what is allocated after the cache) -> 2357 slotsAt start the engine also prints
the prompt path borrows 1859 CUDA0 cache slots (3.77 GiB)andthat is little room for the verify windows' buffers under WDDM.What I did not see: a stall, or decode falling after a warning. Every warned request decoded at its normal speed. These were short runs (prompts up to 16K, up to 700 generated tokens), so this says nothing about long sessions.
With the reserve the warning asks for (
--vram-reserve-mib 1472): 4161 slots instead of 4533, zero warnings in 5 runs (190 requests), and decode −0 to −4 % against the no-reserve runs (pooled medians, Russian and English cases).An older engine, the same preset: engine 0.1.48 starts of the same
qwen-128kpreset, from 2026-10-25/26, show free VRAM at request start of 0, 58 and 72 MiB. Those requests had 593, 43,210 and 35,076-token prompts and still decoded at 56, 74 and 86 tok/s. So the+256 MiB for what is allocated after the cacheterm in 0.1.56 made a visible difference.Question. The auto sizing's default reserve (700 MiB) sits below the warning's own 1024 MiB threshold, so a default start on a 16 GB WDDM card warns about what it chose itself. Should the auto expert cache on Windows keep the headroom the warning asks for (it cost 0–4 % here)? Or, if a few hundred MiB is fine in practice on 0.1.56, should the threshold come down so the warning keeps its meaning?