+6% FPS and half the 100 ms hitches: turn on VICTORY_STORE_BESIDE #4492

Closed
github-bot wants to merge 14 commits from github-bot/gh-4491 into main AGit
Owner

@⁠vilaris on GitHub · 2026-11-30 21:11 UTC · original
vilaris:perf/store-beside-refresh → main · +967 −847 · 33 files · 14 commits · closed without merging

TL;DR — turn on VICTORY_STORE_BESIDE=1

The feature already exists on main and is off by default. This PR does not change behaviour: it records the measurements in crates/victory-gpu/src/titlewrite.rs and explains why it is still opt-in. Whoever merges decides whether to flip the default — see "Before making it default" below.

With it, a title store that faults on a guarded block is done beside the guard (through the runtime's own view of the same pages) and the thread goes on, instead of opening the block and making it read-only again afterwards. titlewrite.rs already measures a protection change at ~5 µs, serialized process-wide, with ~590 write faults a frame in the world.

Measurements

RTX 4070, Series S profile, DLSS Quality 1080→1440, frame generation off, release build, same scene, gameplay window only. "Presents/s" is the title's own frame rate (the frame_times line).

Run Switches Presents/s Frames > 100 ms per second Submitting thread Buffer refreshes
Reference A none 15.7 0.39 58.3 ms 23.9 ms
Reference B none 15.8 0.75 56.6 ms 23.9 ms
Opt-in VICTORY_STORE_BESIDE=1 16.7 0.43 57.6 ms 23.9 ms
  • About +6% presents/s; long frames (> 100 ms) roughly halved against reference B and on par with A.
  • The submitting thread and the refreshes are unchanged: the gain is on the title's threads (fewer protection changes on write faults), not on the submission path.
  • No panics or crash reports in any run.

Also measured, for context (not changed by this PR):

  • VICTORY_REFRESH_WHY=1 costs 4–7 ms a frame in refreshes (13.8 presents/s, 1.37 long frames/s with it on). Keep it off when playing or measuring.
  • Turning on two experimental refresh modes on top of this (mapped-view guards and a manual write journal) moved results only within run-to-run noise (17.0 presents/s, 0.31 long frames/s), so they are not part of this PR.

Caveats

  • One run per configuration; scenes were the same but not frame-identical. The reference runs agree with each other (15.7 vs 15.8).
  • Measured with VICTORY_COPY_SHAPE toggled between runs (diagnostics only).
  • A store that the decoder does not understand still opens the block as before, as does a block's fifth store and a hot code site (SITES), so the fallback path is unchanged.

Before making it default

With VICTORY_STORE_BESIDE forced on, cargo test --locked -p victory-gpu --lib on current main goes from 2 failures (list::thin::tests::bindings_record_no_work, shader_cache::tests::every_switch_of_the_translator_is_in_the_key, both already failing on main) to 11. The nine new ones:

  • watch::many_askers_tests::no_write_is_lost_when_faults_take_no_lock
  • watch::many_askers_tests::no_write_through_another_view_is_lost_between_askers
  • watch::many_askers_tests::no_write_to_views_is_lost_between_askers
  • watch::many_askers_tests::no_write_to_resting_views_is_lost_between_askers
  • watch::many_askers_tests::no_mapping_is_lost_between_askers
  • watch::tests::faults_that_take_no_lock_tell_the_same
  • watch::tests::a_write_opens_the_view_it_goes_through
  • watch::tests::what_the_title_puts_in_beside_a_guard_is_told
  • host::refresh_tests::unchanged_ranges_are_known

Some may only expect the old behaviour (a fault opening the block); the no_write_..._is_lost ones check coherence. Each needs to be shown to be the former before the default flips. No corruption was noticed in play, but none was looked for.

How to use it

VICTORY_STORE_BESIDE=1 in the environment or in the F1 menu's settings file.

🤖 Generated with Claude Code

**@⁠vilaris** on GitHub · 2026-11-30 21:11 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4491) `vilaris:perf/store-beside-refresh` → `main` · +967 −847 · 33 files · 14 commits · closed without merging ## TL;DR — turn on `VICTORY_STORE_BESIDE=1` The feature already exists on `main` and is **off by default**. This PR does not change behaviour: it records the measurements in `crates/victory-gpu/src/titlewrite.rs` and explains why it is still opt-in. **Whoever merges decides whether to flip the default** — see "Before making it default" below. With it, a title store that faults on a guarded block is done beside the guard (through the runtime's own view of the same pages) and the thread goes on, instead of opening the block and making it read-only again afterwards. `titlewrite.rs` already measures a protection change at ~5 µs, serialized process-wide, with ~590 write faults a frame in the world. ## Measurements RTX 4070, Series S profile, DLSS Quality 1080→1440, **frame generation off**, release build, same scene, gameplay window only. "Presents/s" is the title's own frame rate (the `frame_times` line). | Run | Switches | Presents/s | Frames > 100 ms per second | Submitting thread | Buffer refreshes | |---|---|---|---|---|---| | Reference A | none | 15.7 | 0.39 | 58.3 ms | 23.9 ms | | Reference B | none | 15.8 | 0.75 | 56.6 ms | 23.9 ms | | **Opt-in** | **`VICTORY_STORE_BESIDE=1`** | **16.7** | **0.43** | 57.6 ms | 23.9 ms | - About **+6% presents/s**; long frames (> 100 ms) **roughly halved** against reference B and on par with A. - The submitting thread and the refreshes are unchanged: the gain is on the title's threads (fewer protection changes on write faults), not on the submission path. - No panics or crash reports in any run. Also measured, for context (not changed by this PR): - `VICTORY_REFRESH_WHY=1` costs 4–7 ms a frame in refreshes (13.8 presents/s, 1.37 long frames/s with it on). Keep it off when playing or measuring. - Turning on two experimental refresh modes on top of this (mapped-view guards and a manual write journal) moved results only within run-to-run noise (17.0 presents/s, 0.31 long frames/s), so they are not part of this PR. ## Caveats - One run per configuration; scenes were the same but not frame-identical. The reference runs agree with each other (15.7 vs 15.8). - Measured with `VICTORY_COPY_SHAPE` toggled between runs (diagnostics only). - A store that the decoder does not understand still opens the block as before, as does a block's fifth store and a hot code site (`SITES`), so the fallback path is unchanged. ## Before making it default With `VICTORY_STORE_BESIDE` forced on, `cargo test --locked -p victory-gpu --lib` on current `main` goes from 2 failures (`list::thin::tests::bindings_record_no_work`, `shader_cache::tests::every_switch_of_the_translator_is_in_the_key`, both already failing on `main`) to 11. The nine new ones: - `watch::many_askers_tests::no_write_is_lost_when_faults_take_no_lock` - `watch::many_askers_tests::no_write_through_another_view_is_lost_between_askers` - `watch::many_askers_tests::no_write_to_views_is_lost_between_askers` - `watch::many_askers_tests::no_write_to_resting_views_is_lost_between_askers` - `watch::many_askers_tests::no_mapping_is_lost_between_askers` - `watch::tests::faults_that_take_no_lock_tell_the_same` - `watch::tests::a_write_opens_the_view_it_goes_through` - `watch::tests::what_the_title_puts_in_beside_a_guard_is_told` - `host::refresh_tests::unchanged_ranges_are_known` Some may only expect the old behaviour (a fault opening the block); the `no_write_..._is_lost` ones check coherence. Each needs to be shown to be the former before the default flips. No corruption was noticed in play, but none was looked for. ## How to use it `VICTORY_STORE_BESIDE=1` in the environment or in the F1 menu's settings file. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
VICTORY_STORE_BESIDE=1 measured +6% presents/s (15.8 -> 16.7) and about half
the frames over 100 ms in the world on an RTX 4070, frame generation off.
It stays off by default: nine watch/refresh tests fail with it on, and it is
not yet shown whether they expect the old block opening or catch a lost write.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 21:16:42 +00:00
Author
Owner

