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

Closed
github-bot wants to merge 47 commits from github-bot/gh-4835 into main AGit
Owner

@⁠mstrmoos on GitHub · 2026-12-01 10:44 UTC · original
mstrmoos:pr/25ms-reference → main · +4277 −978 · 58 files · 47 commits · closed without merging

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 (#4333) 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, #4701) 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 #4701 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 #4333
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 #4207 merged in #4207
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 #4701
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

**@⁠mstrmoos** on GitHub · 2026-12-01 10:44 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4835) `mstrmoos:pr/25ms-reference` → `main` · +4277 −978 · 58 files · 47 commits · closed without merging ## 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` (#4333) | 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, #4701) | 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 #4701 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 | #4333 | | 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 | #4207 merged in | | #4207 | | 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 #4701 | | 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: #4333, #4026, #4027, #4025, #4207, #4701, #3809, #3798, #3946, #3967, #3580, #3279, #2783, #2877, #3832.
`slots_showing` took the slot's `Made` key with `?`, but `Made` has keys
for the title's `count` slots only while `kept` also has the dynamic
ones: a host texture shown by a dynamic slot was no longer reported, so
it was no longer blocked and could be chosen (freeing nothing, as the
dynamic slot holds a reference, while the title made a second copy).
Those slots are reported again with key 0, as before the key was carried;
they are never put back to waiting, only counted as blocking. Test:
`a_dynamic_slot_showing_a_texture_still_blocks_its_eviction`.

`SLOT_LOOKING` is now cleared by a drop guard, so a look that panics does
not stop every later look.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit b23c0c4038)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported from #3109 (qlfu, 083b1d62), the scoped invalidation part only,
onto current main: a title buffer copy (`Step::Copy`, joined copies
included) and a copy at its place (`Step::Placed`, when free) still flush
the pending refreshes before they write, but then evict from `Batch::ahead`
and `Batch::textures` only the entries whose range overlaps
`[dst, dst + len)` or a 64 KiB block that shows the same physical pages
(`watch::elsewhere_blocks`). Before, every such step emptied both, so every
refresh and texture check after it in the submission was queued again.
Work that may write anywhere (`Step::Run`) still clears everything.

`Batch::textures` keeps each staging buffer's title span for this.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On top of the scoped invalidation (#3109's, the commit before): a title
buffer copy and a copy at its place (free) no longer flush every pending
refresh and texture before they write. `Batch::title_wrote` does only those
whose host copy's span, or whose texture memory, meets the written range
or one of the 64 KiB blocks that show its pages elsewhere
(`Batch::flush_touching`); the others stay pending for a later flush. A copy
is judged by its whole span: `Shadow::update` reads title memory and writes
the host copy only inside it, so one the write misses gets the same bytes
before the write as after it. A joined copy piece does the same for its own
range before the joined copy is made. `VICTORY_SCOPED_WRITES=0` puts back
`Batch::title_written` (everything flushed and forgotten) at those steps.

Turning the camera on the bench (RTX 5080 + 9800X3D, Series X 1440p, eight
spin runs) the title's buffer copies went from 7.3-8.0 to 11.6-12.8 a frame
and its copies at their place from 22 to 32-35, the submitting thread's
flushes from 44-45 to 55-58 and its refreshes from 11.7-13.4 ms to
16.9-18.2, while the refresh requests stayed at 7,100-7,500.

A line every frame-rate line counts the title writes, the refreshes and
textures done before them or left pending, and the refreshed copies and
checked textures that stood past them.

Tests: a write flushes only the copy it writes and the other's pending
refresh gets the same bytes at the last flush; a write through one view of
a section flushes the copy of the other view; 24 rounds of random steps end
with the same bytes in every copy with the scoped and the old way.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The pass over textures picked by index hands about half of its uploads to
the copy queue ahead, which reads and detiles them on its own threads; the
others (another level of a texture a slot shows, a texture a list used
before) get their staging buffer's first filling at their submission, in
front of its steps, which the submitting thread waits for. Turning the
camera on the bench those were 5,490-7,340 per 5 s (70-90 a frame), and the
textures detiled went from 20-32 a frame to 108-159.

