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.

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.

1 participant