perf(gpu/watch): skip exclusive GUARDS lock on unguarded title_memory_written and share lock in written_since_taken #25
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-logs
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ToLIManl--VIctory-Hydra!25
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/25/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?
@justadudeinbulgaria on GitHub · 2026-12-01 18:15 UTC · original
justadudeinbulgaria:pr/watch-lock-avoidance→main· +8 −5 · 1 files · 1 commits · closed without mergingSummary
Two surgical lock-avoidance wins in
crates/victory-gpu/src/watch.rsthat reduceGUARDSwrite-lock stalls against Renderer Port #6 (VICTORY_PORT_GUARD=1) without replacing Port #6's 64 KiBRwLock+Claimsdesign (inspired byAndrotim/MiniVI#287audit):title_memory_written(): Add an atomicif PROTECTED.any(first, last)fast-path before acquiring exclusiveguards()(mirroring the identical checkviews_mapped()already performs 20 lines below). DirectStorage/page writes into unguarded title memory no longer take an exclusiveGUARDSwrite lock or block concurrent VEH fault handlers.written_since_taken(): Useguards_shared()instead of exclusiveguards()whenport_guard()is active, since it only readsg.clean,g.absent, andg.protected.Verification
crates/victory-shader/*andshader_cache.rsuntouched).cargo test -p victory-gpu --lib watch::tests:: -- --test-threads=1— 31/31 passed onorigin/main(48413c9).PORT_GUARDshared-lock wait dropped from2.93–3.47 msto0.45–0.52 ms(~6x lower), contributing toSUBdropping from51.5 msto32.4–44.8 msand live frametime dropping from104.5 msto85.0–93.4 ms.@ToLIManl on GitHub · 2026-12-02 12:54 UTC · original
Thank you @justadudeinbulgaria! Integrated onto v2.0
mainin commit5d7f3efwith fullCo-authored-bycredit:if PROTECTED.any(first, last)lock-avoidance fast path intowatch.rs::title_memory_written(skipping theGUARDSmutex on unguarded memory writes).written_since_takenRwLockportion didn't apply directly because v2.0watch.rsuses aMutexforGUARDSrather than the olderport_guard()RwLock.)Included in the refreshed
VIctory-Hydra-v2.0-Stage17.ziprelease. Closing since the branch targeted pre-v2.0 history and the change is now landed onmain.Pull request closed