GPU: coalesce write-watch intervals, batch 64 KiB AVX2 shadow takes, and cut lock/job churn #54
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: launcher
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
run report
security: hold
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs gpu test
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Androtim--MiniVI!54
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/54/head"
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?
@Androtim on GitHub · 2026-11-28 15:51 UTC · original
Androtim:feat/iter68-cpu-watch-shadow-batching→main· +354 −144 · 5 files · 2 commits · merged 2026-11-29 04:45 UTCSummary
Ported VRAM-neutral CPU/lock/batching optimizations from
CHECK6960/Victory-Nvidia-optimized(4d51f6b,f322a44,c51df9f), strictly preserving MiniVI's 8 GiB VRAM limits:watch.rs&host.rs: Coalesces write-watchaheadintervals in place usingpartition_pointlookups, and introducesReadJournalso flush retain loops acquire the read lock once and drop it cleanly before kernel asks or updates.shadow.rs: Combinescopiedandrangedunder oneMutex<CopiedState>, mirrors!pending.is_empty()inhas_pending: AtomicBoolto skip mutex locks on empty pending ranges, checks lock-free flags +ReadJournal::coveredbefore acquiringcopied, and batchesShadow::takeup to64 KiBchunks with AVX2word_runsand coalescedcard_runs. Adds unit testsword_runs_match_dword_runs_across_64kib_chunk,ranged_in_matches_latest_covering_span, andahead_intervals_coalesce_and_match.descriptor.rs&host/send.rs: Runs single-chunksync_heapsjobs inline, merges multi-workerSyncPartaccumulators through a single mutex, pre-countssend::takeruns/words to avoid over-allocation, and runs small scatter batches (<= 1chunk or< 2048words) inline.Rig Specs Tested On
Run Settings & Profile
diag@22f759f(after verifying plain--releasehas zero non-system MinGW DLL imports)series-s— 720p (0.6666667)offDLSS qualityoffVICTORY_*Overrides:verify-world.ps1default settings (initial run hit transient async shader-compileA/B Pipeline dropsjitter at272vs261.0; rerunr2passed all 11/11 gates)draws >= 500), 75s capture across 16 world windowsMeasurements & Verification
10.08mean /11.3median (min0.6, p106.9, max draws11201; vs baseline8.9fps median)5756.5 MBmedian /5778 MBmax against6833 MBmin budget (0 MBover budget,room=false8.3%; baseline5864 MBmax)0(no_host_texture_errors=0,final_waiting=1817vs7121baseline,mapped_rate=32.92 ms/s,resident_rate=100.45 ms/swith longest99.2 ms,median_dropped_no_pipeline=261.5vs261.0baseline,lit=19/24,luma=103.94,edge_energy=7.15,magenta=0.0%; all 11/11 verifier gates PASS)cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy(297 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 -p victory-gpu -p victory --features diagnostics --all-targets -- -D warnings(0warnings)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib -- --test-threads=1(453 passed; 0 failed; 36 ignored, incl. all 3 new tests)cargo +1.98.1-x86_64-pc-windows-gnu build -p victory --release+objdump -p(0non-system MinGW DLLs)@Androtim on GitHub · 2026-11-28 19:04 UTC · original · edited 2026-11-29 00:04 UTC
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingSummary
This PR ports CPU-side lock, batching, and write-watch lookup optimizations across
crates/victory-gpu:watch.rs&host.rs: Sorts and mergesaheadintervals viacoalesce_intervals+contains_interval(partition_pointlookup), and addsReadJournalsoBatchflush loops (host.rs) acquireJOURNAL.read()once perretainpass and drop it before kernel queries.shadow.rs: Combinescopiedandrangedunder a singleMutex<CopiedState>, skipspendingmutex locks viahas_pendinginwrites_pending,stale_under_writes, andmerge_under_writes(updatingland_teststo keephas_pendingin sync), moveswatch::askedahead of lockingself.copiedinstale_under_writesto prevent lock-order inversion withShadow::nothing_new_in, and batchesShadow::takeinto 64 KiB chunks (TAKE_CHUNK) withword_runs(AVX2 fast path withdword_runsfallback) and coalescedCARD_RUNS.descriptor.rs&host/send.rs: Runs single-chunksync_heapswork inline, consolidates multi-workerSyncPartmerges behind one mutex, pre-countssend::takeruns/words, and runs small scatter batches (work.len() <= 1 || total_words < 2048) inline.Review Notes
stale_under_writesproperly queriescrate::watch::askedbefore lockingself.copied, preserving consistent lock order (JOURNAL->Shadow::copied) withShadow::nothing_new_in.Shadow::takesafely boundstitle.resize(TAKE_CHUNK.min(to - from), 0)(every iteration hasn <= TAKE_CHUNKandn <= to - from), andword_runschecksat % 4 == 0 && title.len() % 4 == 0 && title.len() == held.len()before dispatching toword_runs_avx2, falling back todword_runsotherwise.coalesce_intervals/contains_intervalare covered byahead_intervals_coalesce_and_match;ranged_inand 64 KiBword_runsparity are covered byranged_in_matches_latest_covering_spanandword_runs_match_dword_runs_across_64kib_chunk.Shadow::takenow incrementsSEND[1](unchanged bytes diagnostic counter) only when an entire 64 KiB chunk has no diffs rather than per 4 KiB page, which is harmless for runtime behavior.victory-gpuwithout altering VRAM budgets.Verdict
Logic and concurrency look solid, and CI is passing. Because this modifies core D3D12 host synchronization, write-watch journaling, and 64 KiB shadow-copy hot paths, a local real-GPU smoke test is recommended before merging.
Generated with Antigravity CLI (
agy).@Androtim on GitHub · 2026-11-28 23:29 UTC · original
Rebased onto
origin/main(9a2e92b) and addressed the triage review findings (031951a):Changes
crates/victory-gpu/src/shadow.rs—Shadow::stale_under_writes): Queriescrate::watch::asked(a, e)before lockingself.copied, soself.copiedis never held acrossJOURNAL.read()(eliminating the deadlock hazard withShadow::nothing_new_in, which acquiresJOURNAL.read()beforeself.copied).crates/victory-gpu/src/watch.rs,shadow.rs): Movedfaultbook::note(What::Known, ...)intoReadJournal::covered()and replacedReadJournal::nothing_new()withReadJournal::nothing_new_covered()soShadow::nothing_new_indoes not repeatpublished/contains_interval.Verification (
031951a)cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy:asset policy: 301 files okcargo +1.98.1-x86_64-pc-windows-gnu test -p xtask:6 passed; 0 failedcargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings:0warningscargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics -- -D warnings:0warningscargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib -- --test-threads=1:487 passed; 0 failed; 36 ignored--release(2m05s) +objdump -p: Windows system DLLs only;--features diagnostics --release(3m30s).verify-world.ps1 -WorldSeconds 75 -AutoNudgeMenuwithVICTORY_BOOK=0while #71 is pending merge tomain): 11/11 gates PASS —10.85 fpsmedian (+1.95 fpsvs8.9 fpsbaseline),43,770textures uploaded (1,976 MB),3,908final waiting (-3,213vs7,121baseline),1 msmaking host copies /14–17 msmaking slots' views per 5s window,5,495 MBpeak VRAM /6,553 MBmin budget (0 MBover),0crashes,luma=105.64,near_black=0.0%,edge_energy=6.94(frame-8029.png&frame-8997.pngvisually verified).@Androtim on GitHub · 2026-11-29 04:45 UTC · original
Automated RTX 4060 Ti 8 GB A/B hardware verification passed (
playtest/wave2vsorigin/main1ab5d84):cargo test(RTX 4060 Ti):victory-shaderlds_sub(1/1),emit::wave64_tests(14/14),victory-gpu(505/505) — 520 passed, 0 failed.scripts/verify-world.ps1, DLSS Quality + golden autosave):77.25 ms) vs 3.20 fps (308.8 ms) baseline (+10.25 fps / 4.2x faster)max_draws=3122vs29940crashes /0DRED6174 / 6903 MB(-25 MBvs baseline,0 MBover budget)final_waiting=7638vs12258(-4620)frame-7969.png,frame-8409.png), no regressions vsorigin/main.