mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4516] [Engine] expert cache never re-checks the --vram-reserve-mib contract: free VRAM falls below reserve mid-session, WDDM paging cuts prefill 53% #2030
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#2030
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 @ExtremeYu on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4516
[Engine] expert cache never re-checks the --vram-reserve-mib contract: free VRAM falls below reserve mid-session, WDDM paging cuts prefill 53%
Problem:
On a fully resident layer-split-less setup (single 12 GB card), the engine sizes the expert cache once at startup against
--vram-reserve-miband never re-checks whether the actual free VRAM stays above that contract. During a long session the actual free VRAM drifts below the contract (driver reservations +--vram-elasticgrowth filling freed VRAM), the WDDM page manager starts paging engine allocations (including expert-cache pages) to system RAM, and prefill throughput drops 53% on identical requests. The engine never detects or recovers: the paging is invisible to CUDA applications (allocations stay valid, no eviction API), and the elastic cache grows to fill freed VRAM but does not shrink back when the headroom is gone.Environment:
strata-engine-0.1.52-windows-x86_64-cuda-cuda12.tar.gzfrom the v0.2.7 release)--max-context 262144 --kv int8 --kv-resident 32768 --spec 5 --spec-min-p 0.6 --mtp --vram-elasticReproduce:
--vram-reserve-mib 0.max_tokens=50, non-streaming) and time it: prefill ≈ 843 tok/s;nvidia-smishows ~0–496 MiB free during the request.--vram-reserve-mib 1024(cache 1912–2015 slots).(Same request body file reused for both runs; single variable = the reserve. Full request/response captured via an API tap.)
Expected:
--vram-reserve-mibis documented as VRAM kept free for transient allocations (verify-window captures, prompt-path borrows, driver variance). The engine keeps actual free VRAM at/above this contract for the life of the process, or re-adjusts the cache when the contract would be breached.Actual:
LOW ... add --vram-reserve-mib 758), elastic cache then grew 2180 → 2437 slots filling the freed space, and free VRAM hit 0 MiB mid-session (0 MiB of VRAM free with everything loaded - LOW).Mechanism (suspected path, static analysis — not directly measured):
VidMm pages engine allocations to system RAM when the card is full; CUDA applications get no eviction signal, so the engine cannot distinguish "cache is paged" from other slowness. The engine's own warning at #2065 documents the same mechanism ("when the card is this full the driver can page GPU memory to system RAM, decode falls to a few tok/s"). The catastrophic variant (prefill 3.5–15 tok/s for minutes) was observed at even lower free VRAM in earlier sessions.
Evidence:
expert cache 2180 slots, 4.19 GiB→254 MiB of VRAM free - LOW: add --vram-reserve-mib 758→expert cache 2437 slots, 4.68 GiB→0 MiB of VRAM free - LOW: add 512→ live:cache 2081/2437, 288 MiB free now0 MiB of VRAM free ... 496 MiB free (nvidia-smi)during a 17,155-token prefill at 843 tok/s.Feature request (concrete user need + current workaround):
12 GB-class cards run best with a nonzero reserve, but the correct value depends on how much VidMm reserves for itself and how much the session grows — neither is visible at startup. Users currently hand-tune the reserve per card (my sweep above). The engine could enforce the promised floor itself, either by:
cudaMemGetInfoevery N seconds; if actual free <reserve / 2(or a new--vram-reserve-min), shrink the expert cache by ~512 MiB once, log it, and stand down. Cost: one cache re-population, vs running indefinitely in the paging regime.cudaMemPoolmarked low-eviction-priority and transient buffers high-priority, so VidMm pages transient pages before touching cache pages.Both keep the existing reserve semantics; the new mechanism only enforces the floor the contract promised.
Workaround in use:
--vram-reserve-mib 1024on a 12 GB card (see the sweep above). Multi-hour session with this reserve stayed above the floor — but a fixed floor enforcement in the engine would remove the need for manual per-card tuning.@github-actions[bot] commented on GitHub (Oct 28, 2026):
Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:
Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment
/reopen.Details: CONTRIBUTING.md
@github-actions[bot] commented on GitHub (Oct 28, 2026):
Thanks, this follows the format now.
@udqe commented on GitHub (Oct 28, 2026):
Support from the right side of your cliff, plus confirmation that the drift exists even when paging has never bitten (2x RTX 4090, Windows WDDM, engine 0.1.52, layer split,
--vram-reserve-mib 1728 --vram-reserve-later-mib 972):layer-major off for this prompt: layers 22..48: no VRAM for a super-chunk (734 MiB free)(our log, mechanism cross-checked in #3976). After such a prompt the expert cache is never re-priced - exactly the gap in your report.So +1 on both of your directions: (a) a periodic contract re-check is what would turn silent paging (your 53% cliff) into a visible cache shrink; (b) the card that actually dips is often the later one (1,143 steady vs 1,214 here, dipping to 734 in the line above), so one global reserve number is the wrong shape - also +1 for per-card reserves (#2522).
(AI-assisted - measurements and log analysis by the Qwen3.8-Flash-Next UD-Q4_K_XL this repo's engine 0.1.52 serves; numbers measured locally.)
@Niko1221 commented on GitHub (Nov 5, 2026):
Thanks for taking the time to report this.
Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.