[GH-ISSUE #2065] Engine hangs at layer 48 during decode when VRAM headroom drops below ~500 MiB #824

Open
opened 2026-11-04 01:46:14 +07:00 by bsakaguchi · 3 comments
Owner

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 a
single 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

  • Engine: 0.1.41
  • GPU: RTX 4090 D 24 GB (driver 591.74)
  • RAM: 256 GB
  • Model: Qwen3.8-Flash-Next IQ3_S
  • Command:
    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:

  • stage "decode -1" for 60 s
  • host idle for ~60 s
  • expert pool: 288/288 jobs done, 95/95 workers sleeping
  • verify window: 4 tokens, host at layer step 48; the GPU rang 48
  • memory: ~34-55 GiB resident, ~108 GiB RAM available (RAM is NOT the issue)

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

  • strata-stall-64352.dmp (795 KB, 09:43)
  • strata-stall-60340.dmp (791 KB, 14:48)

(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

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 a single 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 - Engine: 0.1.41 - GPU: RTX 4090 D 24 GB (driver 591.74) - RAM: 256 GB - Model: Qwen3.8-Flash-Next IQ3_S - Command: 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: - stage "decode -1" for 60 s - host idle for ~60 s - expert pool: 288/288 jobs done, 95/95 workers sleeping - verify window: 4 tokens, host at layer step 48; the GPU rang 48 - memory: ~34-55 GiB resident, ~108 GiB RAM available (RAM is NOT the issue) ## 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 - strata-stall-64352.dmp (795 KB, 09:43) - strata-stall-60340.dmp (791 KB, 14:48) (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](https://github.com/user-attachments/files/33325088/strata-stall-60340.dmp) [strata-stall-64352.dmp](https://github.com/user-attachments/files/33325089/strata-stall-64352.dmp)
Author
Owner

@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. The host at layer step 48; the GPU rang 48 line 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 loaded is read before the verify windows are captured, each capture and each --batch layout 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; setting CUDA - Sysmem Fallback Policy to Prefer No Sysmem Fallback for 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-mib that would leave room, the stall report prints the figure, and the stage is now mtp draft: waiting for the GPU instead of decode. It only says it; nothing is capped or refused.

<!-- gh-comment-id:6129345135 --> @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. The `host at layer step 48; the GPU rang 48` line 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 loaded` is read before the verify windows are captured, each capture and each `--batch` layout 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`; setting `CUDA - Sysmem Fallback Policy` to `Prefer No Sysmem Fallback` for 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-mib` that would leave room, the stall report prints the figure, and the stage is now `mtp draft: waiting for the GPU` instead of `decode`. It only says it; nothing is capped or refused.
Author
Owner

@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.py wedged 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), then std::abort() in check_purged (metal/src/gpu/runtime.cpp:261), reached from copy_nonblocking → conversation_kv_save → conversation_snapshot_save. The allocation is given back by stream_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.

<!-- gh-comment-id:6636109712 --> @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.py` wedged 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)`, then `std::abort()` in `check_purged` (`metal/src/gpu/runtime.cpp:261`), reached from `copy_nonblocking` → `conversation_kv_save` → `conversation_snapshot_save`. The allocation is given back by `stream_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.
Author
Owner

@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:

Config Start line Warnings Lowest free at request start
OrcaRouter IQ3_XXS (hand-made run config), 128K, --kv-resident 32768, MTP or DFlash2 expert 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 slots 17 in 9 runs (1–2 per run) 279 MiB
setup-made qwen-128k preset (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 slots 5 in 3 starts 408 MiB

At start the engine also prints the prompt path borrows 1859 CUDA0 cache slots (3.77 GiB) and that 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-128k preset, 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 cache term 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?

<!-- gh-comment-id:6637052858 --> @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: | Config | Start line | Warnings | Lowest free at request start | |---|---|---|---| | OrcaRouter IQ3_XXS (hand-made run config), 128K, `--kv-resident 32768`, MTP or DFlash2 | `expert 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 slots` | 17 in 9 runs (1–2 per run) | 279 MiB | | setup-made `qwen-128k` preset (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 slots` | 5 in 3 starts | 408 MiB | At start the engine also prints `the prompt path borrows 1859 CUDA0 cache slots (3.77 GiB)` and `that 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-128k` preset, 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 cache` term 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?
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#824
No description provided.