Park emulated MONITORX/MWAITX waits on GPU fence signals #1020

Open
github-bot wants to merge 1 commit from github-bot/gh-1020 into main AGit
Owner

@⁠Lkxex on GitHub · 2026-11-25 16:24 UTC · original
Lkxex:perf/park-console-fence-waits → main · +267 −3 · 8 files · 1 commits · open

The frame pacing notes in 465b94f report about 280,000 emulated MONITORX/MWAITX exceptions per second on Intel while the title polls a layer-owned graphics fence. The current handler spins at each MWAITX, so a thread that cannot advance keeps reentering the exception handler.

With VICTORY_MONITOR_FENCE_WAIT=1, the GPU layer registers the exact address it exposes for a fence. MONITORX captures a generation ticket for a registered address, and MWAITX consumes it and can use WaitOnAddress with a requested 1 ms timeout. Publishing a fence value advances the generation and wakes the waiters. Capturing the generation before the wait handles a signal between MONITORX and MWAITX. The ticket owns the wake word independently of the fence so release and address reuse are safe. The handler never reads the guest-supplied address, falls back to the existing hint for unknown addresses or a busy registry, preserves Windows last error across the wait, and leaves the title's condition check in place. The switch is off by default.

On Windows with a Ryzen 5 5600, a synthetic producer issued 64 signals per run. The benchmark invoked the actual emulation functions directly:

Run Emulated pairs, off Emulated pairs, on Wall time, off / on
1 374,629 78 210.7 / 212.3 ms
2 368,799 73 214.2 / 212.6 ms

Both modes observed all 64 signals. The test counts emulation calls, not OS exceptions, and there is no in-game FPS claim. Core tests cover multiple armed waiters, release/reuse, and last error. The GPU fence test with the switch enabled verifies that the actual fence API registers and wakes a ticket and removes it on release.

For an in-game Intel A/B, compare MONITORX/MWAITX exceptions per second in the existing log, the new emulated fence wait counters, and frame times with otherwise identical settings.

AI-assisted.

The diagnostics application also passed cargo check --locked -p victory --features diagnostics.

**@⁠Lkxex** on GitHub · 2026-11-25 16:24 UTC · [original](https://github.com/fxceless/victory-fork/pull/1020) `Lkxex:perf/park-console-fence-waits` → `main` · +267 −3 · 8 files · 1 commits · open The frame pacing notes in 465b94f report about 280,000 emulated MONITORX/MWAITX exceptions per second on Intel while the title polls a layer-owned graphics fence. The current handler spins at each MWAITX, so a thread that cannot advance keeps reentering the exception handler. With VICTORY_MONITOR_FENCE_WAIT=1, the GPU layer registers the exact address it exposes for a fence. MONITORX captures a generation ticket for a registered address, and MWAITX consumes it and can use WaitOnAddress with a requested 1 ms timeout. Publishing a fence value advances the generation and wakes the waiters. Capturing the generation before the wait handles a signal between MONITORX and MWAITX. The ticket owns the wake word independently of the fence so release and address reuse are safe. The handler never reads the guest-supplied address, falls back to the existing hint for unknown addresses or a busy registry, preserves Windows last error across the wait, and leaves the title's condition check in place. The switch is off by default. On Windows with a Ryzen 5 5600, a synthetic producer issued 64 signals per run. The benchmark invoked the actual emulation functions directly: | Run | Emulated pairs, off | Emulated pairs, on | Wall time, off / on | | --- | ---: | ---: | ---: | | 1 | 374,629 | 78 | 210.7 / 212.3 ms | | 2 | 368,799 | 73 | 214.2 / 212.6 ms | Both modes observed all 64 signals. The test counts emulation calls, not OS exceptions, and there is no in-game FPS claim. Core tests cover multiple armed waiters, release/reuse, and last error. The GPU fence test with the switch enabled verifies that the actual fence API registers and wakes a ticket and removes it on release. For an in-game Intel A/B, compare MONITORX/MWAITX exceptions per second in the existing log, the new emulated fence wait counters, and frame times with otherwise identical settings. AI-assisted. The diagnostics application also passed cargo check --locked -p victory --features diagnostics.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:56:08 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1020/head:github-bot/gh-1020'
git switch 'github-bot/gh-1020'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1020'
git switch 'github-bot/gh-1020'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1020'
git switch 'github-bot/gh-1020'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1020'
git switch 'main'
git merge --squash 'github-bot/gh-1020'
git switch 'main'
git merge --ff-only 'github-bot/gh-1020'
git switch 'main'
git merge 'github-bot/gh-1020'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.