@⁠m335671 on GitHub · 2026-11-30 22:29 UTC · original

A supporting data point from a third CPU family, in case it helps decide the default. These are observations from one machine (RTX 4070 12 GB / Ryzen 9 7900, 12 cores) and one scene, not a general conclusion. AI-assisted (Claude Code).

Release build of 829188e, Series X, 1440p output, frame generation off, the five switches of #2842 on in every run. Scene A of the protocol (the opening cutscene and the first room, unattended, 240 s, ~4,100-4,300 draws). Two rounds, the second in reverse order; averages of the 5 s lines with more than 500 draws (details in #756):

on top of the five fps, r1 / r2 p10 fps submitting thread "preparing"
nothing 24.8 / 25.3 20.0 / 20.1 34.8 / 31.1 ms
STORE_BESIDE=1 26.6 / 26.6 23.9 / 21.1 29.9 / 29.6 ms

STORE_BESIDE was the only single switch of the three we split (TABLE_SAME, RANGE_LOCK) that stayed outside the ±1.5 fps we see between identical runs, and the p10 went up with it. No stops and no visible difference in the captures in those runs. That agrees with burber's indoor result and dyshay's outdoor −1.1 to −1.7 ms in #2415.

**@⁠m335671** on GitHub · 2026-11-30 22:29 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4491#issuecomment-7293911718) A supporting data point from a third CPU family, in case it helps decide the default. These are observations from one machine (RTX 4070 12 GB / Ryzen 9 7900, 12 cores) and one scene, not a general conclusion. AI-assisted (Claude Code). Release build of `829188e`, Series X, 1440p output, frame generation off, the five switches of #2842 on in every run. Scene A of the protocol (the opening cutscene and the first room, unattended, 240 s, ~4,100-4,300 draws). Two rounds, the second in reverse order; averages of the 5 s lines with more than 500 draws (details in #756): | on top of the five | fps, r1 / r2 | p10 fps | submitting thread "preparing" | |---|---|---|---| | nothing | 24.8 / 25.3 | 20.0 / 20.1 | 34.8 / 31.1 ms | | `STORE_BESIDE=1` | 26.6 / 26.6 | 23.9 / 21.1 | 29.9 / 29.6 ms | `STORE_BESIDE` was the only single switch of the three we split (`TABLE_SAME`, `RANGE_LOCK`) that stayed outside the ±1.5 fps we see between identical runs, and the p10 went up with it. No stops and no visible difference in the captures in those runs. That agrees with burber's indoor result and dyshay's outdoor −1.1 to −1.7 ms in #2415.
Author
Owner

