memguard: count pagefile growth as commit left, as residency does #2392
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2392"
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 Brillanc3 on 2026-11-29T12:37:26Z.
Fixes #2385
What it changes
The memory guard (
memguard.rs,60a08ef) read the commit left fromullAvailPageFile, the commit limit of the moment. With a system-managed pagefile that limit sits only a few GB above the commit while the world loads, so the guard stayed at its 4096 MB floor and put off about 1,330 compiles per run: their draws were dropped and the game ran at 0.1-0.2 fps (details and logs in #2385).memguard::figures_now()now takesresidency::available_commit(), the limit of the moment plus what the pagefiles may still grow by (held to the free space of their volume less 8 GB;VICTORY_COMMIT_GROWTH=0keeps the limit alone). The residency pass and the memory guard now count commit the same way (#339).available_commitbecomespub(crate); nothing else changes (floors, defaults,VICTORY_COMMIT_FLOOR_MB,VICTORY_COMPILE_MEMORY).The guard still protects against the
ptxas fatal: Memory allocation failurecase it was written for: on a PC whose pagefiles cannot grow (fixed size, or a full volume) the figure is the same as before.How it was tested
0x8007000erefusals from the guard per run,free_commit_mb=3929, 0.1-0.2 fps from the world load on (three runs, 1440p and 4K).free_commit_mb=80761; no commit refusal, 6 compiles put off by the physical-memory soft floor only, 300x8007000e; 5-18 fps in the world over 3 minutes. Still below the menus' 144 fps on this PC (free physical memory ~1.6 GB at ~29 GB committed), which this PR does not claim to fix.cargo test --locked -p victory-gpu --lib -- memguard compilemem pipeline::make: 46 passed.cargo clippy -p victory-gpu --all-targets --no-deps -- -D warningsreports the same 28 + 25 errors on main without this change, none in the two files touched.Checked for overlap
residency.rs, pipeline worker throttling, not the guard's figures), #339 (merged, the same correction for the residency pass).🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by DrDarkDK on 2026-11-29T13:20:03Z.
I tested clean
origin/main(829188e9) against this PR’s exact head (3ae5f5c8) on Windows 11 with an RTX 4070 Ti, Ryzen 9 7900X, and a system-managed pagefile. #2392 was the only code difference. Both runs used the same launch settings and loaded about 5,100 host pipelines from cache. I observed CPU usage near 100% on both builds.829188e93ae5f5c8On main, the guard reported 290–1,173 MB of commit headroom when it deferred compiles. Around world load in that same run, residency reported about 77,000 MiB of available commit after counting potential pagefile growth.
The paired run reproduces the reported guard behavior on main and shows zero commit-floor deferrals on the PR build. The FPS comparison changes direction with the sampling window, so I can’t draw a performance conclusion from this pair.
AI-assisted with Codex.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by fainty0 on 2026-11-29T14:42:10Z.
Review: Request changes
PR #2392 makes compile admission and residency use the same commit-headroom estimate (
crates/victory-gpu/src/memguard.rs:115,crates/victory-gpu/src/residency.rs:22–23,201,301). This addresses the mismatch behind #2385, but the optional-work estimate is too optimistic for the hard compile gate.crates/victory-gpu/src/memguard.rs:103,115). Microsoft documents allocation failures from slow automatic pagefile growth. A system-managed file can grow subject to policy and available disk space; a fixed file cannot. Use estimated growth for soft scheduling (for example, serialise compiles below the normal floor), but require a conservative immediate-commit minimum before starting the driver compile. Describe the result as an estimate, not a promise.crates/victory-gpu/src/residency.rs:22–23,69–85). Per Microsoft,ullAvailPageFileis current process commit headroom in bytes, not free pagefile space;ullTotalPageFilecan be process-capped. With 16 GiB RAM, a fixed 4 GiB file and a 16 GiB process cap, subtracting RAM yields a fictitious zero-byte file and can credit 4 GiB of non-existent growth. Use active pagefile sizes for growth and don't credit growth against process/job quotas. System-wide headroom is(CommitLimit − CommitTotal) × PageSize;CommitPeakis historical. The existing byte arithmetic is consistent; theMBknobs use MiB.crates/victory-gpu/src/residency.rs:64–87). Adding cached growth to fresh headroom double-counts expansion already reflected in the current limit for up to five seconds. The aggregate cap also allows disk space on a fixed-file volume to fund estimated growth on another, full volume.Coverage and style: No new regression tests. The admission tests at
crates/victory-gpu/src/memguard.rs:181–239take precomputed headroom;crates/victory-gpu/src/residency.rs:403–411checks parsing only. Add GPU/game-free tests for fixed files, quotas, per-volume limits, growth between samples and growth disabled. Why-docs fit the house style; no new unsafe, title-threadunwrap()or assets.VICTORY_COMMIT_GROWTHinherits a direct env read atcrates/victory-gpu/src/residency.rs:41; usetoggled!if changing that path.Windows Clippy (
829188e→3ae5f5c): Both gates fail on both refs.--keep-goingreports 5 → 5 default, 4 → 4 all-features; 0 added, 0 removed. Focused GPU checks report the same 30 default and 13 all-features GPU locations on both refs, none in changed files.Policy:
cargo xtask policy --stagedpassed for both changed files.Not verified: Windows tests (not run; no Windows), live pagefile behaviour, claimed performance improvement, full all-features GPU or HLE linting.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by fainty0 on 2026-11-29T14:43:06Z.
Review: CHANGES_REQUESTED
Review: Request changes
PR #2392 makes compile admission and residency use the same commit-headroom estimate (
crates/victory-gpu/src/memguard.rs:115,crates/victory-gpu/src/residency.rs:22–23,201,301). This addresses the mismatch behind #2385, but the optional-work estimate is too optimistic for the hard compile gate.crates/victory-gpu/src/memguard.rs:103,115). Microsoft documents allocation failures from slow automatic pagefile growth. A system-managed file can grow subject to policy and available disk space; a fixed file cannot. Use estimated growth for soft scheduling (for example, serialise compiles below the normal floor), but require a conservative immediate-commit minimum before starting the driver compile. Describe the result as an estimate, not a promise.crates/victory-gpu/src/residency.rs:22–23,69–85). Per Microsoft,ullAvailPageFileis current process commit headroom in bytes, not free pagefile space;ullTotalPageFilecan be process-capped. With 16 GiB RAM, a fixed 4 GiB file and a 16 GiB process cap, subtracting RAM yields a fictitious zero-byte file and can credit 4 GiB of non-existent growth. Use active pagefile sizes for growth and don't credit growth against process/job quotas. System-wide headroom is(CommitLimit − CommitTotal) × PageSize;CommitPeakis historical. The existing byte arithmetic is consistent; theMBknobs use MiB.crates/victory-gpu/src/residency.rs:64–87). Adding cached growth to fresh headroom double-counts expansion already reflected in the current limit for up to five seconds. The aggregate cap also allows disk space on a fixed-file volume to fund estimated growth on another, full volume.Coverage and style: No new regression tests. The admission tests at
crates/victory-gpu/src/memguard.rs:181–239take precomputed headroom;crates/victory-gpu/src/residency.rs:403–411checks parsing only. Add GPU/game-free tests for fixed files, quotas, per-volume limits, growth between samples and growth disabled. Why-docs fit the house style; no new unsafe, title-threadunwrap()or assets.VICTORY_COMMIT_GROWTHinherits a direct env read atcrates/victory-gpu/src/residency.rs:41; usetoggled!if changing that path.Windows Clippy (
829188e→3ae5f5c): Both gates fail on both refs.--keep-goingreports 5 → 5 default, 4 → 4 all-features; 0 added, 0 removed. Focused GPU checks report the same 30 default and 13 all-features GPU locations on both refs, none in changed files.Policy:
cargo xtask policy --stagedpassed for both changed files.Not verified: Windows tests (not run; no Windows), live pagefile behaviour, claimed performance improvement, full all-features GPU or HLE linting.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by dyshay on 2026-11-29T15:40:10Z.
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 dyshay on 2026-11-29T16:15:25Z.
We hit this independently on an RTX 4090, Series X profile at 1440p with ray tracing (64 GB RAM, system-managed page file). Two things combined:
Our fix does the same two things as #2188 and #2392 together: the wait ends when the compile is put off, and the guard counts what the page file can still grow by. It is in dyshay/VIctory-NVIDIA. Same scene and settings, measured on the card:
So the change is confirmed on a second machine. The tests that reproduce the wait (10 s before, immediate after) are in our commit
06ff9b27if you want them.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nick0451 on 2026-11-29T16:47:21Z.
Independent confirmation: I wrote the same 2-line change last night (same
figures_now()→residency::available_commit(&m),available_commitmadepub(crate)) and tested it on another configuration, so I'll back this one rather than open a duplicate. Report with the bisect on #1625.PC: RTX 3090 24 GB, i9-14900K, 32 GB RAM, Windows 11, system-managed pagefile, Series S. Other programs held most of the commit (~15 GB of a 73 GB limit free with the game not running). Every start was a fresh executable name and hash, on the same frozen save.
hr=0x8007000epipeline failures568c5e5829188e9829188e9,VICTORY_COMPILE_MEMORY=0829188e9+ this changeThe 23 memguard/compilemem/residency tests passed with it. Clippy has nothing on the changed lines.
🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by L-696 on 2026-11-29T17:08:40Z.
Additional Windows 11 laptop test on RTX 4060 Laptop (8 GB), i7-13650HX and 32 GB RAM. Baseline was v2026.11.29.01 (
829188e9). The comparison build applied #2392 to memguard.rs and residency.rs. Both used Series X, fixed 2560×1440 output, DLSS Performance, DLSS FG 2× and BVH requested.The route and cache state were not strictly matched. These are observed counts, not evidence that the patch fixes device removal. Movement-triggered material corruption still repros (#2464).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by frame18studios on 2026-11-29T17:16:42Z.
A/B confirmation on
v2026.11.29.01(RTX 5070 Ti Laptop, ~32 GB RAM, Series X, 2560x1440, DLSS Balanced). The GPU code in our local build has only this change on top of the release;memguard.rs/residency.rsare byte-identical to this PR's head3ae5f5c8(same patch-id), so this is a confirmation rather than a competing implementation.Stock official exe
0D3DAE51870BAD44AA529C9FDDD762A513D677FF8D08147134968BA7ED67DFFD:free_commit_mbfell3866 -> 1098 -> 382, reason "the commit left would fall under its floor".46 host pipelines failed (3 compute, 13 graphics, 30 mesh), all0x8007000e,retried=0,0 shaders do not translate.9.8 fps, 101.9 ms/frame.With this patch:
free_commit_mbstayed around69100; there were no commit-floor deferrals in the log, only the startup line.0 host pipelines failed (none), 0 shaders do not translate.10.7-20.4 fps(last17.9 fps, 56.0 ms/frame); displayed FPS was 15 with drops to 8.The two runs are not a controlled FPS comparison: frame generation was
x4in the stock run and off in the patched run (the saved menu setting had changed), so please read the pipeline-refusal counts as the A/B result. The exposure/negative-colour pulse and texture artefacts came from a separate local shader-fold patch, which has been reverted; this change does not touch shader translation or presentation.VICTORY_COMMIT_GROWTH=0still gives the old, momentary-limit-only accounting. This confirms the stall in #2385: with roughly 3.9 GB under the momentary limit, compiles were refused even while RAM and pagefile headroom were available.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-11-29T23:20:15Z.
Tested on an RTX 5080 + 9800X3D with 32 GB RAM and a system-managed page file. Series S, DLSS Quality, FG and RT off, standing still in the world, 300 s per run, all on
829188e9. Cold means the driver pipeline cache was deleted first. The columns are fps, compiles put off, and pipelines failed with0x8007000E.829188e9On this PC, free commit sits at 0.3–2 GB in the world, and this PR is what lifts it over the commit floor. Even with this PR, free physical memory stays under the 1 GB soft floor. #2886's lower floor for pipelines put off again and again is what gets those through. Together they fix the cold-start stall; alone, neither does. The default-off alternative and its numbers are in #3347.
AI use: Claude Code (Claude Opus 5.5) ran these runs and wrote this comment.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nick0451 on 2026-11-30T00:04:01Z.
For whoever merges: six open PRs change the same stall (compiles put off under the commit floor, 0.1–0.3 fps). Here is how they fit together, checked with
git merge-treeagainst main41adb551(v2026.11.29.05) and against each other. This is from reading the diffs only, with no runs.residencyalready doesresidencycounts the commit of the moment only (no pagefile growth)pipeline/make.rs: #2886 + #3474, #2886 + #3398, #3426 + #3474, #3398 + #3426.One semantic point between #2392 and #3426. They go in opposite directions on ≤ 32 GiB hosts:
residencyagree.residency(texture admission, pressure, the critical floor) stop counting it there (limited_host_ram():ullTotalPhys <= 32 GiB).Lyrnc's runs above (32 GB: #2392 + #2886 together 22.4 fps cold, either alone 0.2–0.4) suggest the 32 GB case needs a second piece whichever way this goes.
🤖 Generated with Claude Code