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

Closed
vilaris wants to merge 14 commits from upstream-pr/4491 into main
vilaris commented 2026-11-30 21:11:35 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by vilaris on 2026-11-30T21:11:35Z.


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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5573832426 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4491). Originally posted by [vilaris](https://github.com/vilaris) on 2026-11-30T21:11:35Z. --- ## 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)
m335671 commented 2026-11-30 22:29:15 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by m335671 on 2026-11-30T22:29:15Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7293911718 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4491#issuecomment-7293911718). Originally posted by [m335671](https://github.com/m335671) on 2026-11-30T22:29:15Z. --- 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.
IRennie74 commented 2026-11-30 22:38:55 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by IRennie74 on 2026-11-30T22:38:55Z.


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 #4376'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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7294122822 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4491#issuecomment-7294122822). Originally posted by [IRennie74](https://github.com/IRennie74) on 2026-11-30T22:38:55Z. --- 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 #4376'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.
shurhundo commented 2026-12-01 02:48:44 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by shurhundo on 2026-12-01T02:48:44Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7299019881 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4491#issuecomment-7299019881). Originally posted by [shurhundo](https://github.com/shurhundo) on 2026-12-01T02:48:44Z. --- 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.
trustno1-coder commented 2026-12-01 18:39:58 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:39:58Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7321301310 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4491#issuecomment-7321301310). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:39:58Z. --- 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

Sign in to join this conversation.
No reviewers
No labels
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.

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