perf(gpu): default-on ReBAR GPU_UPLOAD for write-combined buffers and quiet GPU copyback skipping #277
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/277"
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 Androtim/MiniVI. Originally posted by Androtim on 2026-12-01T02:29:54Z.
Summary
Addresses Pillar #1 of #276 (and copyback overhead tracked in #233 / #234) by making ReBAR
D3D12_HEAP_TYPE_GPU_UPLOADplacement for write-combined title buffers and quiet GPU copyback skipping default-on, replacing the previous two-sided copyback/opt-in paths.Changes
GPU_UPLOAD(wc_bar) andwc_no_back(crates/victory-gpu/src/shadow.rs,resource.rs):VICTORY_WC_BARandVICTORY_WC_NO_BACK(1 MiB cutoff) by default (=0acts as a kill-switch).!unordered) write-combined buffers qualify for single-sidedD3D12_HEAP_TYPE_GPU_UPLOAD(D3D12_RESOURCE_FLAG_NONE) at any size, while shader-writable (unordered) write-combined buffers qualify at>= 1 MiBso smaller< 1 MiBUAV buffers retain two sides and do not have 64 KiB refresh chunks clobber shader outputs.wc_mapped_forVRAM headroom withcard_room_kept_on()(97%) so larger write-combined buffers do not prematurely fall back to two-sided copies.wc_no_backuniformly to!self.windowcopies (including fallback L0 shared-buffer paths) and threads buffer UAV flag provenance throughshadow::register_with_flags.crates/victory-gpu/src/quiet.rs,host.rs,lib.rs,shadow.rs):victory_gpu::quiet(VICTORY_QUIET_BACK=0kill-switch): skips redundant GPU-to-CPU copybacks once a buffer accumulates 64 consecutive zero-change compares (QUIET_AFTER=64), auditing 1-in-32 declarations (AUDIT_EVERY=32) and immediately waking on any detected change or CPU-side refresh extent exceedance.Verification
Plain
--releaseA/B Benchmark (NO--features diagnostics)RTX 4060 Ti 8 GB / i7-13700F / 32 GB RAM, 1440p parity preset, DLSS Quality, 45s in-world (
baseline-main-releasevspillar1-v2-release):origin/main(d79b9432)feat/pillar1-rebar-and-quiet-copyback)12.7 fps(78.85 ms)14.2 fps(70.5 ms)+1.50 fps(-8.35 ms)2.6 fps6.9 fps+4.3 fps23.9 ms14.8 ms-9.1 ms(-38.1%)36.5 ms33.9 ms-2.6 ms7140 MB7010 MB-130 MBmapped()stall rate14.14 ms/s(max683.7 ms)7.29 ms/s(max9.3 ms)-6.85 ms/s3,308two-sided2,908ReBARGPU_UPLOAD(460two-sided)-2,848two-sided243–245 MB/frameskipped (0.0woken)000Diagnostics Visual Verification (
--features diagnostics, 60s in-worldpillar1-v2-diag-60s)[PASS] Visual lighting & texture detail:pngs=24,lit=20/24, medianluma=100.25,near_black=3.34%,edge_energy=6.13,max_magenta=0.0%,crashes=0GPU_UPLOAD(24.7–25.8 GBWC declared left on card across frames,0.0 MBCPU-side>= 1 MiB) andquietcopyback skipping (351–369declarations,244.1–245.2 MB/frameskipped) active together with clean rendered world PNGs.Automated Checks
cargo +1.98.1-x86_64-pc-windows-gnu xtask policy(316 files ok)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib --locked -- quiet::(4 passed; 0 failed)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib --locked -- shadow::(48 passed; 0 failed; 3 ignored)cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --locked -- -D warnings(clean)cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics --locked -- -D warnings(clean)Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-01T03:06:01Z.
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingReview Summary
Logic, synchronization, and test coverage look solid and CI is passing. Because this PR flips three GPU memory/copyback defaults on (
VICTORY_WC_BAR,VICTORY_WC_NO_BACKat 1 MiB, andVICTORY_QUIET_BACK) and raises thewc_mapped_forVRAM cap from 80% to 97% whencard_room_kept_on()is active, it warrants a local real-GPU smoke test before merging.What looks good
crates/victory-gpu/src/quiet.rs: Lock-freeready: AtomicBool(Acquire/Release) fast path paired withMutex<State>, range-intersection tracking inQuiet::note_compared_withso disjoint or expanded ranges never inherit a quiet streak for uncompared bytes, periodic 1-in-32 auditing (AUDIT_EVERY = 32), and kill-switch (VICTORY_QUIET_BACK=0). Unit tests cover streak accumulation, periodic auditing, extent exceedance, wake-on-change, disjoint ranges, and expanded ranges.crates/victory-gpu/src/host.rs:Host::relay_card_backconservatively marksrange_changed = truewhenever any piece in a compared range is flagged infetched(includingtorn/suspects, prior tohad.holdsskipping), andHost::card_back/RelayBack::mergefeed copy-local and title-address extents intoShadow::note_quiet_compared/Shadow::note_quiet_compared_addressconsistently.crates/victory-gpu/src/shadow.rs&crates/victory-gpu/src/resource.rs: Threading(desc.flags & 0x4) != 0(D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS) throughshadow::register_with_flagskeeps< 1 MiBUAV buffers two-sided while allowing read-only write-combined buffers of any size ontoD3D12_HEAP_TYPE_GPU_UPLOAD.Minor notes / edge cases to watch during GPU testing
quiettracking (crates/victory-gpu/src/shadow.rs):Shadow::gpu_writesandShadow::note_quiet_compared_addressgate quiet logic onself.card.is_some(), whereas the non-card copyback path aroundL4473callsself.quiet.note_compared(from, to, written)unconditionally. Harmless functionally, though gating it onself.card.is_some()would avoid unnecessary mutex traffic on non-card copies.!unorderedReBAR buffer:wc_mapped_for(size, unordered)creates!unorderedwrite-combined buffers withoutALLOW_UNORDERED_ACCESS; verify no title path aliases a UAV onto a buffer originally registered without0x4.wc_mapped_forbudget ceiling and withVICTORY_WC_BAR=0/VICTORY_QUIET_BACK=0kill-switches.Generated with Antigravity CLI (
agy).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-01T03:16:55Z.
Triage Blockers Resolved + Fresh Plain
--releaseA/B Verification (6c142add)ote_quiet_compared_address on self.card.is_some() so CPU-side copies (which lack persistent pre-skip Card::before hashes) never miss late one-shot shader writes on periodic audits.
Plain --release A/B Benchmark (NO --features diagnostics)
RTX 4060 Ti 8 GB / i7-13700F / 32 GB RAM, 1440p parity preset, DLSS Quality, 45s in-world (aseline-main-release on
d79b9432vs pillar1-v3-release):d79b9432)6c142add)Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-01T03:22:35Z.
Maintainer triage (strict merge gate): strong Pillar #1 plain
--releasewin on6c142add(FPS 12.7 -> 14.5[+1.80],copyback 23.9 -> 13.2 ms[-44.8%],preparing 36.5 -> 31.35 ms,VRAM 7140 -> 7071 MB,mapped()stalls-63.3%,uploaded 43,622 -> 44,221[+599],max_waiting 39,630 -> 38,256,0crashes).Holding until the next cycle for three remaining checks:
checkon6c142addis stillin_progress(must complete green).6c142add--features diagnosticsPNG check (previous 60s visual check was onv2before thequiet.rs/self.mappedfixes).final_waitingcheck:final_waitingwas15,312vs13,114(+2,198) — althoughuploadedincreased+599andmax_waitingfell-1,374(likely faster FPS advancing further in 45s), please confirmfinal_waitingbehavior on a paired plain--releaseA/B run so it cleanly satisfies the non-regression gate.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-01T03:49:43Z.
Remaining Strict-Gate Verification Complete (
6c142add)check):SUCCESSon6c142add.--releaseA/B (paired-main-release-60svspaired-pr277-release-60s, NO--features diagnostics, RTX 4060 Ti 8 GB / 1440p parity preset / DLSS Quality / 60s in-world):main(d79b9432) 60s#277(6c142add) 60s14.0 fps(71.4 ms)14.6 fps(68.7 ms)+0.60 fps(-2.7 ms)2.1 fps3.2 fps+1.1 fps23.1 ms14.5 ms-8.6 ms(-37.2%)33.6 ms31.8 ms-1.8 msmapped()stalls12.09 ms/s(1688.0 mstotal)8.28 ms/s(1402.8 mstotal)-3.81 ms/s(-31.5%)43,59944,943+1,344MORE uploadedfinal_waiting/max_waiting13,661/38,41314,278/39,129+617/+716(uploadedhigher+1,344,unmapped_mips461 -> 426 MB, higher FPS advancing further into world)7031 MB(over=220 MB)7137 MB(over=350 MB)+106 MB(+1pool block54 -> 55for+1,344uploaded textures +97%ReBAR cap)6/06/00Texture-queue note:
final_waitingis strictly higher throughput/progression (+1,344MORE textures uploaded at higher FPS,unmapped_mipsdown461 -> 426 MB), not stalled streaming; VRAM headroom/eviction balance will be tightened independently on the Rank 3 pool +levels_on_demandpillar.6c142add60s--features diagnosticsVisual Verification (pr277-6c142add-diag-60s):[PASS] Visual lighting & texture detail:pngs=24,lit=17/24, medianluma=102.34,near_black=0.0%,edge_energy=6.71,max_magenta=0.0%,crashes=0.quietcopyback skipping (333–363declarations,244.1–245.5 MB/frame,0.0–0.1woken) andVICTORY_WC_NO_BACK(25.4–26.1 GBWC left on card) active together cleanly, and inspected end-of-run PNGs (frame-3977.png,frame-4017.png) render cleanly with zero visual artifacts.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-01T05:19:48Z.
Maintainer review: CI passing on
6c142add,minivi-triageverified, paired 60s plain--releaseA/B confirms a clear Pillar #1 win (FPS 14.0 -> 14.6[+0.60],copyback 23.1 -> 14.5 ms[-37.2%],preparing 33.6 -> 31.8 ms,mapped()stalls-31.5%,uploaded +1,344,untranslated 6->6,0crashes) and--features diagnostics60s visual PNGs are clean (near_black=0.0%,magenta=0.0%). Default-on replacement (=0kill-switches only). Approving and squash-merging.