With the switch, a staging buffer made for one upload (`Staging::once`, not
uploaded yet, not a bake's, not levels on demand, not detiled on the card)
is handed to two threads of ours when the upload is recorded (at most 512
waiting). The staging buffer's lock orders them with the submission: it
finds the buffer filled (such a buffer is never read twice), waits while it
is filled, or fills it itself and the thread then finds nothing to read.
The memory is read when the upload is recorded, as the copy queue ahead
reads it; a title write in between is found by the pass's looks after an
upload. A line counts what was sent, filled, found filled and left over.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
On discrete NVIDIA cards list scratch lies in the PC's memory (scratch_wb), so every shader load of a draw's constants crosses the bus: 32 GB/s against 925 GB/s from card memory the CPU maps (RTX 5080, host::bus). Replayed, the frame's 196 scratch chunks moved to the card: 27.52 -> 25.19 ms. Live on main (e1251c31), card-bound: frame 43.0 -> 37.0 ms median, the title's lists 29.4-32.6 -> 27.9-28.7 ms of card time.
(cherry picked from commit 2de0638095bcba0118d1a28990ecb580db323bc2)
(cherry picked from commit 916aa1593a4bfed6380c4b716e7a1ef119ef15dd)
(cherry picked from commit cc1ea096f925b461f023a8e4c85e620bb34cc060)
(cherry picked from commit b0215019f5a5ed7d61408e39df0efb8505a2ba62)
(cherry picked from commit bdb70184b809071f1e66de34bc80612e54d25b55)
(cherry picked from commit cdf1eaef7609930d395ffd30b483c1a8c9212812)
(cherry picked from commit d380734f54a4384736fdd5cd8184f939adf8c2e2)
(cherry picked from commit 39c1c4389c28cb228a1e1b11f023ac555bfd2ca6)
(cherry picked from commit c753351d20df8e45e37b88c7b68c1a6d58d365cd)
(cherry picked from commit 604eb88c8b320fcaadbd5c1012b5070704a4797c)
(cherry picked from commit 2846c58d5655211d80887f6dc6c5a438453a793f)
(cherry picked from commit e065eba2860d3051bd3909e717d7a4d3573af6cb)
(cherry picked from commit 9a559a95ef59aa1fdb7a00ea407c759d2f867f30)
(cherry picked from commit 2c9bae53558ab1d3cdabcdd4a503834c8680367d)
(cherry picked from commit b585211ff800749aeecf78b44e9e062fe3efc20d)
(cherry picked from commit d858ce95019a427e955ad37300415e201feab351)
(cherry picked from commit dabd77a7ba52e5c49b99e3ecf384f31d114085dd)
(cherry picked from commit 1f62ee58d90f8b0f7b4ddc6eef808b18b594e8cd)
(cherry picked from commit 27f7f35cc8c101e71f3aca8513b4689ab99376cc)
(cherry picked from commit 045d1567c063400ed1daba5f29828340da6b74b1)
(cherry picked from commit 03efbcb9b29983be8c801fb978c2a5ca2098579e)
(cherry picked from commit 0928954402496815d6f45db125654c158527c217)
(cherry picked from commit 8e8980c479f3a4acead0c10de77567d11cc37cff)
(cherry picked from commit 458089d7ef0b94f349a4914c4d5f0229056443d8)
(cherry picked from commit f66c0f0155a2ec236a38882a8c1f793db4594e08)
(cherry picked from commit 7c5f879779dbce0f883fdb82b77d7c087b80d8a5)
(cherry picked from commit a3c93ef7bb50800cc7601742ba0cc1780e8208ea)
(cherry picked from commit a18530b6d303f80f85083b15fc83c84447b6cdcb)
(cherry picked from commit cd79cb37211e4f1468bfef16026cafb1eb81dc8a)
(cherry picked from commit f83f384a54e8cee18b4d5a98d7862e09f8201e82)
(cherry picked from commit 9f96810d6feaf4e75e5e01497cb378a1eed38a16)
(cherry picked from commit 05516091b88e48fce25ad41a7894e54b5d0cea99)
(cherry picked from commit d0d750add3b41149043a8ca81443696d74f2c1d4)
(cherry picked from commit b0b851d9aeaa1ea7977e7f71cd80e14b25be3dab)
(cherry picked from commit 612eef3e9eb5c1e3e69243e3ea6eadf884c17c02)
The pure half of bounding the once-a-second sweep (crate::sweeping): `walk`
looks at most 8,192 entries from where the last stopped and reads the clock
every 64; `in_turn` runs the sweep's extra parts one after the other while
time is left; `BackOff` is the slot eviction's rest after a pass that let
nothing go, ended by its time, a 2 % rise of the card's use or room refused
after there was some. The switches and numbers (VICTORY_SWEEP_BOUNDED,
VICTORY_SLOT_EVICT_BOUNDED, VICTORY_SWEEP_SPREAD, VICTORY_SWEEP_BUDGET_MS,
VICTORY_SLOT_EVICT_BACKOFF_MS) are read here; nothing uses them yet.

Co-Authored-By: Claude Fable 5.2 <[email protected]>

(cherry picked from commit e1d917217a)
(cherry picked from commit 647753fe595f04854183b5b70af67b0f3de4b65c)
(cherry picked from commit 73abfbd8b4168cb83462cd27ada746f9b9aaf4b8)
This reverts commit b0042fe723eef1cfff8bebf8bb4ea744c10663f1.
This reverts commit 68afcccda31de5118796a789b896a02f394a59ab.
A command is charged up to the next one's stamp, so a wait for earlier work lands on the first
command after it. On the bench route PedStandardSkinning_0 and ShadowTileBalanceRTCost looked
10-100x dearer on main than on an older base (0.75 against 0.10 ms, 0.88 against 0.01): the
first dispatch of each run carries the wait (77 against 10 us), the rest take 0.1 us, and the
frame's stamped total is the same (20.7 against 20.4 ms).
(cherry picked from commit 3dd3d4deec)
(cherry picked from commit 76c582cfe3)
Forcing dirty/e_written at every branch leader fails
emit::folded_join_tests::a_folded_loop_header_reads_the_mask_join_on_its_back_edge
(on upstream main 5fabb46e with #3946 alone as well). The half_meet_at fix in
lower.rs stays.
The pace's first look at the display (GetContainingOutput, then a few
WaitForVBlank) could fail and leave the run unpaced with nothing in the
log, which reads exactly like a run without VICTORY_PACE. A 300 s run did
just that: no 'frames are paced' line, median 28.5 ms and p95 39.6 ms,
where the same switches paced had given 25.0 ms and p95 25.3 ms. A wait
that failed mid-run dropped the pace for the rest of it the same way.

Now either failure is logged once with its error, and the display is
asked again every 256 frames of the scene, so a window that moves to a
display the swap chain can reach is paced again.
#3798 runs lanes_strip's rounds with AVX-512, but it was written against
the lane rounds before #2092 (per-lane output budgets, drain and finished
phases), and no longer applies. This keeps #3798's vector decode (each
lane's buckets held in vectors, picked by compares; the first 8 lanes that
want a byte found by pdep, their bytes by vpexpandb) and puts it where
main now spends its time: the burst of rounds in which every lane is
inside a payload. Headers, the drain at a fragment's end and the stream's
end stay in the scalar rounds, so #2092's rules live in one place.

