Skip to content

Memory guard: no black screen at 0.2 fps on 32 GB PCs (one compile at a time under the commit floor, refused pipelines made again, no 10 s screen waits) - #3474

Open
nyxctura wants to merge 4 commits into
trustno1-coder:mainfrom
nyxctura:pr-memgate
Open

nyxctura wants to merge 4 commits into
trustno1-coder:mainfrom
nyxctura:pr-memgate

Conversation

@nyxctura

@nyxctura nyxctura commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2293. Related: #2520, #3435, #3094, #3107 (the same 0x8007000E pipeline failures and 0.1–0.3 fps stall).

What it changes

On a 32 GB PC with a system-managed page file, the title commits 22–27 GB in the world. The memory guard then puts driver compiles off, and pipelines that the driver refuses with 0x8007000E are recorded as failed for good. Their draws are dropped from then on, and the screen pass waits 10 s every frame for a pipeline that never comes (ms=10000 made=false). The result is a black picture with the HUD at 0.2 fps, about two minutes after loading in, reproduced 4 times, including after a reboot and with every cache deleted.

Three commits:

  1. One compile at a time under the commit floor (compilemem.rs, memguard.rs, procmem.rs). Below the floor, compiles are let through one by one instead of all being put off, so they keep making progress without stacking their peaks. The procmem line now says what holds the host's private memory.
  2. Pipelines refused for memory are made again later (pipeline/make.rs, pipeline/refused.rs, pipeline/library.rs). A memory refusal (the guard's put-off or a driver 0x8007000E) is retried with back-off instead of being recorded as a permanent failure, and no frame waits 10 s for one: the draw is dropped for that frame only.
  3. A compile's cost is measured without the card memory the title loads meanwhile (compilemem.rs, host.rs). The gate measured commit growth during a compile, and that growth included the title's own streaming, so compiles looked several times larger than they were and the gate closed for good.

Screenshots

Before, v2026.11.29.01 as released (2 min after loading in):
image 1

Before, official v2026.11.29.03 (same PC, lighter settings):
image 2

After, v2026.11.29.01 + this PR (same PC):
image 3

fps over time, all three runs:
image 4

How it was tested

  • PC: RTX 5070 12 GB (driver 621.40), Ryzen 7 7800X3D, 32 GB RAM, Windows 11 25H2, page file system-managed.
  • Profile: Series X, 1080p → 1440p, DLSS Performance, frame generation 2x, 30 fps cap, ray tracing off.
  • Before (v2026.11.29.01 as released): 2,550 pipelines failed for good, 2,559 0x8007000E lines, 17 screen waits of 10 s, 0.2 fps in the world (under 1 fps the whole time).
  • After (v2026.11.29.01 + these commits): 0 failed, 0 0x8007000E, 0 screen waits; 12 compiles put off and made later; played 22.5 minutes, median 13.1 fps, never under 1 fps.
  • Still present upstream: the official v2026.11.29.03 binary (sha256 70ad17b9…) on the same PC, with lighter settings (Series S, DLSS Ultra Performance, 60 fps cap), never reached the world: 1,167 0x8007000E lines and 5 ten-second screen waits, with ~11 GB of RAM free on average. The files this PR touches are unchanged between .01 and .03.
  • On current main (41adb55): the branch builds and the victory-gpu lib suite passes, apart from shader_cache::tests::every_switch_of_the_translator_is_in_the_key (VICTORY_SCALAR_SPLITS is not read by the translator any more), which fails the same way on main without this PR. host::card_steps::tests::places_written_after_sending_are_learned failed in one run; it fails intermittently without these commits too. It was not played on main; the play evidence above is on the v2026.11.29.01 base.
  • Not a shader change.
  • cargo test passed for the crates it touches: yes (victory-gpu, see the one unrelated failure above).

Checked for overlap

All three PRs at a glance

scorecard

🤖 Generated with Claude Code

nyxctura and others added 3 commits November 29, 2026 14:15
…rocmem line says what holds the host private

Root cause of the v2026.11.29.01 freeze on PCs with a managed page file
(trustno1-coder#2142, trustno1-coder#2182, trustno1-coder#2286, trustno1-coder#2293, trustno1-coder#2303, trustno1-coder#2550): the compile memory gate (new in
this release, 60a08ef) put off every driver compile while the commit left
was under VICTORY_COMMIT_FLOOR_MB (4096). A page file that Windows manages
grows only once the commit comes near the limit, so a gate that keeps the
commit away from it never sees it grow: on a 32 GB PC the commit left sat
at 2.0-2.9 GB for the rest of the run, 4,096-16,384 compiles were put off,
1,250-2,551 pipelines were never made (each logged as "host pipeline failed
0x8007000e": the gate's own refusal) and every frame waited 10 s for a
pass over the screen. The host-address growth itself (3.3 -> 16.9 GB in
two minutes) follows the card: the card's own memory in use rose
0.8 -> 7.7 GB and the shared memory 0.8 -> 5.2 GB (4,016 host copies of
title memory, 4.5 GB, at world entry), both backed by the process's commit
under WDDM; v2026.11.28.03 builds reached 26-30 GB private the same way.

Now, with no compile running, one still starts while the commit left is
over VICTORY_COMMIT_SINGLE_FLOOR_MB (1024) plus the least a compile takes
(256 MB); a figure at or over the commit floor turns that off. Over the
commit floor nothing changes.

The process memory line also says how much of the host private is the
card's own memory in use and the shared memory, the rest, the regions at
host addresses and the small private ones among them, and the gate's
counts (running, most at once, put off, let through alone).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… 10 s for one

A pipeline the driver refuses with E_OUTOFMEMORY (or the commit limit's
error) is asked again once the spare upload, shared, scratch and read-back
buffers are let go (ported from our commit-fix oom.rs); refused again, it
is put off like a compile the gate holds back, not recorded as refused for
the run. VICTORY_PIPELINE_OOM_RETRY=0: as before.

A pipeline put off waits 1 s before it is tried again, then 2, 4 and at
most 8 s each further time (was 1 s for ever): it is never given up on,
and a PC short of memory is not asked a thousand compiles a second.

The gate's own refusal carries E_OUTOFMEMORY and was logged and counted
as "host pipeline failed ... 0x8007000e" (1,250-2,551 a run): a make put
off is now counted apart in the failures line ("makes put off for
memory"), and the VICTORY_SHADER_CAPS retry no longer goes round the gate.

Waits: a draw stops waiting for a pipeline once it is put off (nothing
makes it before its pause is over). While compiles are being put off
(the last two seconds) passes over the screen wait at most
VICTORY_SCREEN_WAIT_SHORT_MS (50) a frame in all, instead of the screen's
10 s: the pass is left out of the frame until its pipeline is made, which
goes on meanwhile.

The process memory line counts the pipelines the driver refused for
memory and made later.

Tests: the retry of a create refused for memory, the growing pause, the
cut waits and screen budget, a wait that ends with the put-off, a make put
off is not a failure, a driver refusal is told to the maker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e title loads meanwhile

The gate learns what a compile takes from the process's private bytes
over its length. The card's own memory in use and the memory it shares
with the PC are backed by the process's commit too, and grow with what the
title loads: at world entry they grew 6.8 GB in five seconds while 21
compiles ran, which raised a compile's expected cost from 256 to 1,272 MB,
and with it what the gate held back for the compiles running (so compiles
were put off with 2-3 GB of commit left). They are now taken off the
private bytes the gate measures by (the figures the memory line reads once
a second).

Test: a compile alongside 6 GB of card loading is measured as its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the pr-fix Pull request: fixes a bug label Nov 29, 2026
@github-actions github-actions Bot changed the title [pr-fix] Memory guard: no black screen at 0.2 fps on 32 GB PCs (one compile at a time under the commit floor, refused pipelines made again, no 10 s screen waits) Memory guard: no black screen at 0.2 fps on 32 GB PCs (one compile at a time under the commit floor, refused pipelines made again, no 10 s screen waits) Nov 29, 2026
@nyxctura
nyxctura marked this pull request as ready for review November 29, 2026 23:46
JustOptimize added a commit to JustOptimize/VIctory-Enhanced that referenced this pull request Nov 30, 2026
…der#3474)

Port of trustno1-coder#3474 (fixes trustno1-coder#2293), three conflicts with trustno1-coder#2580 in pipeline/make.rs and refused.rs, merged by hand. Under the commit floor compiles go one at a time instead of all being put off (compilemem.rs, memguard.rs, procmem.rs); a memory refusal (the guard's put-off or a driver 0x8007000E) is retried with back-off, not recorded as a permanent failure, and no frame waits 10 s for one; a compile's cost is measured without the card memory the title loads meanwhile. Merge choices: trustno1-coder#2580's wait_loop already ends a wait on a put-off build (retry_waits), so the PR's wait_cut helper, its WAIT_SLICE and its inline loop were dropped; the PR's starved screen-pass budget (screen_or_wait_budget, 50 ms while compiles are put off) is kept and its test reduced to the budget asserts; refused.rs keeps both test modules. Upstream: 32 GB PC, black screen at 0.2 fps reproduced 4 times and gone with the PR; not tried on a 3080 here, and with a warm shader cache the starved path should not engage, so this run only checks for regressions.
JustOptimize added a commit to JustOptimize/VIctory-Enhanced that referenced this pull request Nov 30, 2026

@ThePerfomance ThePerfomance left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling the low-memory stalls, @nyxctura. In my run of 6cb6b38, the exit summary reported 731 deferred pipeline builds and zero permanent failures. The deferred count first appeared in the summary at exit.

Could the deferred branch in refused::failed set changed = true when it increments put_off? That would let summary(false) report the updated count when the queue drains, which helps when a hung run has to be force-closed. A small test could check that one deferral produces a summary and that a second call without new events stays quiet.

…mary

failed() counted put-off makes without marking the summary changed, so
summary(false) stayed quiet and the count first showed at exit; a hung run
closed by force never printed it. The deferred branch now sets changed too.
The line's contents come from summary_line(), and a test checks that one
put-off make is reported once and a second look with nothing new stays quiet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nyxctura

Copy link
Copy Markdown
Contributor Author

Good catch, thanks for testing. Pushed: the deferred branch now marks the summary changed, so summary(false) reports put-off makes as they happen instead of only at exit. Added the test you described (one deferral gives a summary line, a second call with nothing new stays quiet); it fails without the change.

@upipibi

upipibi commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Test report for #3474 (head 92fa413), merged onto main 41adb55. Synthetic tests only: no title run, no game files, so this does not show the black screen going away in a title.

Setup: RTX 3070 8 GB, driver 621.40, 32 GB RAM, Windows 11 (10.0.26100), rustc 1.98.1.

The ten new tests (compilemem, pipeline::make, pipeline::refused, pipeline::library, procmem): 10 passed, 0 failed, 3/3 runs. They are logic tests and make no device.

Negative controls, one line changed each:

Change Test Result
A: the gate in compilemem.rs never lets the single compile through under the commit floor (if false && verdict == Verdict::Commit && self.running.is_empty() && single_fits(..)) under_the_commit_floor_one_compile_still_runs_alone fails at compilemem.rs:612: alone, over the single floor, left Commit, right Allow
B: wait_cut in pipeline/make.rs ignores put_off waits_are_cut_for_pipelines_put_off_for_memory fails at make.rs:1848: put off: nothing makes it now
B a_wait_ends_when_its_pipeline_is_put_off fails at make.rs:1884: ended with the put-off: 513.0485ms

So the tests do pin the two behaviours the description leads with: one compile still runs under the floor, and a wait ends when its pipeline is put off.

cargo test -p victory-gpu --lib --locked, three runs of each tree in turn

Tree Run 1 Run 2 Run 3
PR 929 passed, 3 failed 929 passed, 3 failed 931 passed, 1 failed
Main 41adb55 919 passed, 3 failed 921 passed, 1 failed 919 passed, 3 failed

Failures by test over the three runs:

Test PR Main
shader_cache::tests::every_switch_of_the_translator_is_in_the_key 3 3
host::menu::tests::a_change_is_saved_at_once_however_the_game_was_started 2 2
host::uav_pool::tests::host_list_uav_pool_lifecycle_retire_trim_and_info_queue 1 1
host::card_steps::tests::places_written_after_sending_are_learned 0 1
watch::tests::a_late_fault_leaves_the_guard_taken_since 1 0

None is one of the PR's tests. The first fails on main every time; the next three come and go on both trees. The last one failed once on the PR tree and not in main's three runs here; this PR does not touch watch.rs, and I have seen other watch:: tests fail now and then on main today, so I read it as the same kind, but three runs cannot settle that.

Not tested: the memory guard in a title on a 32 GB PC with a system-managed page file, which is the case #2293 is about.

Tested with the help of Claude Code (Claude Fable 5.2).

@nyxctura

Copy link
Copy Markdown
Contributor Author

Thanks for the check, especially breaking it on purpose to see the tests catch it. Looks like everything works as it should.

@andrewpozdnakov7-jpg

andrewpozdnakov7-jpg commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

#3813 now has a matched hardware comparison on an RTX 4070 Ti Super 16 GB with 32 GB system RAM. The reporter used the same settings, cleared the shader cache and preloaded for each run. The build with #3474 reached the scene. Reporter and three logs

I counted the outcomes in the attached play logs.

Build Distinct keys in the failure counter Failed screen waits Outcome reported
v2026.11.28.03 0 0 Loaded the scene
v2026.11.29.05 575 with 0x8007000e 9,940 ms and 10,000 ms Black screen while loading
Build with #3474 0 reported as failed, 1,933 build attempts put off 734 ms and 635 ms Loaded the scene

The patched run still has long frames and logged low system commit. This comparison confirms that the reporter can reach the scene and that the failure counter stayed at zero in that run.

@SergDi

SergDi commented Nov 30, 2026

Copy link
Copy Markdown

I tested the accounting interaction of this PR (92fa4133) and #2743 (f046d180) on 41adb551, using synthetic Windows tests with Rust 1.98.1. This is a local integration experiment, not a failure claim against either PR alone.

Integration used this PR's refused.rs guards, #2743's panel and put_off() getter, and its refusal test. The key behavioral difference is deliberate: this PR puts driver-memory refusals off for retry, while #2743 alone only excludes guard deferrals from failed keys.

If the intended UI contract is “both kinds of memory put-off receive the memory explanation”, the combined tree has a reproducible mismatch:

  • Guard put-off: the panel says NO MEMORY.
  • Driver-memory put-off: DRIVER_REFUSED increments but put_off() reads only REFUSED. The panel instead says THEIR SHADERS CANNOT BE CONVERTED YET / NOTHING ON YOUR SIDE.

The contract test below fails for the driver branch. Summing the two counters only in the panel-facing getter makes it pass; separate per-cause counters remain available. This is a proposal for the combined configuration, not a change to the retry policy.

Evidence: #2743 characterization 2/2; this PR's matrix 3/3; combined matrix+contract 3 passed / 1 expected RED; with the getter proposal 4/4 and selected modules 82/82. Tests ran with --test-threads=1 because counters are global. One separate release-mode procmem test failed identically on clean 41adb551; it is not attributed to this PR. Strict release/no-deps Clippy had the same 30 diagnostic locations as the base, after accounting for line shifts; not a clean Clippy pass.

Two useful accounting distinctions from the matrix/code review:

  • Seen.put_off counts events per ask, not unique pipelines. A single pipeline can contribute repeatedly.
  • Second-ask successes are counted internally by SECOND, but only sampled so_far messages expose them; there is no getter/final total. Success after a later back-off has no separate counter.

The contract patch applies to that combined tree; the getter proposal applies after it. The policy choice to retry a driver OOM is separate from whether the panel explains a pending retry accurately. No game/OOM-stress run or FPS claim is part of this check.

cargo test --locked --release -p victory-gpu --lib a_put_off_for_memory_gets_the_memory_note_whoever_put_it_off -- --test-threads=1 --nocapture

AI assistance: Claude prepared and ran the synthetic matrix; Codex reviewed the evidence and scope. No game data is included.

contract-test-on-combined.patch — synthetic integration test
diff --git a/crates/victory-gpu/src/host/panel.rs b/crates/victory-gpu/src/host/panel.rs
index f16fddac..db3f7a33 100644
--- a/crates/victory-gpu/src/host/panel.rs
+++ b/crates/victory-gpu/src/host/panel.rs
@@ -1059,6 +1059,26 @@ mod tests {
         }
     }
 
+    /// OOM contract (local experiment, phase 4; #3474 + #2743 combined):
+    /// draws skipped while compiles are put off for memory get the memory
+    /// note, whether the guard put them off or the driver refused them for
+    /// memory (both are made again later), never "cannot be converted yet".
+    #[test]
+    fn a_put_off_for_memory_gets_the_memory_note_whoever_put_it_off() {
+        let note = |put_off: u64| advice(&Sample { fps: 20.0, ms: 50.0, dropped: 47.0, put_off: put_off as f64, ..Sample::default() });
+        crate::memguard::take_deferred();
+        let before = crate::memguard::put_off();
+        crate::memguard::refuse_compile("oom contract", crate::memguard::Verdict::Commit, None);
+        crate::memguard::take_deferred();
+        let gate = note(crate::memguard::put_off() - before);
+        assert!(gate.iter().any(|l| l.contains("NO MEMORY")), "the guard's: {gate:?}");
+        let before = crate::memguard::put_off();
+        crate::memguard::put_off_for_driver("oom contract");
+        crate::memguard::take_deferred();
+        let driver = note(crate::memguard::put_off() - before);
+        assert!(driver.iter().any(|l| l.contains("NO MEMORY")), "the driver's: {driver:?}");
+    }
+
     #[test]
     fn counters_that_went_back_to_nothing_count_from_there() {
         let (mut a, mut b) = (Counters::default(), Counters::default());
put-off-counts-both-causes.patch — local proposal after the contract test
diff --git a/crates/victory-gpu/src/memguard.rs b/crates/victory-gpu/src/memguard.rs
index 0acc7e89..41e537a8 100644
--- a/crates/victory-gpu/src/memguard.rs
+++ b/crates/victory-gpu/src/memguard.rs
@@ -177,10 +177,12 @@ pub(crate) fn put_off_for_driver(what: &str) {
     DEFERRED.set(true);
 }
 
-/// Compiles put off since the start (the F2 explainer tells the draws they
-/// leave out from those whose shaders do not translate).
+/// Compiles put off for memory since the start, the gate's ([`REFUSED`]) and
+/// those the driver refused for memory ([`DRIVER_REFUSED`]): both are made
+/// again later, so the F2 explainer tells the draws they leave out from those
+/// whose shaders do not translate. The two stay apart in their own counters.
 pub(crate) fn put_off() -> u64 {
-    REFUSED.load(Ordering::Relaxed)
+    REFUSED.load(Ordering::Relaxed) + DRIVER_REFUSED.load(Ordering::Relaxed)
 }
 
 /// Whether a compile on this thread was refused by the guard since the last

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

#3813's latest RTX 5080 report adds an independent .05 reproduction. Series X recorded 1,349 driver OOM failures at 45.6/46.0 GiB of system commit with 3.5 GiB of physical memory free. Series S still recorded 808 failures with only two pipeline workers. The matched RTX 4070 Ti Super run remains the result on this PR.

I checked how this PR combines with #3788. A direct cherry-pick conflicted in pipeline/make.rs. I resolved it in a review branch based on release main 41adb551. The branch keeps the four #3474 commits, #3788 and the reviewer's reservation fix with their original Git authors. The combined wait keeps the memory-deferral exit and short budget from #3474, plus the cumulative screen allowance and concurrent reservation from #3788.

Native Windows diagnostics tests passed 75/75 across pipeline making, the library, refusal accounting, compile admission, memory guard and process memory. The 36 pipeline-making tests also passed with four test threads. The same synthetic unmade pass with scaled 300/20 ms budgets measured 304, 30 and 30 ms across three frames. The legacy switch produced 314, 312 and 315 ms. The concurrent reservation and early memory-deferral tests passed. Asset policy passed for all seven outgoing source files. The whole-tree check still flags the same unchanged frame_users.rs file on release main and the branch.

@Damaschni if you can do a matched rerun, the next useful comparison is the exact 92fa4133 patch on .05 with your same Series X settings and existing Windows commit limit. Please note whether the opening reaches the first playable frame, the driver refusals versus deferred retries, and whether the image is complete.

Please preserve the original Git authors when taking the commits. If my conflict resolution is folded into another commit, use Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com>.

@Damaschni

Copy link
Copy Markdown

@andrewpozdnakov7-jpg, here is the RTX 5080 rerun you asked for. I built the exact 92fa4133 head on the .05 base (41adb551). Same Series X settings as my original report: 2560×1440 output, DLSS Quality, frame generation off. RTX 5080 16 GB, 32 GB RAM, Windows 11 build 26300, driver 621.14. This release run used the offscreen window and scripted Enter.

  • Intro progress. The first frame with at least 500 draws was logged 73 s after launch (about 34 s after Enter). Median FPS after that marker was 0.7 across 32 logged samples. The run was stopped after about 4 min 46 s.
  • Pipeline outcome. 0 permanent host-pipeline failures, 0 driver OOM messages, and 5,078 compile deferral events in the last compile memory summary. Repeated deferrals of the same pipeline can contribute more than once. There were zero logged 10 s screen waits.
  • System commit. At peak usage, 48.83 / 49.75 GiB was committed with 3.17 GiB of physical memory available. The page-file setting was system managed for both runs. The original .05 sample was 45.6 / 46.0 GiB, so the observed commit limits differed.
  • Image check. A separate diagnostics build of the same commit, using a copy of the release run's cache, captured visible credits and loading art. The sampled 3D frames were black. A complete scene and the first controllable gameplay frame remain unverified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-fix Pull request: fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The build commits about 39 GB: with the default 10 GB pagefile, 1673-2396 pipelines fail with 0x8007000e and the run never starts

6 participants