victory-gpu: reclaim idle ahead buffers by default under pressure, back off on sustained OOM/device removal, and report buffer OOMs #2015
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2015"
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 superhero-520 on 2026-11-29T07:26:08Z.
Summary
Rebased cleanly onto
v2026.11.29.05(41adb551), reusing upstreamfirst()(residency::scaled_default(..., 512, 4096)),trim_idle(),RetryGate, anduav_buffer_now(), while keeping the remaining valuable reliability fixes for low-RAM / low-VRAM hosts.Root Cause
crates/victory-gpu/src/ahead.rs):VICTORY_LOWSPEC_ADAPTIVE=1,fill()only paused refills underresidency::pressured() || critical_commit()— and when both pools were already full (!more_shared && !more_card), it looped at the idle sleep without ever checking memory/VRAM pressure or trimming already-allocated idle buffers.crates/victory-gpu/src/ahead.rs):DXGI_ERROR_DEVICE_REMOVED/DEVICE_HUNG,fill()kept attempting buffer allocations instead of checkingGetDeviceRemovedReason(), releasing idle buffers, and exiting cleanly.crates/victory-gpu/src/ahead.rs):RetryGatecaps failure rate at a fixed 50 ms per lane (20 attempts/sec indefinitely during prolonged OOM).crates/victory-gpu/src/host.rs):read_back_buffer,shared_buffer_own, anduav_buffer_nowdid not notifycrate::residency::allocation_error(&e)onE_OUTOFMEMORY.Re-Evaluated Scope on
v2026.11.29.05158d3177lowered the default pre-allocation count on< 24 GiBRAM hosts from4096to512viaresidency::scaled_default(..., 512, 4096).32 MiBshared +32 MiBcard), not the older512 MiBceiling (which still applies on>= 24 GiBRAM hosts with low VRAM or commit pressure).Fix Design
crates/victory-gpu/src/ahead.rs:!more_shared && !more_card), checkresidency::pressured(),residency::critical_commit(), and DXGI local VRAM usage vianext_card_vram_pressure()(enters at>= 85%of budget, clears only at<= 70%, matchingcard_has_room()to prevent reclaim/rebuild oscillation).trim_idle()(updated to drop removed resources outside the lock and return the freed count), cap post-reclaimwanttoKEPT, and loglogical_shared_mb/logical_card_mb.GetDeviceRemovedReason()on allocation failures, during pressure pauses, and periodically when idle; on removal, drop all idle buffers outside locks and exitfill()cleanly.RetryGatewithRetryGate::exponential(50ms, 1000ms)per independent lane (shared_retry,card_retry): escalates50 -> 100 -> 200 -> 400 -> 800 -> 1000 mson consecutive failures and is never reset bypressured()/critical_commit()pauses (resolving earlier review feedback), while leavingRetryGate::default()at fixed 50 ms so upstreamretry_testsstay 100% unchanged.crates/victory-gpu/src/host.rs:crate::residency::allocation_error(&e)in theErr(e)paths ofread_back_buffer,shared_buffer_own, anduav_buffer_now(which triggers only onE_OUTOFMEMORY, ignoring device-removed errors).Verification & Results
Automated & Real D3D12 Tests (RTX 3060 Laptop 6 GiB, Windows 11)
cargo test --locked -p victory-gpu --lib ahead:: -- --nocapture --test-threads=1: 12 passed, 0 failed (0.39s):aheadtests remain intact and passing.exponential_retry_gate_backs_off_to_cap_and_survives_pressure_pauses,default_card_vram_pressure_has_hysteresis_aligned_with_card_room,trim_idle_drops_resources_outside_pool_mutex, andd3d12_trim_idle_releases_real_shared_and_card_buffers_cleanly(uses.expect(...)on buffer creation so allocation failures fail the test; debug layer errors:None).cargo clippy --locked -p victory-gpu --all-targets&--all-features: 0 warnings inahead.rs/ modifiedhost.rslines.cargo check --profile diag --locked -p victory --features diagnostics,cargo test --locked -p victory,cargo build --release --locked -p victory,cargo run --locked -p xtask -- policy --staged: all passed.victory-gpu --libsuite: 924 passed, 2 pre-existing unrelated failures already present on untouched41adb551(shared_root_signatures_load_from_library_and_execute_across_pso_switchesandevery_switch_of_the_translator_is_in_the_key).Live Gameplay Validation (RTX 3060 Laptop 6 GiB + Ryzen 7 5800H + 16 GB RAM)
960×540-> DLSS Performance (Model K) -> output1920×1080, RT OFF, warm pipeline library (0in-world slow loads).C1(FG OFF): reclaimed512idle shared buffers (32 MiBlogical, matching 16 GBscaled_default=512),6.17 FPS(1% Low 1.87), 0 OOM / 0 device-removed.E1(combined with PR #2038, FG OFF): reclaimed512shared (32 MiBlogical),6.63 FPS(1% Low 2.10,P99 391.4 ms), 0 OOM / 0 device-removed.G2(combined with PR #2038 + perf fix, FG OFF): reclaimed512shared +392card =904idle buffers (56.5 MiBlogical),6.47 FPS, 0 OOM / 0 device-removed.C-fsr2/E-fsr2(FSR 3 2X): FSR 3 active (0failed prepare dispatches),512shared reclaimed, 0 OOM / 0 device-removed.Limitations & Known Risks
v2026.11.29.05, the reclaimed logical volume is bounded by upstream's512-buffer cap (<= 64 MiBtotal logical); physical RAM/VRAM savings are modest compared to pre-158d3177builds, though preventing sustained OOM retry churn and exiting cleanly on device removal apply across all RAM sizes.AI Assistance Disclosure
AI-Assisted: Rebased, refined, tested, and documented with AI assistance (Antigravity / Gemini), with all unit/D3D12 tests and live RTX 3060 hardware runs verified locally.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tyr0nsur on 2026-11-30T12:58:50Z.
I tested a follow-up for the DXGI non-local budget at
8a1abb0a. The ahead worker already checks physical RAM, commit and the local DXGI budget. On a discrete GPU, Windows can lower the non-local budget while those checks still leave room for speculative shared buffers (#1520).The patch applies the existing 85% entry and 70% recovery thresholds to the non-local segment. The ahead worker pauses speculative shared refill and returns unused buffers. The block sweep shares the same pressure state, so it can release empty CPU-visible heaps after the normal rest even if releasing the ahead inventory first moved usage below 85%. Local VRAM has its own decision. Demand allocations retain their existing path.
With a simulated budget signal and real D3D12 allocations on an RTX 4060, DXGI non-local usage fell from 36 to 28 MiB after dropping 128 committed ahead buffers, and from 92 to 28 MiB in a separate test after a pooled shared heap became empty. A live view and its resting range kept that heap allocated. Both focused tests also passed on WARP, and the diagnostics suite passed 49 tests. These are standalone tests without a title.
Companion commit
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.