gpu(shadow,watch,land): lock-free refresh checks, scoped pool dispatch, and zero-clone card_dirty #161
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/161"
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-29T20:21:42Z.
## Summary
watch,shadow):PageEpochs(WRITTEN_EPOCHS) mirroringJournal::writtenand lock-freeKEPTmirror inwatch.rs, plusahead_snapshot_into,nothing_new_with, andnothing_new_single(preserving PR #147title_memory_decommittedjournaling andcontains_intervalbinary search).Shadow::copiedmutex withcopy_lock, atomic per-pageBox<[AtomicU64]>stamps, and SeqLock-protectedranged_seq/rangedfor zero-locknothing_new/nothing_new_withreads.land,shadow,host):AtomicUsizework cursor inland::Pool::eachand scoped batched dispatch (wide_each_scoped) inshadow.rs/host.rs, removing per-flush heap cloning/allocations while keeping PR #145's UAV pool intact.card_dirty(shadow,host,host/send,host/upcheck):Arc<Vec<(usize, usize)>>acrosscard_dirty,SentRuns,upcheck::record, andsend::take/Own::sendinstead of cloning range vectors every frame.Test plan
cargo run -p xtask -- policy: passedcargo test -p victory-gpu watch:: -- --test-threads=1: passedcargo test -p victory-gpu shadow::: passedcargo test -p victory-gpu land::: passedcargo test -p victory-gpu host::: passedcargo clippy --workspace --all-targets(default and--features diagnostics) with-D warnings: passedImported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T20:27:58Z.
### Live GPU Verification (RTX 4060 Ti 8 GB, Series S, 60s In-World via
verify-world.ps1)ok: true)pr158-texbackbaseline:9.4 fps(106.0 ms) to10.7 fps(93.6 ms) (+13.8% FPS, peaking at12.0 fps/83.4 mssettled)51.7 msto44.3 ms(copiesdown from26–28 msto17.7 msin settled windows)world_windows=15,max_draws=11308crashes=0,no_host_texture_errors=0used_max=5513 MB/budget_min=6491 MB(over=0 MB,room_false=20.0%)uploaded=44808,final_waiting=4116,max_waiting=26338mapped_rate=6.08 ms/world_sec(14600calls,longest=9.1 ms)pngs=24,lit=16/24,median_luma=103.26,near_black=0.0%,edge_energy=6.94,magenta=0.0%(verifiedframe-2480.pngandframe-3544.png)Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T21:04:11Z.
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingReview Summary
Logic, memory ordering, and concurrency invariants look solid, and CI is passing. Because this PR rewrites hot-path synchronization in
victory-gpu(host.rs,shadow.rs,watch.rs,land.rs,host/send.rs,host/upcheck.rs), it warrants a local real-GPU smoke test before merging.What Was Verified
watch.rs,shadow.rs,host.rs):PageEpochs(WRITTEN_EPOCHS) correctly covers 128 TiB of 64 KiB pages (2^15 * 2^6 * 2^10 = 2^31pages) with lock-free CAS allocation andRelease/Acquireepoch stores/loads, mirrored fromJournal::note.KEPTmirrorsJournal::keptin bothask_restandask_once_end.Shadow::copy_staledefersself.copied[i].store(now, Ordering::Release)until afterself.take_all(runs), preventing lock-freenothing_new_with/nothing_new_singlereaders from observing updated epochs before bytes are copied.Shadow::ranged_lockfree+copy_stalefollow the standard atomic SeqLock protocol (store(seq+1, Relaxed)+fence(Release)+ payload stores +store(seq+2, Release)paired withload(Acquire)+ payload loads +fence(Acquire)+load(Relaxed)), with no Rust data-race UB.Shadow::nothing_new_with(Batch::refresh_front,Batch::refresh_ahead,Batch::flush_all) is already gated onwatch::light().shadow.rs,land.rs,host.rs):wide_each_scopedbounds the lifetime-erasedScopedWorkpointer strictly byscoped_running == 0andq.scoped.take()before returning or resuming unwind, avoids lost wakeups onworkers.idleunderworkers.queue, and falls back inline on nested/contended calls.land::Pool::eachreplaces per-item mutex locking with anAtomicUsizecursor while keepingstate.work = Noneandstate.running == 0synchronization intact.card_dirty(shadow.rs,host.rs,host/send.rs,host/upcheck.rs):Arc<Vec<(usize, usize)>>acrosscard_dirty,SentRuns,send::take,Own::record, andupcheck::record.Minor Notes (non-blocking)
crates/victory-gpu/src/shadow.rs(Shadow::stale_under_writes), the comment abovecopy_lock.lock()still references queryingwatch::askedbefore lockingself.copiedto avoid lock-order inversion with the now-removednothing_new_in. Sincenothing_new/nothing_new_withno longer acquirecopy_lock, the code is safe, but the comment is stale.Verdict
needs-gpu-test— run a local real-GPU gameplay smoke test (including defaultVICTORY_ASK_ONCE/VICTORY_RELAYpaths) to verify live buffer coherency and scoped worker stability under real frame load.Generated with Antigravity CLI (
agy).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T21:27:33Z.
Automated RTX 4060 Ti 8 GB Open-World A/B hardware verification PASSED (
playtest/wave5vsorigin/mainb1b6dc1,VICTORY_LEVELS_ON_DEMAND=0play-parity):cargo test(RTX 4060 Ti): 645 passed, 0 failed (victory39/39,victory-shaderemit::wave64_tests19/19 &lower19/19,victory-gpu568/568).scripts/verify-world.ps1, DLSS Quality + open-world save):9.4 fpsvs7.5 fps(+1.90 fps / +25%), min8.3 fpsvs0.8 fps, preparing53.6 msvs60.0 ms5760 MBvs6005 MB(-245 MB,0 MBover budget);no room for new oneshalved (9,000vs18,000);max_waitingdropped (36,432vs41,431)0mismatches (other_bytes=0, showed_another_view=0, failed=0vs5and2on baseline)mapped_rate1.63 ms/svs6.9 ms/s(-76%, max12.9vs51.9 ms)frame-5975.png,frame-5983.png),edge_energy=4.69vs3.88,near_black=0.02%,magenta=0.0%(and#1412bf6800showed zero visual artifacts).