victory-gpu: size-tiered card-buffer headroom and fence-safe LRU demotion #180
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!180
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-180"
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?
@Vladimir-Human on GitHub · 2026-11-26 10:34 UTC · original
Vladimir-Human:perf/vram-tiered-card-eviction→main· +2063 −174 · 7 files · 1 commits · openSummary
Ports size-tiered card-buffer headroom reservation and fence-safe LRU demotion of cold small (
< 1 MiB) card buffers fromfxceless/victory-fork#1280(originally#1163) ontoavatarmanz/VIctory-7900XTX, while preserving all existingVIctory-7900XTXcard-buffer and queue features.Motivation
When
VICTORY_CARD_BUFFERS_MIN_KB < 1024(e.g.64KiB) is used, a burst of small (< 1 MiB) card buffers can fillVICTORY_CARD_BUFFERS_MBor push DXGI local video memory above the admission threshold before large hot (>= 1 MiB) vertex/storage buffers arrive, forcing large buffers back to host RAM or causing VRAM pressure spikes on 8–12 GB GPUs.Key Changes
crates/victory-gpu/src/shadow.rs)min_bytes < 1 MiB, reservesmin(256 MiB, cap / 3)insideVICTORY_CARD_BUFFERS_MB(overridable viaVICTORY_CARD_LARGE_RESERVE_MB) exclusively for>= 1 MiBbuffers (CardAdmit::ReservedForLarge, tracked bycard_reserved_large_rejects).< 1 MiBcard admissions at85%DXGI local video-memory usage without incrementingCARD_REFUSED[1], socard_room_kept()remains intact for>= 1 MiBbuffers.CARD_PRESSURE_RELEASEDand subtracts it incard_room_kept_for(...)so DXGI-pressure demotions genuinely release headroom back toresource::room().< 1 MiBcard buffers (crates/victory-gpu/src/shadow.rs,host.rs,host/upq.rs,host/upcheck.rs,tiles.rs,descriptor/host.rs)< 1 MiBcard buffers (Arc::strong_count == 1,host::references == 1,pending.is_empty(),last_fence <= completed_fence) back to host RAM in place by reusingcard.staging— never evicting>= 1 MiBbuffers, in-flight buffers, or descriptor-referenced buffers.DemoteCopy, up to16 MiBper batch, transient L0 staging dropped immediately after each batch,*slot = Nonereset on error,Dropclosing its Win32 eventHANDLE) and merges GPU-written bytes strictly outsidecard.dirtyfor bit-exact preservation.Host::queueoperations (ExecuteCommandLists,Signal,Wait,UpdateTileMappings) acrossHost::submit(lateand sync),card_before,card_land(QUEUE_ORDER -> QUEUE_SUBMIT),card_back,demote_readback,upq::send,upcheck::run, andtiles::Tiledvia the narrow leaf mutexQUEUE_SUBMIT(host::queue_lock()), always released before any fence wait.note_submitted_shadowson bothsubmitpaths, marks UAV-bound buffers viashadow.note_gpu_written()indescriptor::host::buffer_uav, and re-validatesentry.end/buf_len/size/big/ existing shadow inlookup()after re-acquiringbuffers()across bounded multi-batch demotion (DEMOTE_MAX_PASSES,cap_shortfall.max(dxgi_shortfall)).card_demoted_count,card_demoted_bytes, andcard_reserved_large_rejectsin theMetercard-buffer log line.VICTORY_CARD_LARGE_RESERVE_MB,VICTORY_CARD_DEMOTE=0,VICTORY_CARD_PRESSURE_PCT(default88).VIctory-7900XTXbehaviordefault_card_limits_mb/resolve_card_limits/card_limits, theSEEN = 1 GiBcap incard_room_kept(),VICTORY_CARD_ALL=1PC-RAM two-sided fallback (counted: false, in_pc_ram: true),crate::port::place_forandcrate::inplace::place_for,BUFFERS_CHANGEDinvalidation, andcard_before1-barrier-per-buffer coalescing.Verification
cargo test -p victory-gpu -- --test-threads=1: 376 passed; 0 failed; 34 ignored (includes existingwindow_tests::card_limits_scale_with_local_vram_budgetand all 7 newshadow::vram_tier_tests::*).VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --lib vram_tier_tests -- --test-threads=1: 7 passed; 0 failed (0 D3D12 debug layer errors/warnings on WARP).cargo test -p victory-gpu --features diagnostics --lib vram_tier_tests -- --test-threads=1: 7 passed; 0 failed.cargo test -p victory-gpu --lib tiles -- --test-threads=1: 4 passed; 0 failed; 1 ignored.cargo clippy -p victory-gpu --all-targets -- -A deprecated: 0 warnings in touched files.git diff --check&git merge-tree --write-tree origin/main HEAD: clean.Credits
Ported from
fxceless/victory-fork#1280(#1163).31991d8b41to4cc03c8856@Vladimir-Human on GitHub · 2026-11-27 07:17 UTC · original
Rebased cleanly onto latest
main(014d52d) at4cc03c8:shadow.rs: Resolved the single conflict by preserving upstreamBY_ADDRESS_CARD_BYTESandvram_breakdown()alongsideCARD_PRESSURE_RELEASEDand the tiered admission/demotion state.host.rs(522,026 B < 512 KiB) &host/demote.rs: ExtractedDemoteCopy/demote_readback_run/demote_readback_hostintocrates/victory-gpu/src/host/demote.rsto keephost.rs < 512 KiB, and verified all runtimeHost::queueoperations holdQUEUE_SUBMIT(queue_lock()).VICTORY_D3D12_DEBUG=1 VICTORY_REAPER=1):xtask policy273 files ok;clippy -p victory-gpu --all-targets -- -A deprecated(default &diagnostics) 0 warnings in touched files; default HWshadow:: tiles:: descriptor:: resource:: texture::110 passed; 0 failed; 5 ignored; WARPdiagnosticsvram_tier_tests tiles::10 passed; 0 failed; 1 ignored.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.