@⁠IRennie74 on GitHub · 2026-11-30 22:38 UTC · original

Context from a 6-core, where this may matter more than on a 4070 PC. On a Ryzen 5 5600X with an RTX 3060 (Series S, 960x540, DLSS Performance, standing in the opening) the write guards cost about 50 ms of CPU a frame: ~330 write faults a frame on the title's threads (22 ms), 10-13 ms waiting for the guards' lock and ~19 ms changing protections, on a CPU doing about 460 ms of work per 52 ms frame across 12 threads. The submitting thread is the wall there (busy 44-54 ms of 55-58) and the title's threads share its cores, so fewer protection changes could help indirectly even though STORE_BESIDE leaves the submitting thread's own work as it was.

On the nine failing tests: "no corruption was noticed in play, but none was looked for" is something #4377's VICTORY_FLICKER_DETECT=1 and smoothness: line can measure. They count A-B-A flicker events a minute at every present (about 59 a minute walking on our combined build), and a lost write would most likely show as a rise there. We can run STORE_BESIDE=1 against unset on the 3060 with it and post the numbers if that helps.

The title says "turn on", but the diff only adds the doc paragraph; saying so in the title would stop anyone merging it expecting the default to change.

**@⁠IRennie74** on GitHub · 2026-11-30 22:38 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4491#issuecomment-7294122822) Context from a 6-core, where this may matter more than on a 4070 PC. On a Ryzen 5 5600X with an RTX 3060 (Series S, 960x540, DLSS Performance, standing in the opening) the write guards cost about 50 ms of CPU a frame: ~330 write faults a frame on the title's threads (22 ms), 10-13 ms waiting for the guards' lock and ~19 ms changing protections, on a CPU doing about 460 ms of work per 52 ms frame across 12 threads. The submitting thread is the wall there (busy 44-54 ms of 55-58) and the title's threads share its cores, so fewer protection changes could help indirectly even though `STORE_BESIDE` leaves the submitting thread's own work as it was. On the nine failing tests: "no corruption was noticed in play, but none was looked for" is something #4377's `VICTORY_FLICKER_DETECT=1` and `smoothness:` line can measure. They count A-B-A flicker events a minute at every present (about 59 a minute walking on our combined build), and a lost write would most likely show as a rise there. We can run `STORE_BESIDE=1` against unset on the 3060 with it and post the numbers if that helps. The title says "turn on", but the diff only adds the doc paragraph; saying so in the title would stop anyone merging it expecting the default to change.
Author
Owner

@⁠shurhundo on GitHub · 2026-12-01 02:48 UTC · original

Title and the "+6% FPS" headline read as if this flips VICTORY_STORE_BESIDE's default, but the diff is doc-comment-only (titlewrite.rs) — the switch read itself is unchanged and the body says merging the default change is left to whoever merges. Worth retitling (e.g. "record VICTORY_STORE_BESIDE measurements") so it doesn't get merged on the assumption the default already flipped.

**@⁠shurhundo** on GitHub · 2026-12-01 02:48 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4491#issuecomment-7299019881) Title and the "+6% FPS" headline read as if this flips `VICTORY_STORE_BESIDE`'s default, but the diff is doc-comment-only (`titlewrite.rs`) — the switch read itself is unchanged and the body says merging the default change is left to whoever merges. Worth retitling (e.g. "record VICTORY_STORE_BESIDE measurements") so it doesn't get merged on the assumption the default already flipped.
github-bot closed this pull request 2026-12-01 18:43:25 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:39 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:39 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4491#issuecomment-7321301310) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

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!4492
No description provided.