Reference, not for merging: what took a busy scene on an RTX 5080 from ~34 ms to a steady 25-26 ms #4835

Closed
mstrmoos wants to merge 47 commits from upstream-pr/4835 into main
mstrmoos commented 2026-12-01 10:44:43 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mstrmoos on 2026-12-01T10:44:43Z.


What it changes

This is a draft for reference, not for merging as it is. It's the branch I play on. It got an RTX 5080 from about 34 ms a frame (median) to a steady 25-26 ms in a busy scene, with frames evenly paced. Most of that comes from settings anyone can use on main today. The rest is code that's spread across several open PRs, plus some that isn't anywhere else. I'm opening it so the whole recipe and the measurements are in one place. Anything useful can be taken from it, and I'll split pieces into their own PRs where that's wanted.

Branch: mstrmoos:pr/25ms-reference, on main 0c8c2092, so it will show conflicts against today's main.

The result

Same PC, same scene, same switches and title settings (listed below), 120 s each, back to back:

median p95 p99 frames over 50 ms seconds with p95 over 33 ms
main 5fabb46e 27.7 ms 34.7 37.9 12 84 of 120
this branch 25.9 ms 28.0 29.3 1 11 of 120

Both runs are limited by the card (busy 96-98 %).

  • What the branch's code adds on top of the same settings: 1.8 ms at the median, and a much tighter spread.
  • Where the rest comes from: going from about 34 ms to 27.7 on main is the settings and the title's own LOD and population.

The recipe

VICTORY_DLSS=1 VICTORY_DLSS_MODE=balanced
VICTORY_SCRATCH_CARD=1 VICTORY_SUBMIT_SPLIT=1 VICTORY_LAZY_COMPARE_MB=64 VICTORY_LAZY_NARROW=1 VICTORY_TABLE_SAME=1
VICTORY_WAVE_CHEAP=1f1fbd86759b3da2
VICTORY_SAMPLED_MARKS=0 VICTORY_AMBIENT_SPECULAR=0
VICTORY_PRESENT_ASIDE=1 VICTORY_PACE=auto
VICTORY_IMAGE_HOLD=lod=a15e200:4=0x3e800000,ped=6d31b58:4=0x3e800000,veh=a4a7d40:4=0x3e800000,park=a4a7d3c:4=0x3e800000

What each part does and what it was measured at. Most rows were measured on their own on the pier scene, at different points of the work, so they don't add up exactly:

