gpu(watch): skip VirtualQuery in write-fault waits using OPEN_DONE #143
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!143
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/143/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-29 15:26 UTC · original
Androtim:feat/iter144-watch-fault-ask-open-done→main· +163 −11 · 1 files · 2 commits · merged 2026-11-29 21:26 UTCReduces
VirtualQueryaddress-space lock contention incrates/victory-gpu/src/watch.rs:OPEN_DONE(set right afteropen_unlockedmakes a block writable, cleared beforeOPENING.clearinsettle) so concurrent write faults wait without taking the Windows address-space lock viaVirtualQuery.AGAIN/again_at(with opt-outVICTORY_FAULT_ASK=1restoring Windows queries).fault_again_caps_rapid_retries_and_resets_across_addresses_or_delay.Verification
cargo +1.98.1-x86_64-pc-windows-gnu xtask policy(304 files ok)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu watch:: --locked -- --test-threads=1(50 passed; 0 failed)cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets(--lockedand--features diagnostics --locked,-D warnings)@Androtim on GitHub · 2026-11-29 16:04 UTC · original · edited 2026-11-29 19:04 UTC
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingReview Summary
Logic, memory ordering, and fallback behavior in
crates/victory-gpu/src/watch.rslook solid, and CI is passing.Verified Details
OPEN_DONElifecycle (open_unlocked,settle):OPEN_DONE.set(block)runs only afterVirtualProtect(..., PAGE_READWRITE, ...)succeeds (done == true), andsettleclearsOPEN_DONEbeforeOPENING.clear(block)under theGuardslock. BecauseBitsusesSeqCstforset/clear/anyandunsettled()blocks re-guarding whileOPENINGis set, concurrent faults observingOPEN_DONEsee a block that has been made writable.AGAIN/again_at,RECENT_OPEN):again_atcaps consecutive retries per thread/address within 1 ms (MOST = 8in theOPEN_DONEwait,1in the!PROTECTEDfast path) and refreshes the timestamp while saturated so persistent faults fall through towritable(at)(VirtualQuery) and normal exception propagation.RECENT_OPENgates the!PROTECTEDfast retry so genuine unguarded write AVs on blocks never opened bywatchpropagate on the first fault without an extra retry.ours.is_some()) bypass bothagain()shortcuts and preservefail(exit)handling.VICTORY_FAULT_ASK=1cleanly restores the previousVirtualQuerypath for A/B comparison.fault_again_caps_rapid_retries_and_resets_across_addresses_or_delaycovers retry capping, time/address resets, per-thread isolation, andwas_recently_opened.Next Step
Because this modifies the live VEH write-fault wait/retry path in
on_write(including extending theOPEN_DONEspin/yield window up to 2 ms), a local real-GPU smoke test under active multi-threaded gameplay/streaming is recommended before merging.Generated with Antigravity CLI (
agy).@Androtim on GitHub · 2026-11-29 18:05 UTC · original
Rebased onto
origin/main(9d8b3646, including#140and#147) and addressed theminivi-triagefeedback at1c416e1f:!PROTECTEDfast retry to blocks actually opened bywatch:RECENT_OPENcache (note_recent_open/was_recently_opened) populated byopen_unlocked(whenVirtualProtectsucceeds) and fault-pathg.opened(block)ininstall().!PROTECTEDretry (again(at, 1)) ininstall()onwas_recently_opened(block)so genuine unguarded non-watch write access violations propagateEXCEPTION_CONTINUE_SEARCHon the first fault without an extra retry.fault_again_caps_rapid_retries_and_resets_across_addresses_or_delayto coverwas_recently_opened/note_recent_open.Local Verification
cargo +1.98.1-x86_64-pc-windows-gnu xtask policy:305 files okcargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked -- watch:: --test-threads=1:51 passed; 0 failedclippy --all-targets -- -D warnings(default and--features diagnostics): 0 warnings@Androtim on GitHub · 2026-11-29 21:26 UTC · original
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).