gpu: a pipeline refused for want of memory is asked for again, not refused for the run #2616
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2616"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by superboynick on 2026-11-29T14:59:11Z.
Follows sergiogbrox's diagnosis in #2520, which is the useful part of this:
crates/victory-gpu/src/pipeline/make.rssettles a build once, so a refusal from the host is written to theOnceLockasNoneand kept for the run. That is right for a shader the device cannot make, and wrong for one it could not make just then.His measurement: on an RTX 5060 Ti the process commit rose 19.6 -> 23.6 GB in about 4 s while the world streamed, the memory guard reported 150 MB free, 451 pipelines were refused
0x8007000ewithretried=0- and the memory came back, but those pipelines stayed refused, so the frame kept dropping 322 draws a frame (max 2,016) for the rest of the run at 0.3-0.4 fps in places. A second run with nothing else open had no refusals at all.What this changes
When the host answers
E_OUTOFMEMORY, the device is still there, and the memory guard did not itself defer the compile,make_withnow treats it like the guard's own deferral: the pipeline is asked for againRETRY_AFTER_MSlater instead of being recorded as refused - up toOUT_OF_MEMORY_RETRIES(3) times, after which the refusal is recorded for the run exactly as before. So a card that is really full stops retrying, and the per-run negative cache asked for in #2533 still applies wherever there is memory to spare.Two small additions, both local:
refused::failedsets a flag when the code is0x8007000eandGetDeviceRemovedReasonreports nothing;Pendingcounts its tries.Verification, and what is missing
cargo build --release -p victory: clean.cargo test -p victory-gpu --lib: 915 passed, 0 failed, 57 ignored.0x80000003during load, before any pipeline is made, so the run never reaches the state this change affects. At Series S, where it does run (10 fps, p10 9), there are no0x8007000erefusals to retry.@sergiogbrox - you offered to test a patch on the desktop where the burst reproduces by keeping a browser open while the world loads, and that is the only machine this can be checked on. If you run it, the line to look for is
host pipeline refused for want of memory: it is tried again 1000 ms laterand, at the end,retried=andretry_made=in thepipeline failures:line: they should stop being 0, and the draws dropped per frame should fall off once the memory comes back.Claimed under #2520, per #1528. Checked for overlap:
make.rs'ssettle/deferandrefused.rs'sfailedare not touched by the memory work in #1463/#971/#718 (those areshadow.rsand the allocator).Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by superboynick on 2026-11-29T15:14:45Z.
Two things added to the branch since it was opened, both about making the change checkable without the machine that has the problem.
The decision is now a pure function with tests, rather than a condition inline in
make_with:with three tests over its cases: a refusal for want of memory is asked for again at 0, 1 and 2 tries and recorded at 3 and beyond; a refusal of any other kind, or one the memory guard itself deferred, is recorded at once; a pipeline that was built is never retried.
cargo test -p victory-gpu --lib -- retry_after_refusal refusal_of_any_other pipeline_that_was_built: 2 passed, 1 passed, 1 passed.And a flake worth knowing about, which is not this change.
watch::many_askers_tests::no_write_is_lost_when_faults_take_no_lockfails on roughly one full-suite run in four, and it does so onmainas well:cargo test -p victory-gpu --lib, 4 runsorigin/main(915 tests)Run alone, that test passes every time on both trees (3 of 3 here, 4 of 4 on main), so it is an order-of-tests or thread-timing matter in the full run rather than anything either tree changed. I have left it alone rather than fold an unrelated fix into this pull request, but CI on this branch will inherit its ~25 % failure rate, which is worth knowing before reading a red run as this change's fault.
Still unverified in the game on this machine, and for the same reason as before: 3.8 GB of this card is held by other applications, and at Series X the title dies in its own code with
0x80000003during load, before any pipeline is made. @sergiogbrox's offer to test on the desktop where the streaming burst reproduces is the check that matters.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by superboynick on 2026-11-29T15:20:23Z.
A correction to my own number, before anyone acts on it: I said the
watch::many_askers_tests::no_write_is_lost_when_faults_take_no_lockfailure was about one full run in four. Onorigin/mainit is rarer than that - five more full runs since (cargo test -p victory-gpu --lib, WARP, one thread) were all 915 passed, 0 failed, so what I have actually seen is one failure in nine full runs, not one in four. It has never failed when run alone (7 of 7 now onmain).The two panic sites from that one failure are still worth having, since they are two different things going wrong:
crates/victory-gpu/src/watch.rs:6215- the test's ownassert!(number > last[page], ...): a write through one view was not reported bywrites(...)for another.crates/victory-gpu/src/watch.rs:6113- the.expect("a view")just above it:writes(...)answeredNonefor a view the test had just mapped.I could not capture which variant (
writes_to_views_are_not_lostwith whichrest/unlocked) because the run that failed printed only the test names. I am not folding a fix for it into this pull request: the two sites point at different failures, and one of them (Nonefor a live view) is worth understanding before anything is changed. Reporting it here rather than silently working around it.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by dyshay on 2026-11-29T15:40:04Z.
Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch
janus-prs). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with--profile diag --features diagnostics, and the CPU tests of the touched crates pass. Runs on an RTX 4090 are queued (Series X 1440p, and Series S with ray tracing, DLSS Quality). Frame times will follow here.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by CuteBooty on 2026-11-29T20:57:25Z.
Another reproduction of the never-retried 0x8007000e pipelines, on an 8 GB card, in case the numbers help this PR. This run did not include #2616, so it shows the problem, not the fix; I have not run the patch.
829188e96plus #2386 (build fix only), diagnostics build. Series S console profile, 1080p, DLSS performance + frame generation 2x.So, as this PR says (read from the source, not from a run with it): a pipeline refused by the driver for memory in a pressured moment is settled as refused for the whole run (pipeline/make.rs settle()). A delayed retry like the memory guard's would have recovered these.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by SergDi on 2026-11-30T06:32:39Z.
Found a cross-worker retry-ownership race in the current
0224c2776240400d996421af38e8ae0d20000c5bimplementation.OUT_OF_MEMORYis process-global, whilemake_withconsumes it withswap(false)even when another worker owns the OOM. The per-Pending lock does not protect this across different pipelines.A deterministic test (channels, no sleeps) reproduces:
The two patches below apply in order to this PR: the first adds the test and extracts a behavior-preserving
note_out_of_memory()helper; the second uses a thread-localCelland clears it before building, following the existing memguard pattern.Actual Windows test tree:
f72cec7714aa6d6e274b761fb6fa40bfcf44243b+ #3125 (39de4d1) + this PR's diff + our test. Not the exact PR head. RED fails atthe pipeline refused for memory is asked for again. Adding the fix gives 75 passed, 0 failed, 2 ignored forpipeline::.The targeted regression covers cross-thread ownership; it does not independently cover the extra reset-before-build line. Final Windows Clippy diagnostic sets match the clean base (using
--no-depsto reach this crate); strict Clippy is still failing baseline findings.Two reporting caveats: existing
retried/retry_madecountVICTORY_SHADER_CAPSretries, not this OOM path. Our game runs reproduced memory-guard deferrals, not an intercepted driver OOM, so we cannot claim in-game efficacy or an FPS gain from this fix.AI assistance: Codex and Claude prepared/reviewed these patches and collected the Windows test evidence.
pr2616-test.patch
pr2616-fix.patch
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by SergDi on 2026-11-30T10:38:49Z.
Follow-up to my TLS/reset proposal: I added a separate test for the pre-build reset, which the earlier cross-thread test does not cover.
This is an entry-boundary invariant, not a newly reproduced gameplay bug. I did not find a current production path that leaves a stale flag for a later
make_withon the same thread: that function consumes the flag after a build; the direct warm callers do not subsequently enter it. The test makes that boundary assumption explicit.On one dedicated thread, it seeds a stale flag before a non-OOM refusal and before a panicking build. Both must be recorded without spending an OOM retry. A control sets OOM inside the build and must still retry.
Windows / Rust 1.98.1, base file contents
41adb551+ this PR's0224c277diff + the two patches in my earlier comment + this new test:a refusal of another kind is recorded at once, not retried for a stale flagpipeline::The patch below applies on top of the earlier test + supplemental fix. It changes tests only. The caught synthetic panic is intentional. Clippy was run without
-D warnings; no diagnostics point to the new test, but this is not a strict Clippy pass or a matched baseline comparison. No in-game benefit is claimed.AI assistance: Claude prepared and ran the test; Codex reviewed the evidence. No game data is included.
oom-reset-test.patch — test only, atop the earlier supplemental fix