step what it does measured
VICTORY_DLSS=1, Balanced Turns DLSS on: 1484x835 inside, 2560x1440 out. Without the Streamline files in nvidia-sdk the launcher silently leaves it off. The title's card time went from 37-39 ms to 21-24 ms. DLSS Performance was no better (31.7 ms): the heavy passes are compute work that doesn't scale with resolution.
VICTORY_SCRATCH_CARD=1 (#4332) Keeps list scratch in card memory the CPU maps, not in system memory the card reads over the bus. Live title lists 24.9-25.7 → 21.6-22.5 ms. main e1251c31, card-bound: 43.0 → 37.0 ms.
VICTORY_SUBMIT_SPLIT, LAZY_COMPARE_MB=64, LAZY_NARROW, TABLE_SAME (#3809's switches) Submit-side work trimmed. Small one by one. Kept because together they keep the submitting thread under the card.
VICTORY_WAVE_CHEAP=1f1fbd86759b3da2 One wave64 program takes the approximate per-host-wave form. Small. That program was a visible spike in the GPU time per shader.
VICTORY_SAMPLED_MARKS=0 Turns off the marks that tell texture streaming what was sampled. About -3 ms a frame (31.3 → 28.4), spread over lighting, decal and skinning passes. Trade-off: texture streaming loses that signal. See #3832, where a full card left surfaces untextured with marks on and others with marks off.
VICTORY_AMBIENT_SPECULAR=0 (now main's default) No ambient specular stand-in. 26.8 → 26.4 ms. Water still looks right.
Title LOD scale 0.25 (lod=a15e200) The title's own base LOD scale (an f32 at image + 0xa15e200, build 1.0.2.1), held with VICTORY_IMAGE_HOLD from #1155. The value in the title's settings presets does nothing. At 0.5: draws 8,703 → 7,060, card 29.7-30.2 → 27.1-27.5 ms. At 0.25 with population 0.25 (with marks and specular off): 26.4 → 25.0 ms. Distant detail switches in sooner.
Title population 0.25 (ped=6d31b58, veh=a4a7d40, park=a4a7d3c) Pedestrian, vehicle and parked-car density (f32s). Draws 8,698 → 7,877, 33.5 → 31.7 ms on their own. Fewer people at the terrace.
VICTORY_PRESENT_ASIDE=1 VICTORY_PACE=auto (#2201, #4700) Shows every frame for the same number of display refreshes. At the same 25.0 ms median, p95 36.3 → 25.3 and p99 39.0 → 26.0. VICTORY_PACE did nothing without PRESENT_ASIDE, which #4700 fixes.

Outside the layer, Windows' memory integrity (VBS/HVCI) was turned off for these runs. That took 1-2 ms, by cutting stalls in the guards' VirtualProtect calls. A first reading of 4-5 ms was a single outlier run.

What's in the branch's code

commit(s) what default upstream
95ccd6de List scratch in card memory (VICTORY_SCRATCH_CARD) off #4332
31291698, dbbc78c9 Stores beside the guards understand non-temporal vector stores (movntps/movntpd); the block limit is VICTORY_BESIDE_MOST on #4026
8892d6fb Copies beside the guards open a full block without the guards' lock (VICTORY_COPY_OPEN_UNLOCKED, port of 99c12028) on #4027
e6283865 #4206 merged in #4206
4ba45d36 The 5 s process-memory walk only with VICTORY_PROCESS_MEMORY=1. Its VirtualQuery walk over about 80k regions holds the address-space lock, and the title's threads stall 10-14 ms in VirtualProtect every 5 s. off #3279, #2783, #2877
d5e4d68d send_copied holds only the card copies that hold the bytes (VICTORY_CARD_NEAR, from Biskwit/VIctory-reloaded) on
d0badcc0 Reflections: the miss program runs for the alpha layer (port of #3580) on #3580
2247b5de VICTORY_WAVE_CHEAP=<hashes> for named wave64 programs off
fa97d1ec Reflex low latency with boost (VICTORY_REFLEX_BOOST=1) off
f5094bab, fdce4a7b VICTORY_PACE says when it can't ask the display and asks again. Where the display's refresh wait returns at once (seen with the monitor asleep), it keeps time by the mode's refresh rate. Before, it ran unpaced and logged nothing: a 300 s run gave 28.5 ms and p95 39.6 instead of 25-26 and 28. follows #4700
427c778a #3798 (AVX-512 BCPack unpack) on main's lane rules, about 3x on with AVX-512 #3798
15acf185 (half_meet_at half only), 6bd06cee #3946, #3967 on #3946, #3967
e8a17f42 … b42a6eb5, 10d10bbd, ecfd5a3a, 305adc66 Diagnostics: buffer profile and heat maps (VICTORY_PROFILE), upload rings (VICTORY_RINGS), GPU time per shader (VICTORY_GPU_TIME, _TOP, _NEXT) off
a70fb4db, 490cdbc9 Experiments kept for the record and off: VICTORY_PROTECT_ONE (slower, 42.0 against 40.0 ms); ring telling v2 (VICTORY_RING_TOLD, rings 0-2, correct but slower: submitting thread 26.0/27.1 against 19.1/22.1 ms) off

Tried and ruled out (in case it saves someone the time)

  • Barriers:
    • Removing every barrier in a captured frame is worth 2.5 ms at most.
    • VICTORY_NARROW_BARRIERS=1 is slower on NVIDIA: card 26.6-28.0 → 28.4-30.2 ms.
    • Merging barrier groups gained nothing.
  • An async compute queue: the title's compute-queue lists are 1.8-1.9 ms of card time a frame (9 submissions, 13 waits), so that's the ceiling.
  • Merging draws: an indirect record plus a table change costs about 6 ns a draw on the 5080, so there's nothing to win.
  • Guards:
    • GUARD_HOT=150 (leaving blocks open) is much worse: 51.7 ms.
    • VICTORY_HEAP_HOOKS=1 cut protections from 12.0 to 4.8 ms, but the frame went 32.9 → 34.1 (#3650).
  • Submit-path switches with the card as the limit: ASK_FIRST, COPY_BESIDE, and refreshing big copies outside the scoped pass were all null on the submitting thread's working time.
  • Ring telling (rings 0-3): visible corruption (exploded skinned meshes, skin speckle), with 66-71 stale reads found by VICTORY_REFRESH_CHECK. Rings 0-2 are clean, but slower.
  • The card is not busy, it's waiting. An Nsight GPU Trace of a replayed frame shows the SMs executing 6.7 % of peak instructions. 78 % of the busy time runs at 0-3 warps per SM, with long-scoreboard (memory) stalls. Registers aren't the limit. The work is many small commands run one after another. That is where the next large gain is, and it's structural, not a switch.

How it was tested

  • GPU and profile: RTX 5080 16 GB, Ryzen 7 9800X3D, Windows 11 (memory integrity off), 540 Hz 2560x1440 display. Series X, DLSS Balanced (1484x835 inside), frame generation off, ray tracing off.
  • Bench scene: standing still on a pier for 120 s after a warm-up. Water fills the left of the frame, people sit at a terrace behind, foliage and a far shore are in the distance. About 5,000-5,100 draws a frame with the LOD and population above (8,700 with the title's own values). Input from VICTORY_KEYS_FILE.
  • Before: main 5fabb46e with the recipe above: 27.7 ms median, p95 34.7, p99 37.9, 12 frames over 50 ms, 84 of 120 seconds with p95 over 33 ms.
  • After: this branch with the same recipe: 25.9 ms median, p95 28.0, p99 29.3, 1 frame over 50 ms, 11 of 120 seconds with p95 over 33 ms.
  • Shaders: played with the title's own mix of wave32 and wave64 programs. No shader change here goes beyond #3946 (half) and #3967.
  • Tests: cargo test passed for the crates it touches: yes for victory-formats (18 BCPack tests, including two new vector/scalar equivalence tests). victory-gpu --lib: 1,149 passed and 2 failed, list::thin::tests::bindings_record_no_work and shader_cache::tests::every_switch_of_the_translator_is_in_the_key. Both come with this branch's base (0c8c2092, whose victory-gpu tests don't compile without #4025). Both pass on main 5fabb46e, fixed there by 343bf99f, and no commit here touches either. In victory-shader, split_lds_wave32_read_after_read_barrier_coalescing_and_parity fails on main already.

Checked for overlap

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5584065928 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4835). Originally posted by [mstrmoos](https://github.com/mstrmoos) on 2026-12-01T10:44:43Z. --- ## What it changes **This is a draft for reference, not for merging as it is.** It's the branch I play on. It got an RTX 5080 from about 34 ms a frame (median) to a steady 25-26 ms in a busy scene, with frames evenly paced. Most of that comes from settings anyone can use on `main` today. The rest is code that's spread across several open PRs, plus some that isn't anywhere else. I'm opening it so the whole recipe and the measurements are in one place. Anything useful can be taken from it, and I'll split pieces into their own PRs where that's wanted. Branch: `mstrmoos:pr/25ms-reference`, on `main` 0c8c2092, so it will show conflicts against today's `main`. ### The result Same PC, same scene, same switches and title settings (listed below), 120 s each, back to back: | | median | p95 | p99 | frames over 50 ms | seconds with p95 over 33 ms | | --- | --- | --- | --- | --- | --- | | `main` 5fabb46e | 27.7 ms | 34.7 | 37.9 | 12 | 84 of 120 | | this branch | **25.9 ms** | **28.0** | **29.3** | **1** | **11 of 120** | Both runs are limited by the card (busy 96-98 %). - **What the branch's code adds** on top of the same settings: 1.8 ms at the median, and a much tighter spread. - **Where the rest comes from:** going from about 34 ms to 27.7 on `main` is the settings and the title's own LOD and population. ### The recipe ``` VICTORY_DLSS=1 VICTORY_DLSS_MODE=balanced VICTORY_SCRATCH_CARD=1 VICTORY_SUBMIT_SPLIT=1 VICTORY_LAZY_COMPARE_MB=64 VICTORY_LAZY_NARROW=1 VICTORY_TABLE_SAME=1 VICTORY_WAVE_CHEAP=1f1fbd86759b3da2 VICTORY_SAMPLED_MARKS=0 VICTORY_AMBIENT_SPECULAR=0 VICTORY_PRESENT_ASIDE=1 VICTORY_PACE=auto VICTORY_IMAGE_HOLD=lod=a15e200:4=0x3e800000,ped=6d31b58:4=0x3e800000,veh=a4a7d40:4=0x3e800000,park=a4a7d3c:4=0x3e800000 ``` What each part does and what it was measured at. Most rows were measured on their own on the pier scene, at different points of the work, so they don't add up exactly: | step | what it does | measured | | --- | --- | --- | | `VICTORY_DLSS=1`, Balanced | Turns DLSS on: 1484x835 inside, 2560x1440 out. Without the Streamline files in `nvidia-sdk` the launcher silently leaves it off. | The title's card time went from 37-39 ms to 21-24 ms. DLSS Performance was no better (31.7 ms): the heavy passes are compute work that doesn't scale with resolution. | | `VICTORY_SCRATCH_CARD=1` (#4332) | Keeps list scratch in card memory the CPU maps, not in system memory the card reads over the bus. | Live title lists 24.9-25.7 → 21.6-22.5 ms. `main` e1251c31, card-bound: 43.0 → 37.0 ms. | | `VICTORY_SUBMIT_SPLIT`, `LAZY_COMPARE_MB=64`, `LAZY_NARROW`, `TABLE_SAME` (#3809's switches) | Submit-side work trimmed. | Small one by one. Kept because together they keep the submitting thread under the card. | | `VICTORY_WAVE_CHEAP=1f1fbd86759b3da2` | One wave64 program takes the approximate per-host-wave form. | Small. That program was a visible spike in the GPU time per shader. | | `VICTORY_SAMPLED_MARKS=0` | Turns off the marks that tell texture streaming what was sampled. | About -3 ms a frame (31.3 → 28.4), spread over lighting, decal and skinning passes. **Trade-off:** texture streaming loses that signal. See #3832, where a full card left surfaces untextured with marks on and others with marks off. | | `VICTORY_AMBIENT_SPECULAR=0` (now `main`'s default) | No ambient specular stand-in. | 26.8 → 26.4 ms. Water still looks right. | | Title LOD scale 0.25 (`lod=a15e200`) | The title's own base LOD scale (an f32 at image + 0xa15e200, build 1.0.2.1), held with `VICTORY_IMAGE_HOLD` from #1155. The value in the title's settings presets does nothing. | At 0.5: draws 8,703 → 7,060, card 29.7-30.2 → 27.1-27.5 ms. At 0.25 with population 0.25 (with marks and specular off): 26.4 → 25.0 ms. Distant detail switches in sooner. | | Title population 0.25 (`ped=6d31b58`, `veh=a4a7d40`, `park=a4a7d3c`) | Pedestrian, vehicle and parked-car density (f32s). | Draws 8,698 → 7,877, 33.5 → 31.7 ms on their own. Fewer people at the terrace. | | `VICTORY_PRESENT_ASIDE=1 VICTORY_PACE=auto` (#2201, #4700) | Shows every frame for the same number of display refreshes. | At the same 25.0 ms median, p95 36.3 → 25.3 and p99 39.0 → 26.0. `VICTORY_PACE` did nothing without `PRESENT_ASIDE`, which #4700 fixes. | Outside the layer, Windows' memory integrity (VBS/HVCI) was turned off for these runs. That took 1-2 ms, by cutting stalls in the guards' `VirtualProtect` calls. A first reading of 4-5 ms was a single outlier run. ### What's in the branch's code | commit(s) | what | default | upstream | | --- | --- | --- | --- | | 95ccd6de | List scratch in card memory (`VICTORY_SCRATCH_CARD`) | off | #4332 | | 31291698, dbbc78c9 | Stores beside the guards understand non-temporal vector stores (`movntps`/`movntpd`); the block limit is `VICTORY_BESIDE_MOST` | on | #4026 | | 8892d6fb | Copies beside the guards open a full block without the guards' lock (`VICTORY_COPY_OPEN_UNLOCKED`, port of 99c12028) | on | #4027 | | e6283865 | #4206 merged in | | #4206 | | 4ba45d36 | The 5 s process-memory walk only with `VICTORY_PROCESS_MEMORY=1`. Its `VirtualQuery` walk over about 80k regions holds the address-space lock, and the title's threads stall 10-14 ms in `VirtualProtect` every 5 s. | off | #3279, #2783, #2877 | | d5e4d68d | `send_copied` holds only the card copies that hold the bytes (`VICTORY_CARD_NEAR`, from Biskwit/VIctory-reloaded) | on | | | d0badcc0 | Reflections: the miss program runs for the alpha layer (port of #3580) | on | #3580 | | 2247b5de | `VICTORY_WAVE_CHEAP=<hashes>` for named wave64 programs | off | | | fa97d1ec | Reflex low latency with boost (`VICTORY_REFLEX_BOOST=1`) | off | | | f5094bab, fdce4a7b | `VICTORY_PACE` says when it can't ask the display and asks again. Where the display's refresh wait returns at once (seen with the monitor asleep), it keeps time by the mode's refresh rate. Before, it ran unpaced and logged nothing: a 300 s run gave 28.5 ms and p95 39.6 instead of 25-26 and 28. | | follows #4700 | | 427c778a | #3798 (AVX-512 BCPack unpack) on `main`'s lane rules, about 3x | on with AVX-512 | #3798 | | 15acf185 (`half_meet_at` half only), 6bd06cee | #3946, #3967 | on | #3946, #3967 | | e8a17f42 … b42a6eb5, 10d10bbd, ecfd5a3a, 305adc66 | Diagnostics: buffer profile and heat maps (`VICTORY_PROFILE`), upload rings (`VICTORY_RINGS`), GPU time per shader (`VICTORY_GPU_TIME`, `_TOP`, `_NEXT`) | off | | | a70fb4db, 490cdbc9 | Experiments kept for the record and **off**: `VICTORY_PROTECT_ONE` (slower, 42.0 against 40.0 ms); ring telling v2 (`VICTORY_RING_TOLD`, rings 0-2, correct but slower: submitting thread 26.0/27.1 against 19.1/22.1 ms) | off | | ### Tried and ruled out (in case it saves someone the time) - **Barriers:** - Removing every barrier in a captured frame is worth 2.5 ms at most. - `VICTORY_NARROW_BARRIERS=1` is *slower* on NVIDIA: card 26.6-28.0 → 28.4-30.2 ms. - Merging barrier groups gained nothing. - **An async compute queue:** the title's compute-queue lists are 1.8-1.9 ms of card time a frame (9 submissions, 13 waits), so that's the ceiling. - **Merging draws:** an indirect record plus a table change costs about 6 ns a draw on the 5080, so there's nothing to win. - **Guards:** - `GUARD_HOT=150` (leaving blocks open) is much worse: 51.7 ms. - `VICTORY_HEAP_HOOKS=1` cut protections from 12.0 to 4.8 ms, but the frame went 32.9 → 34.1 (#3650). - **Submit-path switches with the card as the limit:** `ASK_FIRST`, `COPY_BESIDE`, and refreshing big copies outside the scoped pass were all null on the submitting thread's working time. - **Ring telling (rings 0-3):** visible corruption (exploded skinned meshes, skin speckle), with 66-71 stale reads found by `VICTORY_REFRESH_CHECK`. Rings 0-2 are clean, but slower. - **The card is not busy, it's waiting.** An Nsight GPU Trace of a replayed frame shows the SMs executing 6.7 % of peak instructions. 78 % of the busy time runs at 0-3 warps per SM, with long-scoreboard (memory) stalls. Registers aren't the limit. The work is many small commands run one after another. That is where the next large gain is, and it's structural, not a switch. ## How it was tested - **GPU and profile:** RTX 5080 16 GB, Ryzen 7 9800X3D, Windows 11 (memory integrity off), 540 Hz 2560x1440 display. Series X, DLSS Balanced (1484x835 inside), frame generation off, ray tracing off. - **Bench scene:** standing still on a pier for 120 s after a warm-up. Water fills the left of the frame, people sit at a terrace behind, foliage and a far shore are in the distance. About 5,000-5,100 draws a frame with the LOD and population above (8,700 with the title's own values). Input from `VICTORY_KEYS_FILE`. - **Before:** `main` 5fabb46e with the recipe above: 27.7 ms median, p95 34.7, p99 37.9, 12 frames over 50 ms, 84 of 120 seconds with p95 over 33 ms. - **After:** this branch with the same recipe: 25.9 ms median, p95 28.0, p99 29.3, 1 frame over 50 ms, 11 of 120 seconds with p95 over 33 ms. - **Shaders:** played with the title's own mix of wave32 and wave64 programs. No shader change here goes beyond #3946 (half) and #3967. - **Tests:** `cargo test` passed for the crates it touches: yes for `victory-formats` (18 BCPack tests, including two new vector/scalar equivalence tests). `victory-gpu --lib`: 1,149 passed and 2 failed, `list::thin::tests::bindings_record_no_work` and `shader_cache::tests::every_switch_of_the_translator_is_in_the_key`. Both come with this branch's base (0c8c2092, whose `victory-gpu` tests don't compile without #4025). Both pass on `main` 5fabb46e, fixed there by 343bf99f, and no commit here touches either. In `victory-shader`, `split_lds_wave32_read_after_read_barrier_coalescing_and_parity` fails on `main` already. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #4332, #4026, #4027, #4025, #4206, #4700, #3809, #3798, #3946, #3967, #3580, #3279, #2783, #2877, #3832.
trustno1-coder commented 2026-12-01 18:31:02 +00:00 (Migrated from github.com)

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


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