Skip to content

gpu: keep the page guard lock when no mapping query is needed (opt-in) - #653

Open
Blitzball996 wants to merge 1 commit into
trustno1-coder:mainfrom
Blitzball996:perf/keep-guard-lock
Open

Blitzball996 wants to merge 1 commit into
trustno1-coder:mainfrom
Blitzball996:perf/keep-guard-lock

Conversation

@Blitzball996

@Blitzball996 Blitzball996 commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Change

guard() checks the bitmap of absent blocks while holding GUARDS. When there are no uncertain blocks, it releases and immediately reacquires the mutex before examining dirty blocks. VICTORY_KEEP_GUARD_LOCK=1 keeps the existing guard across that empty interval. Ranges that need a Windows mapping query still release the mutex for the query and revalidate the result after reacquiring it. The switch is opt-in and supports VICTORY_AB in diagnostics builds.

In a 24-second diagnostics capture, 286 of 2,312 samples of the submitting thread were waiting for watch::guards from writes during a buffer refresh. This is a count of sampled stacks across the guard path. It does not isolate time spent on the second acquisition.

Measurements

RTX 4070 SUPER, i7-14700KF, Series S profile, DLSS Performance (960x540 to 1920x1080), frame generation disabled. The two release runs used the same save and launcher settings on a local branch containing upstream a4d05e7. The table uses median base FPS from five-second reporting windows with zero pipelines being compiled, 55 to 155 seconds after entering the world.

Reporting windows Off On
All qualifying windows 17.7 (19 windows) 17.7 (20 windows)
11,000 to 11,999 draws/frame 11.1 (5 windows) 11.8 (5 windows)

In a separate diagnostics run, VICTORY_AB=6,VICTORY_KEEP_GUARD_LOCK alternated the switch every six seconds. Of seven adjacent off/on pairs within 5% in draw count, six had lower mean frame time with the switch. The median paired difference was -1.5 ms. Independent runs can differ in streaming and scene timing. The full release run showed no overall FPS gain.

Verification

cargo test --offline --locked -p victory-gpu watch::tests:: -- --test-threads=1 passed all 35 tests on the PR branch with the switch set to 0 and again with it set to 1.

Related work in #516 changes fault handling and the collection of soft-view ranges in the same guard path.

The branch targets main at 8fc2254. PR #687 addresses the upstream CI failures independently.

@NotADonky43

Copy link
Copy Markdown

Tested #653 adapted onto our d4b5d51-based cumulative, retaining the newer soft-view lookup under GUARDS after reacquisition. Same optimized executable off/on, 37 watch tests passed per side (including alias and late-fault cases). Windows RTX 5070 Ti, Series X, 1440p DLSS Quality, no FG, identical precompiled shaders/native pipeline library and starting state. Both reached settled heavy rendering and closed at milestone.

One opening pair: across 7 off vs 6 on heavy reports with no pipelines compiling, median reported preparation was 47.6 vs 39.7 ms/frame, but the median of their present-interval p95s was 68.5 vs 67.4 ms, and p99s 77.0 vs 77.4 ms. Not scene-matched (median draws/frame 3401 vs 3230; copied 45.3 vs 50.1 MB/frame). No proven tail or FPS improvement; retaining as a separate opt-in experiment. These timings do not directly measure GUARDS lock duration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants