Optimizations for RTX 5070 Ti + Ryzen 5 5600X, part 2: on v2026.11.30.03 #4480

Closed
erickbobd wants to merge 119 commits from upstream-pr/4480 into main
erickbobd commented 2026-11-30 20:58:53 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by erickbobd on 2026-11-30T20:58:53Z.


Continues #831 (RTX 5070 Ti 16 GB + Ryzen 5 5600X + 32 GB RAM), now on top of v2026.11.30.01.

What is in it

  • The trustno1-novo2 fork's performance work, merged first into v2026.11.29.05 and then into v2026.11.30.01. Every switch is off by default:
    • pipelines: VICTORY_PIPELINE_WAIT_ONCE, VICTORY_PIPELINE_WAIT_BACKLOG, VICTORY_PIPELINE_SLOW_WORKERS;
    • textures and staging: VICTORY_TEXTURE_LOOK_ONCE, VICTORY_TEXTURE_READ_AHEAD, VICTORY_STAGING_NO_ZERO;
    • card copies and files: VICTORY_SEND_COPIED_FIND, VICTORY_FILES_BUFFERED;
    • refreshes: VICTORY_REFRESH_SET, VICTORY_TITLE_WRITE_RANGE, VICTORY_UNDER_PARTS, VICTORY_PLACED_CONSTANTS;
    • VICTORY_PAGE_SKIP: a hash per 4 KiB piece, so a refresh skips pieces the title rewrote with the same bytes.
  • A DirectStorage decoded-request cache (VICTORY_DSTORAGE_CACHE=all|bcpack, VICTORY_DSTORAGE_CACHE_GB).
  • Diagnostics behind VICTORY_REFRESH_TOP=1:
    • refresh by copy, by host copy;
    • the submitting thread's refresh spreads;
    • pieces by kind;
    • write-watch askings of 4 MB or more, timed by stage.
  • VICTORY_TRANSLATOR_PIN (build time) keeps a build's translator identity, so a merge that translates the same way reuses its shader cache and pipeline library.

Measured

Standing in the world, the same 2-minute stretch replayed with VICTORY_INPUT_REPLAY, runs interleaved, with the same executable and the switches on or off:

frame base FPS refresh on the submitting thread
30.01 + all of the above 51.0 / 49.8 ms 19.6 / 20.1 14.4 / 12.9 ms
30.01 as released (victory play defaults) 55.8 / 55.2 ms 17.9 / 18.1 19.1 / 18.1 ms

The fork switches plus VICTORY_PAGE_SKIP take off about 5 ms a frame (~10 %).

Where the frame still goes

On this CPU the submitting thread is the limit. Its refreshes cost 70–90 ms of CPU a frame across the helpers, and only ~12 ms of that is copying. Most of the rest is write tracking of view memory:

  • ~160 refreshes a frame over large guarded ranges, about 3.6 GB of range in all;
  • guard() and VirtualProtect under the global guards lock, about 18 ms of CPU.

VICTORY_GUARD_HOT made it worse: 50 ms gave 65.8 ms a frame, 200 ms gave 117.9.

