gpu: avoid unrelated range-lock wakeups and linear overlap scans #3292

Manually merged
github merged 1 commit from github-bot/gh-3292 into main 2026-11-30 14:15:03 +00:00 AGit
Owner

@⁠spk-c on GitHub · 2026-11-29 21:22 UTC · original
spk-c:perf/range-lock-overlap → main · +27 −6 · 1 files · 1 commits · merged 2026-11-30 14:12 UTC

What it changes

The watch range lock stores writer ranges sorted and merged, but checks them linearly while holding the state mutex. Reader drops also wake all waiters even when the departing reader is outside the writer's ranges.

Use binary search over the joined intervals and notify waiters only when the departing reader overlaps the pending writer. Writer release still notifies all. Lock ownership and ordering are unchanged.

How it was tested

  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): Not yet tested in-game; planned on RTX 4090, Series X, with matching graphics settings for both runs.
  • Before: linear overlap checks and unrelated reader-drop notifications (source inspection).
  • After: binary overlap checks and targeted notifications (source inspection). FPS and frametimes not measured.
  • For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A.
  • cargo test passed for the crates it touches: no, not yet run. Added a predicate-equivalence regression test; existing concurrency tests retained.
  • Windows CI: run 46311066023 stopped at Clippy because victory-loader::unwind_copy is unused, outside the changed file. No successful test run is claimed.
  • Planned: cargo test -p victory-gpu rangelock --locked and identical streaming-route A/B, comparing CPU preparation time, p95/p99 and displayed FPS.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #3061 changes the timing-sensitive test in the same file, not the overlap predicate; #2650 changes range-lock initialisation in watch.rs; #2439 isolates a related XMem test. No duplicate found in the searched results.

AI assistance

Prepared with AI assistance; gameplay validation and human review remain pending.

**@⁠spk-c** on GitHub · 2026-11-29 21:22 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3292) `spk-c:perf/range-lock-overlap` → `main` · +27 −6 · 1 files · 1 commits · merged 2026-11-30 14:12 UTC ## What it changes The watch range lock stores writer ranges sorted and merged, but checks them linearly while holding the state mutex. Reader drops also wake all waiters even when the departing reader is outside the writer's ranges. Use binary search over the joined intervals and notify waiters only when the departing reader overlaps the pending writer. Writer release still notifies all. Lock ownership and ordering are unchanged. ## How it was tested - GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): Not yet tested in-game; planned on RTX 4090, Series X, with matching graphics settings for both runs. - Before: linear overlap checks and unrelated reader-drop notifications (source inspection). - After: binary overlap checks and targeted notifications (source inspection). FPS and frametimes not measured. - For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A. - `cargo test` passed for the crates it touches: no, not yet run. Added a predicate-equivalence regression test; existing concurrency tests retained. - Windows CI: [run 46311066023](https://github.com/spk-c/VIctory-NVIDIA/actions/runs/46311066023) stopped at Clippy because `victory-loader::unwind_copy` is unused, outside the changed file. No successful test run is claimed. - Planned: `cargo test -p victory-gpu rangelock --locked` and identical streaming-route A/B, comparing CPU preparation time, p95/p99 and displayed FPS. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #3061 changes the timing-sensitive test in the same file, not the overlap predicate; #2650 changes range-lock initialisation in watch.rs; #2439 isolates a related XMem test. No duplicate found in the searched results. ## AI assistance Prepared with AI assistance; gameplay validation and human review remain pending.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 21:27:37 +00:00
github manually merged commit f353a4ff39 into main 2026-11-30 14:15:03 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!3292
No description provided.