Each lane's bucket vectors are kept for the whole strip and refreshed for
a lane whose model changed, so a short burst does not pay to set them up.

Tests:
- the_vector_rounds_step_the_lanes_as_the_scalar_ones_do: every lane
  layout, BC2's 15 lanes too, on one-fragment and multi-fragment streams
  across strip boundaries, cut short, and noise; lanes, records, stream
  position and result compared with the scalar rounds.
- the_vector_rounds_decode_what_the_scalar_ones_do (from #3798): whole
  decodes, shipped, synthetic and skewed tables.
- every_layout_round_trips_through_the_lanes now covers BC2's layout too.
- Taking 7 bytes a round instead of 8 fails 6 tests; dropping the
  frequency-1 quotient fails 5.

Release build, Ryzen 7 9800X3D, bcpack_throughput_builtin (shipped
tables, 16384 blocks), two runs each, main 5fabb46e -> this:
BC1 58.8 -> 173.8 MB/s, BC3 57.7 -> 179.2, BC4 57.8 -> 167.3,
BC5 57.9 -> 183.9, BC6 37.0 -> 110.2, BC7 37.7 -> 115.5.

Co-authored-by: fl4rion <[email protected]>
(cherry picked from commit 7d1b12dcf477ec74c6001cf5418cb2e9070dd9e1)
With the pace's warning in place, a 90 s pier run said why it went
unpaced: IDXGIOutput::WaitForVBlank returned at once, so no refresh
period could be measured ('no two refreshes were more than 0.5 ms
apart'). The same display paced normally overnight; the wait behaves like
this with the monitor asleep or the desktop watched through a streaming
app. Now the period comes from the display mode's refresh rate
(EnumDisplaySettingsW) and the pace sleeps, then spins, to the due
refresh; the present, which can't tear, still lands on a refresh. The
pace line says by_clock=true when it does.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 10:47:48 +00:00
github-bot closed this pull request 2026-12-01 18:36:25 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:31 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:31 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4835#issuecomment-7321072150) 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!4836
No description provided.