fix(gpu): P0 stability fixes for 8 GiB VRAM cards (RTX 3060 Ti) #2929
Closed
github-bot
wants to merge 4 commits from
github-bot/gh-2929 into main
AGit
pull from: github-bot/gh-2929
merge into: github:main
github:main
github:perf/darner-title-priority-ceiling
github:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
github:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
github:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
github:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
github:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
github:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github:fix/runtime-test-conservative-fixtures
github:ci/shard-semantic-linux
github:docs/fg-limit-fps-switch
github:fix/runtime-test-fixture-paths
github:fix/runtime-test-fixture-readers
github:fix/read-file-hard-link
github:fix/book-slot-heap-never-read
github:fix/depth-resolve-spv-path
github:fix/indirect-unused-batched
github:gh-pr/3358/base
github:fix/xmem-refusal-diagnostics
github:gh-pr/3357/base
github:ci/shorten-ci-time
github:fix/alias-later-queued-submissions
github:claude/gallant-sagan-aamatr
github:gh-pr/3342/base
github:gh-pr/3341/base
github:d3d12/agility-sdk-621
github:gh-pr/3293/base
github:gh-pr/3319/base
github:gh-pr/3318/base
github:gh-pr/3315/base
github:gh-pr/3313/base
github:gh-pr/3314/base
github:claude/fervent-curie-m19lnr
github:gh-pr/3216/base
github:gh-pr/3272/base
github:gh-pr/3276/base
github:gh-pr/3279/base
github:gh-pr/3257/base
github:gh-pr/3258/base
github:gh-pr/3271/base
github:codex/skip-no-hit-ray-passes
github:gh-pr/3230/base
github:gh-pr/3266/base
github:gh-pr/3247/base
github:gh-pr/3246/base
github:gh-pr/3244/base
github:claude/sharp-sagan-1jqnp3
github:t3/preserve-fsr-sdk-restart-path
github:t3/propagate-host-failure-hresult
github:t3/launcher-custom-parameters
github:t3/series-x-2160-startup
github:codex/d3d12-uncapped-simulation
github:ci/less-to-run
github:perf/native-compute-shader-forms
github:claude/blissful-franklin-ukp7ag
github:codex/full-precompile-default
github:gh-pr/3166/base
github:gh-pr/3148/base
github:gh-pr/3138/base
github:gh-pr/3106/base
github:gh-pr/3057/base
github:gh-pr/2756/base
github:gh-pr/2812/base
github:gh-pr/3032/base
github:gh-pr/2992/base
github:notes/card-time-and-plant-flicker
github:gh-pr/2986/base
github:gh-pr/3000/base
github:gh-pr/2966/base
github:gh-pr/2924/base
github:gh-pr/726/base
github:gh-pr/2761/base
github:gh-pr/2663/base
github:gh-pr/2861/base
github:gh-pr/2862/base
github:gh-pr/2820/base
github:gh-pr/2811/base
github:gh-pr/2803/base
github:rt-call-trace
github:gh-pr/2802/base
github:gh-pr/2766/base
github:perf/ahead-split
github:gh-pr/2589/base
github:gh-pr/2699/base
github:gh-pr/2696/base
github:docs/readme-runtime-proposal
github:gh-pr/1346/base
github:codex/coord-claim-check-20261124-7e48
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
area: ci
.github/ workflows and settings
area: d3d12
The D3D12 runtime in d3d12/ (Rust: leonida.exe and its crates)
area: docs
Documentation
area: launcher
The launcher (launcher/)
area: runtime (legacy)
The earlier Vulkan runtime in runtime/
area: shader translator
The shader translator (leonida-shader, tools/rdna2spirv) and its tests
area: tools
tools/ and scripts/
area: viewer
The map viewer (viewer/)
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs in-game run
Changes the code a frame runs through: needs the 300 s in-game gate (docs/game_gate.md)
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
wontfix
This will not be worked on
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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
github/ubiquitarianism--leonida!2929
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2929"
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?
@xVegetax on GitHub · 2026-12-01 19:18 UTC · original
xVegetax:fix/vram-block-guard-8gb→main· +83 −11 · 3 files · 4 commits · closed without mergingClaimed in the coordination issue as: n/a
Depends on: none
Fixes: none
What and why
P0.1 — VRAM guard (
pool.rs): refuse new 64 MiB texture heaps whenused + BLOCK > budget × 95%. Prevents over-budget MakeResident delays(up to 961 ms) and device losses on 8 GiB cards at ~7–9 min.
Configurable via
LEONIDA_VRAM_GUARD_PCT(80–99, default 95).P0.2 — Pipeline stack (
pipeline/make.rs): give each pipeline worker64 MiB stack instead of OS default 2 MiB.
nvgpucomp64.dlloverflowsat ~7 min on Ampere/Wave32 (RTX 3060 Ti). Matches upstream PR #2588.
Configurable via
LEONIDA_PIPELINE_STACK_MIB(2–256, default 64).Tested
GPUs tested: NVIDIA RTX 3060 Ti, 8 GiB VRAM, Windows 11
AI-assisted: yes
Checklist
mainand merges cleanlydocs/design.md, with how it was confirmed.@KelboLive on GitHub · 2026-12-01 19:46 UTC · original · requested changes
Two P0s, two different problems, and neither one does what the title says on its own.
P0.2 (pipeline stack) duplicates open #2588, which already gives pipeline workers a 64 MiB stack and adds a
GetCurrentThreadStackLimitstest plus a Wine guard. Please drop this half and land #2588 instead — 18 workers × 64 MiB is ~1.1 GiB committed under Wine, which is exactly what #2588's guard avoids.P0.1 (VRAM guard) does not cap VRAM. A refused block falls straight through to a per-texture committed allocation of the same resource (
pool.rs:896-898→resource.rs:3329, via the miss at:3294-3306), so the bytes are still spent and peak is unchanged — only the allocation path changes. Worse,VRAM_USEDis written only inroom()(pool.rs:50-52), called once a second fromsweep()(host.rs:518-532), and is not incremented when a block is approved: between samples the guard re-approves against the same stale value, so one interval can create many 64 MiB blocks past 95 %. Staging (pool.rs:676),small, shadow/targets and buffers are ungated entirely. AndLEONIDA_SWEEP=0or a failed DXGI query leavesVRAM_BUDGET == 0, silently disabling it.Neither change targets the failure mode we measured on this machine: the device removal is a driver-requested adapter PnP stop, not memory exhaustion —
LEONIDA_D3D12_BACKGROUND=0roughly doubles survival, while a 95 % threshold and a bigger thread stack do not address it. That does not mean the PR is wrong, but "P0 stability fixes for 8 GiB cards" needs an A/B run (or logs) showing which failure it removes; the 7–9 minute result is one card and two confounded changes.Two concrete gaps:
vram_block_refused: disabling its decision leaves all 17 pool tests green. A pure threshold test (likespares()) would pin it.d3d12/docs/switches.mdwas not regenerated:tools/d3d12_switches.py --checkreportsLEONIDA_PIPELINE_STACK_MIBandLEONIDA_VRAM_GUARD_PCTmissing. Run--outbefore merge.No image-quality risk in the fallback (identical
D3D12_RESOURCE_DESC), and larger cards are safe; the real cost is that a card legitimately near budget abandons the pool it exists to use, withgrowth_failedthrottling retries for 500 ms, so expect stutter rather than reuse at the margin. Merge is textually clean, and #2900/#2851 raise title allocations, which would push this guard into that fallback sooner.@OreoFR on GitHub · 2026-12-01 19:48 UTC · original
Thanks for looking at 8 GiB cards, that's a real problem (I test on an RTX 4070 Laptop 8 GB). A review before anyone can merge this, read from the diff on head
51818b7ea; no build or run yet:vram_block_refused()makes the block maker returnNone,texture_with_castreturnsNone, and the caller inresource.rs(right after the pool call) creates the texture on its own in the same default heap. So the texture still lands in VRAM, just outside the pool, as one more allocation. Could you show a before/after measurement (VRAM use,MakeResidentstalls, time to a device loss) with the guard on and off in one run (LEONIDA_AB), or keep the texture out of VRAM when the guard trips?d3d12/docs/switches.mdneeds regenerating for the two new switches (python -I tools/d3d12_switches.py --out d3d12/docs/switches.md), or the CI check will fail.used + BLOCK > budget * pct, budget 0 means no refusal, the 80-99 clamp) would make it verifiable without a game.AI-assisted review (Claude Code agent
oreofr-agent, for OreoFR).@merzleckeier on GitHub · 2026-12-01 20:26 UTC · original
Live texture-pool and worker-stack check on
51818b7emerged into19d5f83c. The control used the same fixture onmain.LEONIDA_RIPE_BLOCKS=0, both trees opened a 64 MiB pool block at equality and with an unknown budget. One byte above the configured limit, at both 95% and 90%,mainopened a block and the PR opened zero. The same call still returned a live texture through the committed-resource fallback. An existing block was reused on both trees above the limit. With default preallocation, equality let the PR open two 64 MiB blocks against the unchanged snapshot, and one byte above allowed neither block. All 32 cases passed. This measures the allocation path, with actual VRAM pressure and device-loss behavior outside the test.mainand the Wine-aware #2588. Requests of8,bad,1, and999produced 8, 64, 2, and 256 MiB here. The reservation probe ran with an empty pipeline queue.LEONIDA_PIPELINE_STACK_MIBandLEONIDA_VRAM_GUARD_PCT. Regeneratingd3d12/docs/switches.mdwithpython -I tools/d3d12_switches.py --out d3d12/docs/switches.mdmade the check and all 20 tests pass.MEASURED with synthetic inputs. AI-assisted with OpenAI Codex and a separate read-only review.
d463b6b69fto686c1124c4@merzleckeier on GitHub · 2026-12-01 21:02 UTC · original
Cache regression on the updated head with a working pipeline library
686c1124. I compared #2654 (55ac5d33) against #2654 plus this PR so that both arms could create an empty pipeline library on Wine. Onbc332322eand again on1fff69129, the unmodified mesh and depth-bounds tests each passed 3/3 per GPU with #2654 alone. Adding this PR made both tests fail 3/3 per GPU at the second-request library-load assertion. Both GPUs were physical, RTX 4070 SUPER (620.73.4) and Radeon RADV (26.3.1), Win64 Wine 11.22 / VKD3D-Proton 3.1.0.Recording the actual API results on
bc332322eexplains the failure. With #2654 alone, the firstLoadPipelinereturnsE_INVALIDARGfor the cold name,StorePipelinereturnsS_OK, and the second load returnsS_OK. With this PR, the first load returns the same code, the store is skipped, and the second load returnsE_INVALIDARGagain. Both patterns reproduced on both GPUs and in both fixtures. Microsoft’s API docs list an absent name as one reason for this HRESULT.I then restored only
pipeline/library.rsto the #2654 version while retaining this PR’s pool change and generated docs. Both tests were back to 3/3 on each GPU. The broad skip-on-E_INVALIDARGbranch blocks ordinary cache population here. This covers same-process reuse with synthetic pipelines under Wine.MEASURED with OpenAI Codex and a separate read-only review.
@KelboLive on GitHub · 2026-12-01 21:25 UTC · original · reviewed
Re-checked
686c1124c. Two of the four are resolved:make.rsis identical tomain, andmerge-treeagainst bothorigin/mainand #2588's6b4a44e1is clean, so #2588 is unblocked and nothing is left to reconcile.tools/d3d12_switches.py --checkexits 0;LEONIDA_VRAM_GUARD_PCTis listed and the page re-homedLEONIDA_RENDER_SCALE_MIN.Two are unchanged, and they are the substance:
pool.rs:590-605decides fromVRAM_USED, written only inroom()(pool.rs:52) and refreshed at most once a second byhost::sweep, and never incremented when a block is approved — so N blocks approved inside one second all compare the same stale value. A refusal atpool.rs:896makestake_texture(..)?returnNone, andresource.rs:3294-3300falls through to the committed allocation of the same texture atresource.rs:3329, so the bytes are spent anyway, just unpooled (plus a 500 msgrowth_failedback-off). Staging, small, shadow and targets remain ungated.vram_block_refusedis still untested. Forcing its decision tofalseleaves all 17pool::tests green.VRAM_BUDGET/VRAM_USEDare plain statics, so a unit test is easy; the committed fallback also needs the same gate, otherwise the guard only changes which allocation path is used.Separately, the new
pipeline/library.rschange (skipStorePipelineon0x80070057and log "not cacheable by library") is an untested behaviour change, and merzleckeier's 21:02 report of a cache regression on this head needs an answer before merge — that is the kind of thing the gate exists to catch.@fiestorra on GitHub · 2026-12-01 22:35 UTC · original
Independent verification on an RTX 4090, driver 621.24 (Windows 11) - by the
AGENTS.mdmethod. Two things to fix before merge, one of them serious.It applies cleanly (
merge-treeno conflicts;merge --squashonto1fff69129fine), and what it does run passes:1. The second P0 in the body is not in the code.
The body says:
The branch touches no
pipeline/make.rs, andLEONIDA_PIPELINE_STACK_MIBdoes not appear anywhere in it:That is also the half with the interesting NVIDIA claim (the
nvgpucomp64.dlloverflow at ~7 min). What is here is P0.1 and alibrary.rsrestructure that changes no behaviour - old and new both ignoreStorePipeline's error, and the newmatchhas a firstErrarm for0x80070057followed byErr(_)that does the same thing, so the specific arm is dead.2.
switches.mdwas regenerated from a tree older thanmain, and merging it rewrites 271 of its ~745 lines.Its own stat says
+5/-1because it is diffed against its base, but against today'smainthe file differs in 271 lines, and they are real regressions, not formatting:LEONIDA_RENDER_SCALE_MINlives inleonida-loader/hooks.rsonmainand the PR would move it back to where it was before. This is the shape the repo's own notes call out (a clean merge overwriting whatmainhas in the same file, #2582).test_d3d12_switches.pydoes not catch it - it passes here, because it checks that each name is present, not where the row says it lives. So the check that exists is not the check needed for this file.3. A new clippy warning:
pool.rs:76, "thisifstatement can be collapsed" (the other one,host.rs:7628, is onmainalready).Two questions I could not answer without an 8 GiB card, and would like the PR to address:
VRAM_BUDGET/VRAM_USEDare only refreshed insideroom(). If a texture block is taken withoutroom()having run since the last allocation,vram_block_refused()decides on stale numbers - and its doc says it is "called before everyCreateHeap", which is not the same as "after everyroom()". What refreshes them between blocks?Noneinsidetake_texture, so the texture is not placed. What does the title get instead - a smaller piece, a placed texture elsewhere, or nothing? On 8 GiB that is the difference between a guard and a hole in the frame, and I cannot see it from here.AI-assisted: yes - DeepSeek v4.1 (flash).
Written with an AI assistant.
@fiestorra on GitHub · 2026-12-01 23:26 UTC · original
Note on the two P0s in this PR: the second one already exists as #2588, and it is not in this branch.
The body describes P0.2 - pipeline stack: 64 MiB per pipeline worker,
nvgpucomp64.dlloverflowing on Ampere/Wave32,LEONIDA_PIPELINE_STACK_MIB(2-256, default 64). None of that is in this diff -pipeline/make.rsis not touched and the switch name appears nowhere in the branch:The work is done, in #2588 ("GPU: pipeline workers get a 64 MB stack for the driver's compiler", +70/-2, open) - which I verified separately today: applies on
main913b88b90,pipeline::make14/14, and itspipeline_workers_reserve_a_64_mb_stackreadsGetCurrentThreadStackLimitsfrom a worker, so it checks the reservation rather than the constant. It also declines the stack under Wine, where the whole of it is committed.So the honest shape of this PR is: P0.1 here, P0.2 in #2588 - "Depends on: #2588" instead of a second item claimed and absent. As written, a reviewer reads two fixes and merges one.
AI-assisted: yes - DeepSeek v4.1 (flash).
Written with an AI assistant.
@MoonEyes on GitHub · 2026-12-02 12:19 UTC · original
Closing: this pull request no longer applies to current
main(merge conflict ind3d12/docs/switches.md), and open pull requests that have fallen out of step withmainare being closed so the list stays workable. If you still want this change, rebase it on currentmainand reopen it (or open a new pull request); it will be looked at again.AI-assisted (Claude Code).
Pull request closed