GPU/watch: batch GetWriteWatch queries by memory reservation #1365
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!1365
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1365"
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?
@spk-c on GitHub · 2026-11-26 18:48 UTC · original
spk-c:submit/watch-reservation→main· +473 −5 · 3 files · 1 commits · openScope
Opt-in
VICTORY_WATCH_RESERVATION=1with ask-once. Classify requests by Windows allocation, deduplicate/sort, group bounded queries within reservations, journal dirty gap pages, and invalidate cached coverage at commit/remap. Completed external writes publish a fresh epoch and invalidate stale 4 KiB masks. Existing global mapping read permit and ordinary fallback retained; no fork-only remap/UMA dependencies.VICTORY_WATCH_STATS=1reports call/page/region counts. Related to #1279 and #958, but this targets reservation boundaries of GetWriteWatch calls, not VirtualProtect/guard interval batching.Validation on upstream
52ac4ec+ this patch (Windows 10)Locked offline workspace all-target/all-feature cargo check and Clippy -D warnings passed; staged asset policy and diff checks passed.
reservation_gaps_and_racing_writesand explicitly enabledreservation_parallel_readers_and_completed_storagepassed. Both modes of the synthetic 12-case matrix (100/1000/10000 requests, contiguous/fragmented, single/multiple reservations) passed with byte-exact results.One fresh debug A/B pair for 10,000 fragmented ranges / 100 reservations: GetWriteWatch 1307 -> 100 (plus 100 region queries), 4 KiB pages queried 3,895,136 -> 476,800, asking 15.639 -> 8.814 ms, total 39.197 -> 24.207 ms, identical 5,853,184 copied bytes. Single-reservation fragmented case regressed in this pair (5.983 -> 9.433 ms asking). Timing is a single sample, not a median or gameplay claim. Remains opt-in; upstream CI/review pending.
Reproduce with
VICTORY_ASK_ONCE=1,VICTORY_WATCH_STATS=1andVICTORY_WATCH_RESERVATION=0or1in fresh processes:cargo test -p victory-gpu reservation_matrix -- --ignored --test-threads=1 --nocapture.AI-assisted adaptation from Kelvaroq 1270c42, patch 0045 and fork 4f29a77; GPL-3.0-or-later. No proprietary assets.
@Filip722 on GitHub · 2026-11-26 20:35 UTC · original · edited 2026-11-26 20:45 UTC
The exact
d230d52fixture reproduced a Proton compatibility failure here. The dirty-gap regression failed at its first coverage assertion. Wine's allocation query returns valid reservation bounds and leaves RegionType zero, so the batching path classifies the allocation as non-private. Wine revision used by GE-Proton11-14The follow-up uses VirtualQuery only when the flags are zero, verifies the same allocation base and requires MEM_PRIVATE before grouping. The original dirty-gap regression, the concurrent readers/completed-write test and both 12-case matrices passed on the same Bazzite and GE-Proton11-14 environment. In one 10,000-request fragmented, multi-reservation sample, GetWriteWatch calls fell from 1,299 to 100, plus 200 allocation queries. End-to-end time was 9.53 vs 5.92 ms and both copied 5,853,184 bytes. Windows MSVC Clippy with warnings denied and the staged asset policy passed. Tested follow-up commit
In the paired Series S replay on an RTX 5060 Laptop 8 GB, the same 40% launcher and seed rendered the same stationary doorway with both settings. In the common 54-second window the mode changed median GetWriteWatch calls from 389.8 to 350.3 per frame, pages queried from 386,187 to 352,343, and added 63.1 allocation queries per frame. DXGI throughput was 5.537 vs 5.690 FPS and p95 interval was 206 vs 193 ms. The enabled run's earlier geometry-matched window gave 5.302 FPS. Draw counts and storage activity differed, so the gameplay sample shows fewer write-watch calls and a small timing difference that needs repetition.
Assisted by Codex (GPT-6.2-Sol High).
@BitWuehler on GitHub · 2026-11-26 23:07 UTC · original
In-world Linux/Proton corroboration of @Filip722's Wine
RegionType == 0finding above (CachyOS, GE-Proton11-14 / Wine 11.0 Staging, RTX 5080 16 GB, Series X profile,d230d52merged onto52ac4ec):e4245f3base) and after mergingd230d52,copystat's per-frameGetWriteWatchgranularity stayed unchanged: 1,748–1,794 watches/frame for4.31–4.41 GBchecked before (~2.45 MB/call) vs. 2,461–2,515 watches/frame for5.99–6.71 GBchecked withd230d52(~2.55 MB/call).RegionTypeleavesd230d52's reservation batching inactive under GE-Proton11-14 (while falling back safely with0 page faultsacross 4 world runs), so theVirtualQuery-gated follow-up is needed for Wine/Proton to take the batched path.(AI-assisted testing, log analysis, and summary.)
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.