victory-gpu: restore VRAM eviction under host RAM pressure and recycle alias_rt overflow tiles #2591
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!2591
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2591"
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?
@yanggx98 on GitHub · 2026-11-29 14:44 UTC · original
yanggx98:fix/vram-eviction-and-overflow-recycle→main· +139 −26 · 2 files · 1 commits · merged 2026-11-30 14:12 UTCWhat it changes
Fixes three long-session VRAM/FPS degradation issues in
crates/victory-gpu:Restore mapped VRAM texture eviction under host RAM pressure (
crates/victory-gpu/src/resource.rs,let_go_idle):idle_sweep_policy()already setsunmapped_only = falsewhen GPU VRAM itself is pressured so mapped idle textures can still be reclaimed.let_go_idle()still testedif host_idle.is_some()instead ofif unmapped_only. As soon as host RAM dipped belowresidency::host_texture_idle_ms()'s threshold, every mapped placed texture and every non-placed texture hitcontinueeven when VRAM was full, causing VRAM overflow (WDDM PCIe paging to single-digit FPS) and repeated full-table sweeps on the submit thread.if unmapped_only.Clear
r.host.usedwhensweep_unmapped_on()evicts a streamed-out texture (crates/victory-gpu/src/resource.rs):sweep_unmapped_on()detachedmade.take()without clearingr.host.used.store(0, Relaxed)(unlike the mainlet_go_idleeviction path below it), causing already-evicted textures to be re-collected, re-sorted, and re-locked on every subsequent sweep.Recycle
alias_rt::OverflowPooloverflow tiles (crates/victory-gpu/src/alias_rt.rs,crates/victory-gpu/src/resource.rs):take_overflow_tiles()previously bump-allocated 4 MiB Tier-2 heaps monotonically and never freed or reused tiles when aliased render targets were destroyed or whentry_create()fell back.OverflowSlots(with a free list) and an RAIIOverflowLeasestored onHostTextureaftertexture(so theID3D12Resourceis dropped first after GPU fence retirement, then its overflow tiles are returned to the free list for reuse).alias_rt::tests::overflow_slots_recycle_released_tiles_without_growing_chunks.How it was tested
sweep_unmapped_on()clearsused, andalias_rtoverflow tiles are recycled across transient RT lifetimes.cargo testpassed for the crates it touches: yes (cargo test -p victory-gpu --locked alias_rt,cargo test -p victory-gpu --locked idle_sweep,cargo build --release --locked -p victory,cargo xtask policy --staged)Checked for overlap
let_go_idlescan count and addsslot_evictbackoff; does not touchhost_idle.is_some()vsunmapped_only,sweep_unmapped_onusedreset, oralias_rt::OverflowPool)@dyshay on GitHub · 2026-11-29 15:40 UTC · original
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.@LenoreSlate on GitHub · 2026-11-29 21:39 UTC · original
A/B on a 12 GB Ampere card: VRAM stays under budget for the whole session
Setup
cargo build --release --locked -p victory, each in its own worktree and target dirmainmain+ this PR only (d17fd452, merged with no conflict; the diff againstmainis onlyalias_rt.rsandresource.rs)On this machine host RAM and VRAM are both pressured at the same time (≈ 27.5 GB committed of 32 GB, ≈ 6.7 GB of shared GPU memory), so this is the case where
host_idle.is_some()was blocking mapped eviction while the card itself was full.Results (first 27 min of each run, the length of the shorter one)
Exceeded VRAM budgetwarningshost: N fpslines)The run with the PR went on to 35 min and never went over the budget (max 10 050 MB, 0 Streamline budget warnings over the whole run).
VRAM in use over time (mean per 5-minute slice):
Without the PR, VRAM climbs steadily and sits above the budget from about minute 17 onwards. With it, VRAM levels off around 10 GB. This matches the long-session description in the PR.
What I could not confirm
alias_rt). Thephysical-page transient RT aliasing activeline is only logged in the first minutes (before:physical_mb=376 overflow_tiles=339at ≈ 4 min, then no more lines), so the logs can't show whether the overflow pool stops growing over a long session. The VRAM numbers above are most likely dominated by theunmapped_onlyfix.Crashes (one sample each, not attributable to the PR)
a host command list did not close (Paramètre incorrect. (0x80070057)). An earlier 3-minute attempt with the same build ended the same way. This is the known crash (#3098, #2639, #452).DXGI_ERROR_DEVICE_HUNG (0x887A0005)(Streamline:We've lost the Device). Our side reports the submitting thread preparing a submission of 13 lists, nothing of ours running on the card, pipeline library idle. VRAM was ≈ 10 GB, under budget. I have not seen this hang before on this machine, but with a single run I can't tie it to this change. I'll report back if it shows up again with the PR.Code review
I read the full diff. It has no network, process, dependency or build-script changes. Notes:
unmapped_onlyinstead ofhost_idle.is_some(): with VRAM pressured, mapped placed textures now go through the normalmade.take()path with a blockinglock(). That is the same as the pre-existing no-host-pressure path, so I see no new contention.OverflowLeaselifetime: every path that lets aHostTexturego passes it whole tohost::retire(), so the lease (and the tiles' return to the free list) waits for the running submissions.release_overflow_tilestakesSTATE, and no earlyreturn Noneintry_createholdsSTATEat that point, so there is no self-deadlock. The failure path intake_overflow_tilesgives the tiles back beforeST_OVERFLOWis counted, so the stats stay balanced.Tests
cargo test --locked -p victory-gpu --libon ourmain+ this PR: 915 passed, 1 failed (host::uav_pool::tests::host_list_uav_pool_lifecycle_retire_trim_and_info_queue). Rerun alone with--test-threads=1, it passed 3 times out of 3. It shares the global UAV pool stats with other tests, and this PR doesn't touchuav_pool.rs.Verdict from this machine: 👍 for the VRAM part. It does what it says, and VRAM stays under budget for a 35-minute session on a 12 GB card. I measured no FPS improvement here.
@Freeman022026 on GitHub · 2026-11-30 13:53 UTC · original
Tested in a 57-minute soak on a 64 GB RAM system (Ryzen 7 7800X3D, RTX 4090 24 GB, driver 621.14, Windows 11, Series X profile, 2560x1440, DLSS Performance, 2x Frame Generation, RT off), alongside #2486 and
VICTORY_WAIT_RESIDENT=textures,VICTORY_RESIDENCY_HIGH=1,VICTORY_SAMPLED_EVICT=1,VICTORY_SWEEP_AHEAD=1.Without this PR (61-minute baseline on the same machine), once free system RAM fell below 16 GiB,
let_go_idlestopped evicting mapped textures. Peak VRAM climbed to 21,412 MB against a 20,723 MB budget,looks for textures to let goaveraged 73.72 ms across 3,124 sweeps (longest 151.6 ms), medianframe_timeslongestwas 177.8 ms (179.1 ms in active gameplay seconds), and Streamline logged 2,517 frame generation resets over 100 ms.With this PR applied over 57 minutes (0 crashes), peak VRAM stayed at 17,336 MB against a 20,713 MB budget,
looks for textures to let goaveraged 2.93 ms across 3,100 sweeps (longest 19.0 ms), medianframe_timeslongestdropped to 51.9 ms (52.5 ms in active gameplay), and Streamline frame generation resets over 100 ms dropped from 2,517 to 169.