Wave64 programs on 32-lane hosts again, the shader cache key's missing switches, a relay remap wait, list-thread sampling #1575

Open
misaka-20002 wants to merge 6 commits from upstream-pr/1575 into main
misaka-20002 commented 2026-11-28 21:52:37 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by misaka-20002 on 2026-11-28T21:52:37Z.


What it changes

Six commits, independent of each other: each builds on its own, so any can be taken without the others.

  1. Shaders: the LDS write-only shortcut on by default again on 32-lane hosts (VICTORY_LDS_WRITE_ONLY_OK=0 turns it off). 075785e (#43) made the legacy shortcut for write-only lane-branch regions opt-in. Since then, on a 32-lane host (NVIDIA), 19 wave64 compute programs no longer translate and their dispatches are dropped:

    • the tree culling passes (InstanceCulling:CS_Tree_*, six);
    • the indirect lighting gathers and screen-probe traces (six);
    • CS_VarianceFilterAlpha, CS_TraceShadowRays_Fullres, CS_ProjDecalReduceClassification_Scalarized and CS_Classification_Water;
    • three kernels in XboxBvhBuilder.dll.

    The strict analysis itself is unchanged. It still decides on 64-lane hosts and with =0. Its four tests turn the shortcut off for themselves.

    • Overlap: #1450 retries some known kernels with a scoped write-only policy. Measured the same way (below), it brings back 5 of these 19 programs. The other four tree passes, all six indirect lighting programs, the full-res shadow rays and the three BVH builder kernels stay refused. #1504 takes the same programs another way (exact forms), in a much larger change.
  2. Shader cache: the translator's switches that were not in its key. Six switches change what the translator makes but are not in the key, so a warm cache serves translations made without them: VICTORY_HDR_CLAMP, VICTORY_LDS_FIRST_INIT, VICTORY_LDS_INIT_HOIST, VICTORY_LOOPS_WAVE, VICTORY_SAMPLED_MARKS and VICTORY_DEFRAG. For example, VICTORY_HDR_CLAMP=0 on a warmed cache still clamps.

    • VICTORY_BVH_MISS is now keyed by whether it is on, as VICTORY_BVH_NO_HIT already is. VICTORY_BVH_BUILDER=1 (the F1 menu's ray tracing) turns it off, and before this both runs shared one key.
    • The list is now a constant. A test checks it against every switch the translator's source names (build.rs's list, now emit::SWITCHES), so a new switch fails the test until someone decides whether it is keyed.
    • Every key changes once, so the first run translates again.
    • Overlap: #1437 adds two of these (LOOPS_WAVE, LDS_FIRST_INIT) together with unrelated F7/F8 changes.
  3. Relay: a remap waits only for the landings that touch its range (follow-up to #631). In relay mode land_before_remap also waited while any landing was in hand. In relay mode line.written keeps the ranges of the flights being landed until relay_land is done, so waiting until no written range touches the remapped one is enough. Without relay it waits as before. Found in review; not measured on its own.

  4. Timeline: VICTORY_TIMELINE_LISTS=1 samples the list threads too (diagnostics builds only).

  5. Timeline: real call stacks for the list threads (diagnostics builds only). The sampler pauses a list thread only long enough to copy its registers and up to 64 KB of its stack. Once the thread runs on, it walks the copy with RtlLookupFunctionEntry and RtlVirtualUnwind, because Windows' unwinding takes locks the paused thread may hold. With this, time in the driver is charged to the call of ours that led there. On an RTX 5080 it showed that about 22–30% of the list threads' driver time is CreateShaderResourceView for buffer views.

  6. Shaders: two more 64-thread LDS programs taken wave-wide on 32-lane hosts. GpuParticleEmit:CS_Emit_Dynamic_Model (18d957e62926ed3e) and CS_Emit_Dynamic_Model_AttachMesh (407eca669212d400) join the scene_kernel digests (#101's shape). Widened, they translate.

How it was tested

  • GPU and profile: RTX 5080 (32-lane), Ryzen 7 9800X3D, GTA VI 1.0.2.1, Series X/S profiles at 1440p, DLSS. Items 1 and 6 were played on a local branch before 075785e reached it; those programs translated and drew right in play.

  • Before/after, victory translate --list <game> with VICTORY_HOST_WAVE=32 VICTORY_VIEW_LIMIT=737855 (every shader of the game, about 52,000 lines):

    Build "no wave32 lowering" refused in all
    main (77df871) 37 237
    main + #1450 32 232
    main + item 1 (VICTORY_LDS_WRITE_ONLY_OK=1 on main) 18 218
    main + item 6 35 235

    Items 1 and 6 were measured separately; together they should give 16.

  • For shader changes, wave sizes tested: 32 lanes (census above); the 64-lane path is unchanged (the shortcut is off unless the host's widest wave is 32).

  • cargo test: the victory-gpu shader_cache tests pass locally, including the new one. The workspace's clippy and tests are left to this PR's CI run. Main's clippy currently stops at two errors in lower.rs, before the tests; #1517 fixes them, so this PR's CI will be red there until #1517 (or #1527) is in.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #1450, #1504, #733 (item 1); #1437, #1425 (item 2); #631 (item 3). Clippy and the size policy on main are left to #1517, #1527, #1493 and #1460.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5544926309 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1575). Originally posted by [misaka-20002](https://github.com/misaka-20002) on 2026-11-28T21:52:37Z. --- ## What it changes Six commits, independent of each other: each builds on its own, so any can be taken without the others. 1. **Shaders: the LDS write-only shortcut on by default again on 32-lane hosts** (`VICTORY_LDS_WRITE_ONLY_OK=0` turns it off). 075785e (#43) made the legacy shortcut for write-only lane-branch regions opt-in. Since then, on a 32-lane host (NVIDIA), 19 wave64 compute programs no longer translate and their dispatches are dropped: - the tree culling passes (`InstanceCulling:CS_Tree_*`, six); - the indirect lighting gathers and screen-probe traces (six); - `CS_VarianceFilterAlpha`, `CS_TraceShadowRays_Fullres`, `CS_ProjDecalReduceClassification_Scalarized` and `CS_Classification_Water`; - three kernels in `XboxBvhBuilder.dll`. The strict analysis itself is unchanged. It still decides on 64-lane hosts and with `=0`. Its four tests turn the shortcut off for themselves. - Overlap: #1450 retries some known kernels with a scoped write-only policy. Measured the same way (below), it brings back 5 of these 19 programs. The other four tree passes, all six indirect lighting programs, the full-res shadow rays and the three BVH builder kernels stay refused. #1504 takes the same programs another way (exact forms), in a much larger change. 2. **Shader cache: the translator's switches that were not in its key.** Six switches change what the translator makes but are not in the key, so a warm cache serves translations made without them: `VICTORY_HDR_CLAMP`, `VICTORY_LDS_FIRST_INIT`, `VICTORY_LDS_INIT_HOIST`, `VICTORY_LOOPS_WAVE`, `VICTORY_SAMPLED_MARKS` and `VICTORY_DEFRAG`. For example, `VICTORY_HDR_CLAMP=0` on a warmed cache still clamps. - `VICTORY_BVH_MISS` is now keyed by whether it is on, as `VICTORY_BVH_NO_HIT` already is. `VICTORY_BVH_BUILDER=1` (the F1 menu's ray tracing) turns it off, and before this both runs shared one key. - The list is now a constant. A test checks it against every switch the translator's source names (`build.rs`'s list, now `emit::SWITCHES`), so a new switch fails the test until someone decides whether it is keyed. - Every key changes once, so the first run translates again. - Overlap: #1437 adds two of these (`LOOPS_WAVE`, `LDS_FIRST_INIT`) together with unrelated F7/F8 changes. 3. **Relay: a remap waits only for the landings that touch its range** (follow-up to #631). In relay mode `land_before_remap` also waited while any landing was in hand. In relay mode `line.written` keeps the ranges of the flights being landed until `relay_land` is done, so waiting until no written range touches the remapped one is enough. Without relay it waits as before. Found in review; not measured on its own. 4. **Timeline: `VICTORY_TIMELINE_LISTS=1` samples the list threads too** (diagnostics builds only). 5. **Timeline: real call stacks for the list threads** (diagnostics builds only). The sampler pauses a list thread only long enough to copy its registers and up to 64 KB of its stack. Once the thread runs on, it walks the copy with `RtlLookupFunctionEntry` and `RtlVirtualUnwind`, because Windows' unwinding takes locks the paused thread may hold. With this, time in the driver is charged to the call of ours that led there. On an RTX 5080 it showed that about 22–30% of the list threads' driver time is `CreateShaderResourceView` for buffer views. 6. **Shaders: two more 64-thread LDS programs taken wave-wide on 32-lane hosts.** `GpuParticleEmit:CS_Emit_Dynamic_Model` (`18d957e62926ed3e`) and `CS_Emit_Dynamic_Model_AttachMesh` (`407eca669212d400`) join the `scene_kernel` digests (#101's shape). Widened, they translate. ## How it was tested - GPU and profile: RTX 5080 (32-lane), Ryzen 7 9800X3D, GTA VI 1.0.2.1, Series X/S profiles at 1440p, DLSS. Items 1 and 6 were played on a local branch before 075785e reached it; those programs translated and drew right in play. - Before/after, `victory translate --list <game> ` with `VICTORY_HOST_WAVE=32 VICTORY_VIEW_LIMIT=737855` (every shader of the game, about 52,000 lines): | Build | "no wave32 lowering" | refused in all | |---|---|---| | main (77df871) | 37 | 237 | | main + #1450 | 32 | 232 | | main + item 1 (`VICTORY_LDS_WRITE_ONLY_OK=1` on main) | 18 | 218 | | main + item 6 | 35 | 235 | Items 1 and 6 were measured separately; together they should give 16. - For shader changes, wave sizes tested: 32 lanes (census above); the 64-lane path is unchanged (the shortcut is off unless the host's widest wave is 32). - `cargo test`: the `victory-gpu` `shader_cache` tests pass locally, including the new one. The workspace's clippy and tests are left to this PR's CI run. Main's clippy currently stops at two errors in `lower.rs`, before the tests; #1517 fixes them, so this PR's CI will be red there until #1517 (or #1527) is in. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #1450, #1504, #733 (item 1); #1437, #1425 (item 2); #631 (item 3). Clippy and the size policy on main are left to #1517, #1527, #1493 and #1460. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
kibagami-nc commented 2026-11-28 21:59:31 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T21:59:31Z.


A note on commit 2 (the shader cache key), so only one of the two goes in: it overlaps #807. #807 has been open since 2026-11-28 morning, and was rebuilt on 923e38c today. It keys the same six switches (HDR_CLAMP, LDS_FIRST_INIT, LDS_INIT_HOIST, LOOPS_WAVE, SAMPLED_MARKS, DEFRAG), the list is a constant there too, and it has the same test against emit::SWITCHES.

Your VICTORY_BVH_MISS part (keyed by whether it's on, with VICTORY_BVH_BUILDER=1 turning it off) isn't in #807. If the maintainer takes #807, that piece could stay here as its own commit.

On commit 1: #1590 takes the write-only shortcut as a last try instead of turning it on for every program. Your 19-program measurement is the confirmation #1435 needed, thanks.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7246418326 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1575#issuecomment-7246418326). Originally posted by [kibagami-nc](https://github.com/kibagami-nc) on 2026-11-28T21:59:31Z. --- A note on commit 2 (the shader cache key), so only one of the two goes in: it overlaps #807. #807 has been open since 2026-11-28 morning, and was rebuilt on 923e38c today. It keys the same six switches (`HDR_CLAMP`, `LDS_FIRST_INIT`, `LDS_INIT_HOIST`, `LOOPS_WAVE`, `SAMPLED_MARKS`, `DEFRAG`), the list is a constant there too, and it has the same test against `emit::SWITCHES`. Your `VICTORY_BVH_MISS` part (keyed by whether it's on, with `VICTORY_BVH_BUILDER=1` turning it off) isn't in #807. If the maintainer takes #807, that piece could stay here as its own commit. On commit 1: #1590 takes the write-only shortcut as a last try instead of turning it on for every program. Your 19-program measurement is the confirmation #1435 needed, thanks.
unueberlegt commented 2026-11-28 22:37:49 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by unueberlegt on 2026-11-28T22:37:49Z.


Tested — it works, with an independent bisect data point and one finding from the first cold start.

Setup: GeForce RTX 5070 12 GB, 31 GB RAM, Windows 11 26300, dump of the title v1.0.2.1, Series X profile.

Bisect, independent of #1435's: from #1516's own two logs (the broken run refuses 13 wave64 compute programs, the release 3) I took the new hashes and used victory translate --list over the named containers as a bisect criterion (good v2026.11.28.03, bad HEAD). It lands on 075785e — the same commit your first commit flips the default of. The seven containers I checked are exactly the four CS_Tree_BatchCull_*, CS_VarianceFilterAlpha, CS_ProjDecalReduceClassification_Scalarized and CS_Classification_Water; the sweep over the whole dump also finds the two XboxBvhBuilder.dll kernels refusing, so your 19-program list matches what I see.

In the game: since your commit 1 is semantically identical to the change I had built and tested independently (the same default flip, VICTORY_LDS_WRITE_ONLY_OK=0 as the strict mode), the numbers below are from that build. After victory preload (all shaders + 2,614 pipelines), the game loads into the world. Trees and bushes along the road stand from a distance — walking past them, nothing pops in where the broken build showed nothing until touched. The log reads 1 wave64 refusal for the whole session (6b82bc7d22016cb5, the CS_CollectTriangles_Meshlets baseline failer that also refuses on the release), down from 13; frame lines in the world read dropped 172–190 without a host pipeline at 1,500–2,400 draws/frame, 20–22 fps.

First cold start, separate finding (not about this change): without any warming, the title killed itself ~60 s into the first load with its own watchdog (0xc0000005 at +0x23cf683 — the signature #1484 reports on Proton) while commit headroom read 452 MiB on this 31 GB machine and the card sat 1–2 % busy with "nothing of ours queued". The same start after victory preload loads and plays. With every translator change invalidating the cache, a first start without warming may keep hitting this on mid-RAM machines — maybe worth automating the preload there.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7246870260 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1575#issuecomment-7246870260). Originally posted by [unueberlegt](https://github.com/unueberlegt) on 2026-11-28T22:37:49Z. --- Tested — **it works**, with an independent bisect data point and one finding from the first cold start. Setup: GeForce RTX 5070 12 GB, 31 GB RAM, Windows 11 26300, dump of the title v1.0.2.1, Series X profile. **Bisect, independent of #1435's:** from #1516's own two logs (the broken run refuses 13 wave64 compute programs, the release 3) I took the new hashes and used `victory translate --list` over the named containers as a bisect criterion (good `v2026.11.28.03`, bad HEAD). It lands on `075785e` — the same commit your first commit flips the default of. The seven containers I checked are exactly the four `CS_Tree_BatchCull_*`, `CS_VarianceFilterAlpha`, `CS_ProjDecalReduceClassification_Scalarized` and `CS_Classification_Water`; the sweep over the whole dump also finds the two `XboxBvhBuilder.dll` kernels refusing, so your 19-program list matches what I see. **In the game:** since your commit 1 is semantically identical to the change I had built and tested independently (the same default flip, `VICTORY_LDS_WRITE_ONLY_OK=0` as the strict mode), the numbers below are from that build. After `victory preload` (all shaders + 2,614 pipelines), the game loads into the world. Trees and bushes along the road **stand from a distance** — walking past them, nothing pops in where the broken build showed nothing until touched. The log reads **1** wave64 refusal for the whole session (`6b82bc7d22016cb5`, the `CS_CollectTriangles_Meshlets` baseline failer that also refuses on the release), down from 13; frame lines in the world read `dropped 172–190 without a host pipeline` at 1,500–2,400 draws/frame, 20–22 fps. **First cold start, separate finding (not about this change):** without any warming, the title killed itself ~60 s into the first load with its own watchdog (`0xc0000005` at `+0x23cf683` — the signature #1484 reports on Proton) while commit headroom read 452 MiB on this 31 GB machine and the card sat 1–2 % busy with "nothing of ours queued". The same start after `victory preload` loads and plays. With every translator change invalidating the cache, a first start without warming may keep hitting this on mid-RAM machines — maybe worth automating the preload there.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1575:upstream-pr/1575'
git switch 'upstream-pr/1575'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1575'
git switch 'upstream-pr/1575'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1575'
git switch 'upstream-pr/1575'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1575'
git switch 'main'
git merge --squash 'upstream-pr/1575'
git switch 'main'
git merge --ff-only 'upstream-pr/1575'
git switch 'main'
git merge 'upstream-pr/1575'
git push origin 'main'
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!1575
No description provided.