Repository navigation
victory-gpu: size-tiered card-buffer headroom and fence-safe LRU demotion - #347
Vladimir-Human wants to merge 1 commit into
Conversation
|
For information: I tried this PR in an integration build on 🤖 Generated with Claude Code |
374971e to
00109da
Compare
|
@Skyfrye Rebased onto current
|
…tion Ports fxceless/victory-fork#1280 (addressing fxceless/victory-fork#1163 and 8-12 GB VRAM starvation) onto AnyXboxX while preserving RwLock BUFFERS/SHAPE/FOUND, fold_buffers, transient windowup chunks, and VICTORY_WINDOW_REBAR: - Reserves min(256 MiB, cap / 3) (tunable via VICTORY_CARD_LARGE_RESERVE_MB) inside VICTORY_CARD_BUFFERS_MB for >= 1 MiB buffers when VICTORY_CARD_BUFFERS_MIN_KB < 1024, and guards < 1 MiB admissions above 85% DXGI usage without inflating CARD_REFUSED[1]. - Adds fence-safe LRU demotion of cold, fence-completed < 1 MiB card buffers back to host RAM (never touching hot >= 1 MiB buffers, transient/rebar windows, or in-flight/referenced buffers) on large-buffer shortfall (bounded multi-batch, post-reacquire TOCTOU re-validation) and >= 88% DXGI pressure (hysteresis target 84%, surrendering freed bytes via CARD_PRESSURE_RELEASED so resource::room() genuinely gains streaming VRAM headroom). - Serializes all direct Host::queue operations (ExecuteCommandLists, Signal, UpdateTileMappings) via leaf mutex QUEUE_SUBMIT / host::queue_lock(), uses transient L0 staging dropped after each batch with DemoteCopy reset on error and CloseHandle on drop, preserves all GPU and pending CPU dirty bytes bit-exact, and adds unit + D3D12 WARP tests.
00109da to
18e7731
Compare
|
Rebased onto |
|
Noting that #409 ( |
Problem
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