GPU/watch: skip the kernel write-watch asking for known guarded view memory (~3,600 failing kernel calls and ~6-8 ms of submitting-thread CPU per frame) #670
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!670
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-670"
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?
@Jonirulah on GitHub · 2026-11-25 04:20 UTC · original
Jonirulah:view-ask-skip→main· +55 −10 · 2 files · 1 commits · openwatch::writesasksGetWriteWatchfirst for every range that the submission's single asking did not cover, and goes to the guards only after that call fails. View memory, meaning the guards' protected or absent blocks, can never be write-watched. So every flush of a copy over view memory paid one failing kernel call before the guards answered.This change checks the guards' sets first and skips the kernel call for those ranges. The guards' answer is the same as before.
VICTORY_VIEW_ASK=1(or the existingVICTORY_GUARD_ASK=1) brings the old behaviour back for A/B runs.Diagnostics builds get two new per-frame counters, printed before the barrier-waits line: askings that failed in the kernel, and askings skipped for known view memory.
Measurements
Setup:
--console series-s.c96b4f2plus a few local patches (#188 is needed for Series S).VICTORY_PIPELINE_WAIT_MS=24 VICTORY_LEAN_WINDOWS=1 VICTORY_WINDOW_KB=1024 VICTORY_WINDOW_TAILS=1 VICTORY_INPLACE=1.Medians once the world draws (≥1000 draws/frame):
VICTORY_VIEW_ASK=1(old)About 3,600 failing kernel calls and about 6–7 ms of submitting-thread CPU are gone per frame. Frame time does not change measurably: the ±12 ms difference is within run-to-run noise with 11–13 reports per run, and copying back (~230 ms/frame) dominates the frame in this scene.
This saving is on the submitting thread. With #648 (
VICTORY_CARD_FETCH_INFLIGHT=1), the relay's ~140 ms/frame wait for fetches is gone and that thread's preparing now sets the frame. Measured together with #648 (same diag build and config plusVICTORY_CARD_FETCH_INFLIGHT=1, steady part ≥ 120 s after the world appears, one run each):About 17 ms of submitting-thread CPU per frame is gone. Frame time drops by 17 ms here, but with one run each that cannot all be attributed to this change.
Tests (this branch, on
310c6eb)cargo test -p victory-gpu: 118 passed, 0 failed.cargo test --workspace --no-fail-fast --exclude victory-shader: all passed.cargo test -p victory-shader --lib: 4 failures (emit::valu_tests::ds_min_max_f32_order_floats_and_return_the_old_value,v_permlane16_and_x16_read_the_lanes_their_selectors_pick,whole_wave_f64_sum_and_cvt_f32_f64,emit::waterfall_tests::lanes_load_from_the_buffer_their_nested_arms_chose). These come frommain: this change does not touchvictory-shader, and that crate does not depend onvictory-gpu.cargo clippy --workspace --all-targets -- -D warningsfails onmain's own code, in files this change does not touch:resource.rs:2257(placed_filler_twinsunused),draw.rs:2339(sort_unstable_by_key) andindirect.rs:1322(depth_writtennever read). Neither changed file adds a warning.cargo xtask policy: 169 files ok.🤖 Generated with Claude Code
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.