victory-gpu: size-tiered card-buffer headroom and fence-safe LRU demotion #347
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!347
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-347"
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:37 UTC · original
Vladimir-Human:perf/vram-tiered-card-eviction→main· +2034 −205 · 4 files · 1 commits · openProblem
Ports
fxceless/victory-fork#1280(addressingfxceless/victory-fork#1163and 8–12 GB VRAM streaming dips):VICTORY_CARD_BUFFERS_MIN_KB=64is combined withVICTORY_CARD_BUFFERS_MB=1024(or smaller caps), thousands of small< 1 MiBbuffers fill the flat card-buffer cap first and starve hot>= 1 MiBbuffers back to PC RAM.Changes
Preserves all existing
AnyXboxX/ Neptune features (RwLockBUFFERS+SHAPE/FOUNDcache,fold_buffers, transientwindowup::Chunkwindows, andVICTORY_WINDOW_REBAR) while adding:shadow.rs):VICTORY_CARD_BUFFERS_MIN_KB < 1024, reservesmin(256 MiB, cap / 3)(env-tunable viaVICTORY_CARD_LARGE_RESERVE_MB;0disables) insideVICTORY_CARD_BUFFERS_MBfor>= 1 MiBbuffers (CardAdmit::ReservedForLarge, incrementingcard_reserved_large_rejects).< 1 MiBcard admissions above85%DXGI usage without inflatingCARD_REFUSED[1], preservingcard_room_kept()for upcoming>= 1 MiBbuffers.< 1 MiBcard-buffer demotion (shadow.rs,host.rs,descriptor/host.rs,tiles.rs):(used, access_tick), GPU flight fences (last_fence: AtomicU64, stamped inHost::submit), and UAV/shader write state (Card::gpu_written).card.staging.is_some()and0 < card.size < 1 MiBthat pass all guards after bumpingSHAPE(SeqCst):Arc::strong_count == 1,host::references(&shadow.buffer) == 1,pending.is_empty(), andlast_fence <= completed_fence(+ unchanged fence across readback).>= 1 MiBbufferCapFull/DxgiPressureinlookup_tables(exactcard_admit_shortfall, skips futile partial demotion, up to 4 bounded 16 MiB batches, re-validatesentry.end >= endand recomputesbuf_len/size/bigafter re-acquiringBUFFERS).>= 88%(VICTORY_CARD_PRESSURE_PCT, targeting84%hysteresis) inHost::sweep, adding freed bytes toCARD_PRESSURE_RELEASEDsoused + card_room_kept()inresource::room()genuinely drops for streaming textures.Host::queueoperations (ExecuteCommandLists,Signal,UpdateTileMappings) via leaf mutexQUEUE_SUBMIT/host::queue_lock().DemoteCopyon error (closing its Win32 eventHANDLEonDrop), and merges every byte outsidecard.dirtyintocard.stagingbefore promotingcard.stagingtoshadow.buffer. Opt-out viaVICTORY_CARD_DEMOTE=0.shadow.rs,host.rs):card_demoted_count,card_demoted_bytes, andcard_reserved_large_rejectsviacard_tier_stats()and the periodic card-buffer log line.Verification
VICTORY_D3D12_DEBUG=1 cargo test --manifest-path third_party\victory\Cargo.toml -p victory-gpu vram_tier_tests -- --test-threads=1: 7 passed; 0 failed (0 D3D12 debug errors)cargo test --manifest-path third_party\victory\Cargo.toml -p victory-gpu --features diagnostics --lib vram_tier_tests -- --test-threads=1: 7 passed; 0 failedcargo test --manifest-path third_party\victory\Cargo.toml -p victory-gpu -- shadow --test-threads=1: 40 passed; 0 failedcargo test --manifest-path third_party\victory\Cargo.toml -p victory-gpu -- tiles --test-threads=1: 4 passed; 0 failed; 1 ignoredcargo clippy --manifest-path third_party\victory\Cargo.toml -p victory-gpu --all-targets: 0 warnings in added/modified linescargo run --manifest-path third_party\victory\Cargo.toml -p xtask -- policy:asset policy: 199 files ok@Skyfrye on GitHub · 2026-11-26 14:43 UTC · original
For information: I tried this PR in an integration build on
mainat2cc6593(after #358 and #377), stacked with #354, #345 and my #278, #279, #292, #307, #360-#362, #381 and #382. It no longer applies tomain. The conflicts are in what the code does, not just neighbouring lines: host.rs (3:QUEUE_SUBMITandcard_sent_lockedaround the same Execute/Signal calls #354 changes for its fence stamping), shadow.rs (2:note_access/note_gpu_writtennext to #377's sanitizer, and the buffer copy's construction). I left it out of that build rather than guess at the merge. A rebase on currentmainwould let it in the next one.🤖 Generated with Claude Code
374971effeto00109da2d6@Vladimir-Human on GitHub · 2026-11-26 15:12 UTC · original
@Skyfrye Rebased onto current
main(26c11d4, post-#358/#377/#367/#383; new head00109da):shadow.rs: preserved#377(0b0deab,VICTORY_CLAMP_AFTER_WRITERsanitizer) ahead ofnote_access()/note_gpu_written()inShadow::gpu_writes, switched buffer creation to#340'snote_carded(&shadow)(Card::me/FLAGGED), and preservedCard::printsalongside the tiered admission / LRU demotion logic.host.rs&tiles.rs:QUEUE_SUBMIT/queue_lock()remains wrapped strictly around directHost::queueExecuteCommandLists/Signal/UpdateTileMappingscalls (if stacked with#354, fence stamping inside those sameExecuteCommandLists+Signalcritical sections can stay inside the existingQUEUE_SUBMITscope).cargo xtask policy(214 files ok),cargo clippy -p victory-gpu --lib --tests(0 new warnings), andVICTORY_D3D12_DEBUG=1victory-gpu --lib(shadow::45/45 incl. allvram_tier_tests,tiles::3/3; default &diagnosticsruns show only the 3 pre-existingmainfailures indescriptor::host::tests::spans_say_the_next_start_and_the_lowest_level_viewedandindirect::tests::warp_card_*).00109da2d6to18e773162f@Vladimir-Human on GitHub · 2026-11-26 19:11 UTC · original
Rebased onto
main(50936c0->18e7731, keeping #429'shost::queue_lock()+runs.len() == 1fast path intiles.rs).Verified locally:
cargo xtask policy(215 files ok),cargo clippy -p victory-gpu --features diagnostics --all-targetsexit0;tiles::7/7(1 ignored,VICTORY_D3D12_DEBUGunset) andshadow::45/45passed (descriptor::30/31with only upstreamspans_say_the_next_start_and_the_lowest_level_viewedfailing).@Vladimir-Human on GitHub · 2026-11-26 19:19 UTC · original
Noting that #409 (
37d4686) replacedthird_party/victorywith the combinedavatarmanz + cool_foxbase, putting this branch inCONFLICTINGright after the50936c0rebase.The clean
avatarmanz-lineage version is open atavatarmanz/VIctory-7900XTX#180(andfxceless/victory-fork#1280); happy to re-port onto37d4686+once#409settles if you want it here.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.