victory-gpu: fast-path refresh flushes and pending checks #22
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22"
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-11-28T06:55:01Z.
Summary
Reduce submitting-thread per-frame refresh flush overhead across
crates/victory-gpu/src/watch.rs,crates/victory-gpu/src/shadow.rs, andcrates/victory-gpu/src/host.rs:watch::journal_kept()and checkjournal().keptat the very top ofask_ahead()before filtering ranges, checkingpublished(), allocatingpieces, or sorting.rangesand callingask_ahead/ask_ahead_doneinhost.rswheneverwatch::journal_kept()is true.Shadow::has_pending(AtomicBool, maintained underShadow::pendinginwritingandcopy_back_done) sowrites_pending,writes_pending_in, andnothing_newbypass lockingpendingon buffers with no in-flight GPU writes, plus unit testshadow::window_tests::has_pending_tracks_writing_and_copy_back_done_without_dropping_checks.wide_eachbuffer refresh loops inhost.rsinto 32-item slices viaHost::refresh_span_chunkwith chunk-localskippedaccumulation before a singleFLUSHES[2]update, while keeping due-texture refreshes 1-per-item.Rig Specs Tested On
13th Gen Intel(R) Core(TM) i7-13700FNVIDIA GeForce RTX 4060 Ti(8 GiBVRAM)32 GiBWindows 11 Home (Build 26300)/ NVIDIA Driver32.0.16.2124Run Settings & Profile
release&--release --features victory-gpu/diagnostics@c3ef1583614a330da73e130da4e697b928e785d2(0non-system MinGW DLLs each)series-soffDLSS qualityoffVICTORY_*Overrides:D:\victory-build\verify-tools\verify-world.ps1withpr22-diag.exe,-GoldenDataDir 'D:\victory-data\golden-data-minivi',-WorldSeconds 75,-AutoNudgeMenudock->balcony), 75s in-world telemetry (14world windows, max11,361draws/frame)Measurements & Verification
preparingdropped to58.7 ms(vspr21-readback-pool64.4 msandpr19-typed-uav60.35 ms); steady-state balcony ran7.3–10.1 fpswith50.8–55.7 mspreparing andrefreshes~18.1–21.4 ms(vspr2122.3 ms). Raw 14-window median landed on2.95 fpsbecause 8 windows captured dock PSO warmup (2.4–2.9 fps) vs 6 balcony windows;final_waiting=4,381(vs7,121baseline). VisualsPASS:lit=8/24,luma=104.8,edge_energy=6.98,magenta=0.0%(inspectedframe-8024.png&frame-9120.png).offcard accountinglogged 0 samples (sweep threshold not hit), whilecopystatlast reported:[2m2026-11-28T06:52:45.852623Z[0m [32m INFO[0m [2mvictory_gpu::copystat[0m[2m:[0m memory of textures: 7878 title textures have no host copy yet (7158 MB of title memory); host copies the host renders to or writes: 642 alive 1120 MB; host copies the title fills: 31606 alive 3084 MB (31551 of them placed), 4914 let go 437 MB and 45 made again 4 MB since the start; 38410 host copies made in all; passes that made none for lack of room: 0; the card: 6038 MB in use of a budget of 6981 MB, 5678 MB of the PC's memory shared with it in use0(crashes=0,no_host_texture_errors=0)cargo +1.98.1-x86_64-pc-windows-gnu xtask policy(294 files ok)cargo +1.98.1-x86_64-pc-windows-gnu test -p xtask(6 passed; 0 failed)cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings(0warnings)cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features victory-gpu/diagnostics -- -D warnings(0warnings)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu(449 passed; 0 failed; 36 ignored, includinghas_pending_tracks_writing_and_copy_back_done_without_dropping_checks,refresh_tests, andwide_refresh_tests)Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T07:03:18Z.
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingReview Summary
Logic and concurrency look solid across all three files, and CI is passing. Because this modifies the D3D12 host submission/refresh hot path and write-watch/pending-write synchronization, a local real-GPU smoke test is recommended before merging.
Verified Changes
crates/victory-gpu/src/watch.rs:journal_kept()(journal().kept) and hoists theif journal().kept { return; }guard to the top ofask_ahead(), avoiding unnecessary filtering,published()checks,Vecallocation, and sorting when the submission's single asking already stands. Behavior is strictly equivalent since the original early return had no preceding side effects.crates/victory-gpu/src/host.rs:aheadwith!crate::watch::journal_kept()inBatch::refresh_frontandBatch::flush_all, skippingrangesconstruction andask_ahead/ask_ahead_donecalls when the kept journal is active.wide_eachbuffer refresh dispatch into 32-item slices viaBatch::refresh_span_chunk(with chunk-localskippedaggregation into a singleFLUSHES[2]atomic update) while keepingduetexture refreshes 1-per-item. Slice bounds (div_ceil(32),(start + CHUNK).min(len)) handle0, partial, and exact-multiple lengths cleanly.crates/victory-gpu/src/shadow.rs:Shadow::has_pending: AtomicBoolinitialized tofalseinShadow::new, updated withOrdering::Releasewhile holdingself.pendingin bothShadow::writing(card and non-card paths) andShadow::copy_back_done.Shadow::writes_pending,Shadow::writes_pending_in, andShadow::nothing_newwithhas_pending.load(Ordering::Acquire)before lockingself.pending. Since allpendingmutations andhas_pendingstores occur underself.pending's mutex, the fast path cannot miss a previously published pending write or race withcopy_back_done.window_tests::has_pending_tracks_writing_and_copy_back_done_without_dropping_checkscovering the fullwriting->writes_pending*/nothing_new->copy_back_donelifecycle.Note: This is an independent technical review, not formal maintainer approval.
Generated with Antigravity CLI (
agy).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T21:11:12Z.
Real-GPU Playtest Report (Combined Build 1 Stack — RT OFF)
Tested in combined Build 1 (
origin/main+ Build 1 PRs#2, #3, #4, #6, #7, #9, #10, #11, #12, #14, #15, #18, #19, #22, #25, #26, #27, #33, #34, #36, #40, #43, #44, #46) on NVIDIA GeForce RTX 4060 Ti (8 GB), Windows, Series S (quality-720p, DLSS Quality):1a-build1-world.log) — 0 crashes, 0 DRED resets, clean exit.28.2 fps(35.4 ms/frame) mid-run,16.9 fps(59.3 ms/frame,4,446draws/frame) in heavy scene.tearing=true,0refused presents.926c46bab3b86bd6): Translated and built host PSO cleanly.VICTORY_THIN_GATE): Active (0no free dynamic descriptor slotswarnings).6,934 MBin use (33texture blocks =2,112 MB,1,036 MBfree),0bogusPOOL:errors.16,577upscalings (0failed).8,802textures were still queued /206non-RT draws dropped without a host pipeline; no D3D12 errors.