Repository navigation
memguard: count pagefile growth as commit left, as residency does - #2392
Conversation
The memory guard read the commit left from ullAvailPageFile, the limit of the moment. With a system-managed pagefile that limit sits a few GB above the commit during the world load, so the guard stayed at its 4096 MB floor: 1,325 to 1,354 driver compiles put off in each of three runs (RTX 5080, 32 GB RAM, Series X, 1440p and 4K), their draws dropped, 0.1 to 0.2 fps, while residency::available_commit saw 83 GB that could still be committed. figures_now now takes residency::available_commit (the limit of the moment plus what the pagefiles may still grow by, held to their volume's free space less 8 GB; VICTORY_COMMIT_GROWTH=0 keeps the limit alone), so both passes count commit the same way (trustno1-coder#339). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I tested clean
On 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. |
Review: Request changesPR #2392 makes compile admission and residency use the same commit-headroom estimate (
Coverage and style: No new regression tests. The admission tests at Windows Clippy ( Policy: Not verified: Windows tests (not run; no Windows), live pagefile behaviour, claimed performance improvement, full all-features GPU or HLE linting. |
fainty0
left a comment
There was a problem hiding this comment.
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.
- Don't treat potential expansion as available commit (
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. - Preserve process limits (
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. - Reconcile growth with fresh samples and apply caps per volume (
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–239 take precomputed headroom; crates/victory-gpu/src/residency.rs:403–411 checks 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-thread unwrap() or assets. VICTORY_COMMIT_GROWTH inherits a direct env read at crates/victory-gpu/src/residency.rs:41; use toggled! if changing that path.
Windows Clippy (829188e → 3ae5f5c): Both gates fail on both refs. --keep-going reports 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 --staged passed 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.
|
Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch |
|
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 |
|
Independent confirmation: I wrote the same 2-line change last night (same 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.
The 23 memguard/compilemem/residency tests passed with it. Clippy has nothing on the changed lines. 🤖 Generated with Claude Code |
|
Additional Windows 11 laptop test on RTX 4060 Laptop (8 GB), i7-13650HX and 32 GB RAM. Baseline was v2026.11.29.01 (829188e). 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). |
|
A/B confirmation on Stock official exe
With this patch:
The two runs are not a controlled FPS comparison: frame generation was
|
- No native AA carried from an older Series S picture to Series X; the start names the upscale mode; F1 saves the mode with a console change. - Idle textures are let go when the card is full, under host memory pressure too (from upstream PR trustno1-coder#2591). - FSR 3 frame generation's presenter sleeps and waits for its fence (upstream PR trustno1-coder#2371). - The lock-free refresh check wired back (upstream PR trustno1-coder#2175). - slot_evict honours busy (upstream PR trustno1-coder#2173); the memory guard counts pagefile growth (upstream PR trustno1-coder#2392). - A failed FSR dispatch has the title's state set again; early jitter is logged. Run on an RX 7800 XT as v2026.11.29.02-amd2-test2 for eleven minutes at FSR Quality with frame generation 2x: no error, no device loss, 0 failed upscales. A like-for-like speed comparison with amd1 is still to be done (docs/amd-results.md). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…h as commit left, as residency does trustno1-coder#2392 by Brillanc3, head 3ae5f5c.
|
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 829188e. Cold means the driver pipeline cache was deleted first. The columns are fps, compiles put off, and pipelines failed with
On 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. |
|
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
One semantic point between #2392 and #3426. They go in opposite directions on ≤ 32 GiB hosts:
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 |
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), Residency: count what the pagefiles can still grow by as commit left (no false memory pressure with RAM free) #339 (merged, the same correction for the residency pass).🤖 Generated with Claude Code