Opened as a backup of this work; nothing is meant to change default behaviour.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5573641868 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4480). Originally posted by [erickbobd](https://github.com/erickbobd) on 2026-11-30T20:58:53Z. --- Continues #831 (RTX 5070 Ti 16 GB + Ryzen 5 5600X + 32 GB RAM), now on top of **v2026.11.30.01**. ## What is in it - The trustno1-novo2 fork's performance work, merged first into v2026.11.29.05 and then into v2026.11.30.01. Every switch is **off by default**: - pipelines: `VICTORY_PIPELINE_WAIT_ONCE`, `VICTORY_PIPELINE_WAIT_BACKLOG`, `VICTORY_PIPELINE_SLOW_WORKERS`; - textures and staging: `VICTORY_TEXTURE_LOOK_ONCE`, `VICTORY_TEXTURE_READ_AHEAD`, `VICTORY_STAGING_NO_ZERO`; - card copies and files: `VICTORY_SEND_COPIED_FIND`, `VICTORY_FILES_BUFFERED`; - refreshes: `VICTORY_REFRESH_SET`, `VICTORY_TITLE_WRITE_RANGE`, `VICTORY_UNDER_PARTS`, `VICTORY_PLACED_CONSTANTS`; - `VICTORY_PAGE_SKIP`: a hash per 4 KiB piece, so a refresh skips pieces the title rewrote with the same bytes. - A DirectStorage decoded-request cache (`VICTORY_DSTORAGE_CACHE=all|bcpack`, `VICTORY_DSTORAGE_CACHE_GB`). - Diagnostics behind `VICTORY_REFRESH_TOP=1`: - refresh by copy, by host copy; - the submitting thread's refresh spreads; - pieces by kind; - write-watch askings of 4 MB or more, timed by stage. - `VICTORY_TRANSLATOR_PIN` (build time) keeps a build's translator identity, so a merge that translates the same way reuses its shader cache and pipeline library. ## Measured Standing in the world, the same 2-minute stretch replayed with `VICTORY_INPUT_REPLAY`, runs interleaved, with the same executable and the switches on or off: | | frame | base FPS | refresh on the submitting thread | |---|---|---|---| | 30.01 + all of the above | 51.0 / 49.8 ms | 19.6 / 20.1 | 14.4 / 12.9 ms | | 30.01 as released (`victory play` defaults) | 55.8 / 55.2 ms | 17.9 / 18.1 | 19.1 / 18.1 ms | The fork switches plus `VICTORY_PAGE_SKIP` take off about 5 ms a frame (~10 %). ## Where the frame still goes On this CPU the submitting thread is the limit. Its refreshes cost 70–90 ms of CPU a frame across the helpers, and only ~12 ms of that is copying. Most of the rest is write tracking of view memory: - ~160 refreshes a frame over large guarded ranges, about 3.6 GB of range in all; - `guard()` and `VirtualProtect` under the global guards lock, about 18 ms of CPU. `VICTORY_GUARD_HOT` made it worse: 50 ms gave 65.8 ms a frame, 200 ms gave 117.9. Opened as a backup of this work; nothing is meant to change default behaviour. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
erickbobd commented 2026-11-30 22:12:05 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by erickbobd on 2026-11-30T22:12:05Z.


Updated to v2026.11.30.03 (merged; two small conflicts). Measured on the same 2-minute stretch, interleaved: 30.03 + these switches 53.5 / 56.9 ms with the new default VICTORY_PIPELINE_WAIT_ALL (single frames of 9.8 s and 55 s); with VICTORY_PIPELINE_WAIT_ALL=0 53.8 / 52.7 ms and no long stops, against 30.01 + these switches 49.6 / 53.6 / 52.8 ms. The translator change of 30.03 made 6,817 of 83,559 known pipelines again (16 min preload); the rest were reused by content.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7293507659 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4480#issuecomment-7293507659). Originally posted by [erickbobd](https://github.com/erickbobd) on 2026-11-30T22:12:05Z. --- Updated to v2026.11.30.03 (merged; two small conflicts). Measured on the same 2-minute stretch, interleaved: 30.03 + these switches 53.5 / 56.9 ms with the new default `VICTORY_PIPELINE_WAIT_ALL` (single frames of 9.8 s and 55 s); with `VICTORY_PIPELINE_WAIT_ALL=0` 53.8 / 52.7 ms and no long stops, against 30.01 + these switches 49.6 / 53.6 / 52.8 ms. The translator change of 30.03 made 6,817 of 83,559 known pipelines again (16 min preload); the rest were reused by content.
IRennie74 commented 2026-11-30 22:38:48 +00:00 (Migrated from github.com)

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


Two things I noticed, plus a data point from a similar CPU:

  • big_first() (crates/victory-gpu/src/host.rs:13812, VICTORY_REFRESH_BIG_FIRST, on by default) has no caller on the branch. cargo clippy -- -D warnings will refuse it as dead code. CI has not run on this head (the CI run is waiting for approval), so that has not shown yet. If it is meant to be wired in, note it is the one switch here that is on by default, which goes against the "every switch off by default" in the description.
  • Cargo.lock changes (blake3 added to victory-hle). The lockfile is hashed into VICTORY_TRANSLATOR (crates/victory-gpu/build.rs), so merging this as is invalidates every user's shader cache and pipeline library. VICTORY_TRANSLATOR_PIN does not help them, because it is a build-time variable.

On a Ryzen 5 5600X with an RTX 3060 (#4554), cutting refresh time alone has not shown up in fps. VICTORY_DIRTY_PAGES + LIST_SUMMARY took refreshes from 12.7 to 10.9 ms, but the submitting thread's total went only from 40.2 to 39.7 ms, and fps stayed within noise. Other stages absorbed the savings on a CPU this close to its limit. Your 51 vs 55.8 ms is interleaved on the same stretch, so it may well hold. Still, if you split it up, it would help to know which of the switches carries the 5 ms. VICTORY_GUARD_HOT was worse for us too: 50 ms gave 18.0 fps against 18.1-18.6, and 200 ms gave 12.0-12.7.

Your note on VICTORY_PIPELINE_WAIT_ALL (single frames of 9.8 s and 55 s after the 30.03 translator change) is worth an issue of its own. It is on by default on main, and anyone updating gets the same cold pipelines.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7294120334 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4480#issuecomment-7294120334). Originally posted by [IRennie74](https://github.com/IRennie74) on 2026-11-30T22:38:48Z. --- Two things I noticed, plus a data point from a similar CPU: - `big_first()` (`crates/victory-gpu/src/host.rs:13812`, `VICTORY_REFRESH_BIG_FIRST`, on by default) has no caller on the branch. `cargo clippy -- -D warnings` will refuse it as dead code. CI has not run on this head (the CI run is waiting for approval), so that has not shown yet. If it is meant to be wired in, note it is the one switch here that is on by default, which goes against the "every switch off by default" in the description. - `Cargo.lock` changes (`blake3` added to victory-hle). The lockfile is hashed into `VICTORY_TRANSLATOR` (`crates/victory-gpu/build.rs`), so merging this as is invalidates every user's shader cache and pipeline library. `VICTORY_TRANSLATOR_PIN` does not help them, because it is a build-time variable. On a Ryzen 5 5600X with an RTX 3060 (#4554), cutting refresh time alone has not shown up in fps. `VICTORY_DIRTY_PAGES` + `LIST_SUMMARY` took refreshes from 12.7 to 10.9 ms, but the submitting thread's total went only from 40.2 to 39.7 ms, and fps stayed within noise. Other stages absorbed the savings on a CPU this close to its limit. Your 51 vs 55.8 ms is interleaved on the same stretch, so it may well hold. Still, if you split it up, it would help to know which of the switches carries the 5 ms. `VICTORY_GUARD_HOT` was worse for us too: 50 ms gave 18.0 fps against 18.1-18.6, and 200 ms gave 12.0-12.7. Your note on `VICTORY_PIPELINE_WAIT_ALL` (single frames of 9.8 s and 55 s after the 30.03 translator change) is worth an issue of its own. It is on by default on main, and anyone updating gets the same cold pipelines.
CowboyBingus commented 2026-12-01 00:17:34 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by CowboyBingus on 2026-12-01T00:17:34Z.


You should probably break this down into individual components and open those as PRs. I highly doubt anyone here is going to be able to review 40,000 lines of code across two PRs. 98 file changes means this is going to break pretty much every time main moves.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7296162493 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4480#issuecomment-7296162493). Originally posted by [CowboyBingus](https://github.com/CowboyBingus) on 2026-12-01T00:17:34Z. --- You should probably break this down into individual components and open those as PRs. I highly doubt anyone here is going to be able to review 40,000 lines of code across two PRs. 98 file changes means this is going to break pretty much every time `main` moves.
trustno1-coder commented 2026-12-01 18:40:59 +00:00 (Migrated from github.com)

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


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:7321335965 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4480#issuecomment-7321335965). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:40:59Z. --- 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!4480
No description provided.