GPU: opt-in system-RAM budget for idle windows #77
No reviewers
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX!77
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-77"
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?
@Adika713 on GitHub · 2026-11-26 02:15 UTC · original
Adika713:mem/system-ram-window-budget→main· +238 −6 · 2 files · 1 commits · merged 2026-11-26 08:17 UTCWhat and why
The reported problem is host RAM pressure, but PR #72's new watermark reads DXGI
LOCALVRAM only. This adds an opt-in host-RAM pressure band and caps only idle title-window copies when the process or the PC is under pressure. It does not change a larger pagefile or hide commit exhaustion.What is in it
host::RamBand/ram_band()/ram_sample(): Calm, Watch and High bands from process working set, private bytes, free physical RAM and commit headroom. Process and machine thresholds are fractions of total physical RAM and commit limit; free-RAM and headroom floors are absolute. Entering Watch/High needs higher pressure than leaving it, so one sample near a threshold does not toggle policy.VICTORY_WINDOW_BUDGET_MB, off by default. Unset or0keeps today's sweep exactly. With a positive value, Watch caps unique idle-window bytes at that many MiB and reduces the idle timeout to 10 s; High halves the byte cap and reduces it to 2 s. A failed Windows query leaves the band and cap unchanged.shadow::window_victims()removes only the oldest still-idle, still-unreferenced copies until the unique bytes fit the cap. A copy standing under several keys is counted once. The same safety checks as the existing sweep apply: no list, descriptor slot or submission may hold the copy or its buffer.Tested
RX 6950 XT (RDNA2), Ryzen 5 3600, 32 GB, Windows 11. Exact command in an isolated target dir:
cargo test --locked -p victory-gpu --lib -- --test-threads=1ram_band: 3 passed / 0 failed.window_budget: 2 passed / 0 failed.victory-gpulib: 330 passed / 1 failed / 34 ignored, 365 tests, exit 101. The only failure is the pre-existingdescriptor::host::tests::views_are_made_beside_the_heap_and_copied_in; base0a43566has the same failure (325 passed / 1 failed / 34 ignored, exit 101). No new failure.Logs:
_agent_reports\logs\mem-window-budget-lib.logand.exit.txtin the local report tree.Not tested
No game run: the local window is black, and target RX 7900 XTX / i9-12900K / 64 GB hardware is unavailable. No working-set, commit, FPS-percentile or visual before/after claim is made. This branch overlaps
shadow.rsandhost.rswith PR #72 and will conflict if both are merged as-is; the two approaches should be reconciled before merge.AI use
OpenCode, model Big Pickle.
@iLucasRT on GitHub · 2026-11-26 03:57 UTC · original
Tested on an RX 7900 XTX 24 GB, Ryzen 7 5800X3D, 64 GB RAM, Windows 11, on top of this repo's main with
VICTORY_WINDOW_BUDGET_MB=2048. One 25-minute session played into the open world (run YP4), compared with the same build without this PR (YP3, same save, same settings).Window copies peaked at 6.2 GB (5.0-5.9 GB most of the session), against 9.2 GB in YP3 by minute 11.
Process private bytes levelled off at about 40 GB for the whole 25 minutes; YP3 was at 42-43 GB by minute 11.
Free commit stayed at 4-6 GB most of the session (lowest 1.8 GB); in YP3 it fell to 1.1-1.2 GB, and the device was lost at minute 12 after an 18 s stall with no work of ours on the card. YP4 ran its full 25 minutes with no device loss.
Caveat: the same build also kept fewer empty 64 MB texture blocks while commit is short, and included #24 and #87, so not all of the gain is this PR's. The window share (about 3-4 GB less) is this PR's alone. On a 64 GB machine the Watch band is mostly entered through commit headroom, not through private bytes against the commit limit.
Thanks!
@avatarmanz on GitHub · 2026-11-26 07:56 UTC · original
Merged into main in the next push (tests pass); thanks.
@MoonYueya on GitHub · 2026-11-26 09:42 UTC · original
RTX 3080 (10 GB) measurement of
ffc2cf6, opt-in path enabled withVICTORY_WINDOW_BUDGET_MB, againstf59a315of MoonYueya/VIctory-Kira (this repo'se2a28ecplus the open NVIDIA PRs, without this one).Setup as in the PR #72 comment: Ryzen 7 7700, 31.1 GB, Windows 11, driver
32.0.16.1742, same save and switch set, per-build caches, 480 s per run,
unattended into the world.
f59a315So: on this machine the PR does what it says and costs nothing measurable.
Frame time improves rather than degrades,
lack of roomdrops by 79% at thetighter setting, and the picture numbers stay within 2% of the control.
Two honest limits on what this shows.
sweep:line at all andthe live window copies were only ~1.6-2.0 GB, so that run really proves
"merging the PR with the switch on does not regress", not "the budget
works". Only the 256 MiB run actually put the cap in force.
under 2 GB for most samples, commit headroom 1.5-3 GB), so the band logic
is exercised but the Calm path is not. Someone on a 64 GB machine would
see a different mix, as iLucasRT's 25-minute YP3/YP4 comparison showed.
One number moved the other way and I could not attribute it:
passed over unmappedrose from 2,516 to 11,298 / 12,000. Frame time andlack of roomboth improved in the same runs, so I do not think it is a regression in the
usual sense, but I did not isolate it and would not want it read as a claim
either way.
Three black frames out of 51 in the 2048 MiB run are the one thing I would
flag for a second look: the 256 MiB run and the control both had zero, and
the control's own
black framewarnings are all in the first 22 frames(menu/loading), not in the world. Given the sampling density (one picture
every 8th world frame) I am treating it as sampling noise, but it is worth
one longer run before this is called clean.
Verdict here: keep it, default off as it is. It is a strictly-additive path
that changes nothing unless the variable is set, and when it is set the cost
is inside the noise floor.
AI-assisted: an AI agent ran the builds, runs and measurements.
@MoonYueya on GitHub · 2026-11-26 16:04 UTC · original
Correction to my RTX 3080 comment above (same machine, same
ffc2cf6code in MoonYueya/VIctory-Kira).I wrote that at 2048 MiB "the cap never engaged". That reading was wrong, and so was calling the variable a cap.
What the code does. In
let_go_idle(crates/victory-gpu/src/shadow.rs), withVICTORY_WINDOW_BUDGET_MBunset or 0,keepisu64::MAXand the sweep takes the(0..eligible.len()).collect()path, so it lets go of every eligible window copy. With the variable set,keepfollows the RAM band: in Calm it staysu64::MAX(every eligible copy goes, as unset), in Watch it is the budget, in High half of it, and the sweep lets copies go only down tokeep. So a set value keeps the same or more idle window copies than leaving it unset, never fewer. In practice the variable is a floor, not a ceiling.What the earlier logs show. Running
ram_bandagain over thememory:lines of my four earlier runs, the band was High for most samples in each of them (69 to 76 of 81 to 87). In the runs with a budget, the eligible bytes settled right atbudget / 2, the High value: 1,028 MB for 2048, 260 MB for 512, 132 MB for 256. So the band was working. Only the 256 MiB setting was small enough to come close to the unset behaviour.Three new 430 s runs. All three use the same build, RTX 3080 10 GB, 31 GB RAM. To make the number hold whatever the band, the two budget columns add a local opt-in switch,
VICTORY_WINDOW_BUDGET_ALWAYS=1, on the public branchexperiment/winbudgetof my fork (e89a3d0). It is not part of this PR. In these runs the band was High for only a minority of samples, which is why the switch was needed.Each column is a single run. The three runs reached different scenes (median draws per world frame 4,517 / 4,930 / 6,300), so I am not reading anything into frame time from these.
If the intent of the PR is "under RAM pressure, keep idle window memory below N", it would need to evict down to N when usage is above it, rather than keep up to N. Marvisak/VIctory
63bcca4uses that high/low-mark shape for card textures. I have not written that change. The earlier 13 % frame time / 79 %lack of roomnumbers at 256 MiB were single runs with this PR merged against a control build without it, in possibly different scenes, so please treat them as unexplained rather than as evidence for the cap.Measured and written with AI assistance.