GPU: opt-in hot-block pinning in watch::guard (VICTORY_WATCH_PIN, addresses #1238) #1360
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!1360
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1360"
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?
@RustPolaris on GitHub · 2026-11-26 18:10 UTC · original
RustPolaris:pr/watch-hot-block-pin→main· +225 −8 · 1 files · 1 commits · openSummary
Implements opt-in hot-block pinning in
watch::guard(addresses #1238).When a title repeatedly writes to the same non-aliased mapped view blocks every frame (e.g. dynamic constant/instance/ring buffers),
watch::guardpreviously re-armedPAGE_READONLYon every check only for the next CPU write to immediately fault through the VEH and re-openPAGE_READWRITE.With
VICTORY_WATCH_PIN=<N>(0/ off by default):hot_streak) per non-aliased block that did not survive clean across a check.Nconsecutive times without surviving clean, it is pinned (pinned) with a lease ofVICTORY_WATCH_PIN_LEASEchecks (default32, clamped1..=1024).guard_atreports the block dirty without callingVirtualProtect(..., PAGE_READONLY)and leaves itPAGE_READWRITE, avoiding both the re-arm syscall and the next VEH write fault.0, the block is unpinned and re-probed once withPAGE_READONLY; if writes have stopped, it survives clean and clears itshot_streak.Safety invariants
VICTORY_WATCH_PIN=0).open_hereskips streak/pin updates wheneveraliases.contains_key(&block).title_memory_remapped,clear_for_test, anddrop_allclearpinnedandhot_streakalongsideprotected/clean.known_viewandguard_at'sknowncheck includeg.pinned.contains_key(&first)so pinned blocks remain recognized as view memory.pin_config()is eagerly initialized ininstall()before installing the vectored exception handler.Verification
watch::tests::hot_block_pinning_skips_reprotect_and_cools_downcovering threshold promotion, lease countdown without re-protecting, lease-expiry re-probe, cooldown back to clean, and remap cleanup.cargo test -p victory-gpu --lib -- --test-threads=1 --skip depth_bounds_pipeline_loads_and_filters_draws: 223 passed, 0 failed.cargo clippy -p victory-gpu --lib -- -D warningsandcargo clippy -p victory-gpu --lib --features diagnostics -- -D warnings: 0 warnings.VICTORY_WATCH_PIN=4: logged3,723–78,495skippedVirtualProtectre-arms across runs (6–10active pinned blocks at steady state), zero crashes or corruption.Developed with AI assistance (Antigravity).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.