shader: VICTORY_WAVE_WIDE=last, wave-wide branches only where nothing else takes a wave64 program #1138

Open
grindersky wants to merge 1 commit from upstream-pr/1141 into main
grindersky commented 2026-11-25 21:30:29 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by grindersky on 2026-11-25T21:30:29Z.


On a host whose waves are 32 lanes (NVIDIA), console wave64 compute programs that every other form leaves at 64 lanes are refused outright (CreateComputePipelineState: E_INVALIDARG, as they keep WaveSize(64)).

VICTORY_WAVE_WIDE=1 takes them, but it runs before the approximate local-wave forms, so it also re-forms programs those already take (23 in my run), with group barriers inside branches. On my machine that lost the card about a minute into the world, like runs 121-124.

This adds VICTORY_WAVE_WIDE=last: the same widen form, tried after every other form, so it only touches programs that would otherwise be refused. The default and =1 behave as before.

Tested

RTX 5070 (Blackwell, 32-lane waves), Windows 10 22H2 with the Agility SDK, diag build, with the README's run-253 switch set, through the cutscene into the first rooms (~8 minutes):

refused compute pipelines device
default 7 ok
VICTORY_WAVE_WIDE=1 3 removed after ~1 min
VICTORY_WAVE_WIDE=last 3 ok

Now made: 369cbe906ea72764, 2cc4c197ee29e291, 5dc3b25986622949, 6f225b641c5b0708.
Still refused: 2da4beb386509b77, 02384a60fda6f2d0, 6b82bc7d22016cb5 (VICTORY_WAVE_WHY: "wave-wide branches in a thread group of several console waves is not supported"), and the mesh pipeline f5e50eb2108c425b + ce3f0432a08f1d35.

cargo test -p victory-shader: 192 passed, 23 failed both with and without the change (the failures are the GPU tests, which find no SM 6.6 device from the test binary on Windows 10).

I have not checked these programs' output against an AMD card, only that they now run and the device stays up.

🤖 Generated with Claude Code

<!-- greyfinch-sync:fxceless/victory-fork:issue:5499501777 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1141). Originally posted by [grindersky](https://github.com/grindersky) on 2026-11-25T21:30:29Z. --- On a host whose waves are 32 lanes (NVIDIA), console wave64 compute programs that every other form leaves at 64 lanes are refused outright (`CreateComputePipelineState`: `E_INVALIDARG`, as they keep `WaveSize(64)`). `VICTORY_WAVE_WIDE=1` takes them, but it runs before the approximate local-wave forms, so it also re-forms programs those already take (23 in my run), with group barriers inside branches. On my machine that lost the card about a minute into the world, like runs 121-124. This adds `VICTORY_WAVE_WIDE=last`: the same `widen` form, tried after every other form, so it only touches programs that would otherwise be refused. The default and `=1` behave as before. ## Tested RTX 5070 (Blackwell, 32-lane waves), Windows 10 22H2 with the Agility SDK, diag build, with the README's run-253 switch set, through the cutscene into the first rooms (~8 minutes): | | refused compute pipelines | device | |---|---|---| | default | 7 | ok | | `VICTORY_WAVE_WIDE=1` | 3 | removed after ~1 min | | `VICTORY_WAVE_WIDE=last` | 3 | ok | Now made: `369cbe906ea72764`, `2cc4c197ee29e291`, `5dc3b25986622949`, `6f225b641c5b0708`. Still refused: `2da4beb386509b77`, `02384a60fda6f2d0`, `6b82bc7d22016cb5` (`VICTORY_WAVE_WHY`: "wave-wide branches in a thread group of several console waves is not supported"), and the mesh pipeline `f5e50eb2108c425b` + `ce3f0432a08f1d35`. `cargo test -p victory-shader`: 192 passed, 23 failed both with and without the change (the failures are the GPU tests, which find no SM 6.6 device from the test binary on Windows 10). I have not checked these programs' output against an AMD card, only that they now run and the device stays up. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Dathinel commented 2026-11-25 22:07:24 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Dathinel on 2026-11-25T21:31:37Z.


An Ampere data point for the output check left open here: frapopn24/vanguard#3 reports that all four pipelines were created on an RTX 3080, but five runs with a per-shader allowlist isolated visible corruption at the bottom of the frame to enabling 369cbe906ea72764. Their other three showed no visible fault. Their implementation also has a per-shader exclusion and tries multiple candidate forms, so this is a candidate for a controlled comparison on this head, not a reproduction against this PR.

On our RTX 3050 Laptop baseline (local build based on c36971b), the host already creates 2cc4c197ee29e291; it refuses 369cbe906ea72764 with 0x80070057 and reports one dropped dispatch/frame for it in the last two diagnostic intervals. This makes the particle shader a useful A/B: keep the other three and the scene fixed, toggle just this hash, and compare rendered output as well as pipeline creation.

Synthetic check on this PR head (f59dbdc), RTX 3050 Laptop: I ran both existing emit::wave64_tests::program(skip) variants through the normal emit entry point with a 32-lane host target, each environment setting in a fresh process. With default local-wave settings, last preserved the default DXIL byte-for-byte for both variants; =1 changed the SCC0 variant. As a positive control, with VICTORY_WAVE_LOCAL=idiom, SCC0 was refused at 0x78 without last, and with last the retry produced validated 32-lane DXIL. For 1, 10, 33, 40 and 64 active lanes the GPU returned 0x1, 0x1f, 0x1ffff, 0xfffff and 0xffffffff respectively. Both branch variants matched the reference on all five inputs. This checks the fallback order and a reduction across the two halves. The particle shader's rendered output remains untested on this head here. AI-assisted.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7175194620 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1141#issuecomment-7175194620). Originally posted by [Dathinel](https://github.com/Dathinel) on 2026-11-25T21:31:37Z. --- An Ampere data point for the output check left open here: [frapopn24/vanguard#3](https://github.com/frapopn24/vanguard/pull/3) reports that all four pipelines were created on an RTX 3080, but five runs with a per-shader allowlist isolated visible corruption at the bottom of the frame to enabling `369cbe906ea72764`. Their other three showed no visible fault. Their implementation also has a per-shader exclusion and tries multiple candidate forms, so this is a candidate for a controlled comparison on this head, not a reproduction against this PR. On our RTX 3050 Laptop baseline (local build based on `c36971b`), the host already creates `2cc4c197ee29e291`; it refuses `369cbe906ea72764` with `0x80070057` and reports one dropped dispatch/frame for it in the last two diagnostic intervals. This makes the particle shader a useful A/B: keep the other three and the scene fixed, toggle just this hash, and compare rendered output as well as pipeline creation. Synthetic check on this PR head (`f59dbdc`), RTX 3050 Laptop: I ran both existing `emit::wave64_tests::program(skip)` variants through the normal `emit` entry point with a 32-lane host target, each environment setting in a fresh process. With default local-wave settings, `last` preserved the default DXIL byte-for-byte for both variants; `=1` changed the SCC0 variant. As a positive control, with `VICTORY_WAVE_LOCAL=idiom`, SCC0 was refused at 0x78 without `last`, and with `last` the retry produced validated 32-lane DXIL. For 1, 10, 33, 40 and 64 active lanes the GPU returned 0x1, 0x1f, 0x1ffff, 0xfffff and 0xffffffff respectively. Both branch variants matched the reference on all five inputs. This checks the fallback order and a reduction across the two halves. The particle shader's rendered output remains untested on this head here. AI-assisted.
HLVM04 commented 2026-11-25 22:07:26 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by HLVM04 on 2026-11-25T22:07:00Z.


A related data point from an RTX 5070 Ti (32-lane waves, driver 616.64). It is not this PR's code.

  • A similar last-resort wide form (fork 9376fd6, Series X profile): when only the otherwise-refused programs took a wave-wide form, 4 of the 7 refused pipelines were built. It cost frame rate and did not visibly reduce artifacts. One machine, few runs.
  • The three this PR leaves refused (2da4beb386509b77, 02384a60fda6f2d0, 6b82bc7d22016cb5) are built on the same card by #799's loose-LDS fallback. In all it builds 5 of the 7, also 369cbe906ea72764 and 2cc4c197ee29e291 (Series S profile, 9376fd6 + #798/#783/#799).
    • With it, a new pattern on the window in the first scene comes from 2da4beb386509b77 alone, bisected with VICTORY_SKIP_PIPELINES. A PIX capture shows it is the title's own textured wired glass, so that output looks right.
    • Only the hair rim where it overlaps the window looks distorted, cause unknown.
<!-- greyfinch-sync:fxceless/victory-fork:comment:7175955756 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1141#issuecomment-7175955756). Originally posted by [HLVM04](https://github.com/HLVM04) on 2026-11-25T22:07:00Z. --- A related data point from an RTX 5070 Ti (32-lane waves, driver 616.64). It is not this PR's code. - **A similar last-resort wide form** (fork `9376fd6`, Series X profile): when only the otherwise-refused programs took a wave-wide form, 4 of the 7 refused pipelines were built. It cost frame rate and did not visibly reduce artifacts. One machine, few runs. - **The three this PR leaves refused** (`2da4beb386509b77`, `02384a60fda6f2d0`, `6b82bc7d22016cb5`) are built on the same card by #799's loose-LDS fallback. In all it builds 5 of the 7, also `369cbe906ea72764` and `2cc4c197ee29e291` (Series S profile, `9376fd6` + #798/#783/#799). - With it, a new pattern on the window in the first scene comes from `2da4beb386509b77` alone, bisected with `VICTORY_SKIP_PIPELINES`. A PIX capture shows it is the title's own textured wired glass, so that output looks right. - Only the hair rim where it overlaps the window looks distorted, cause unknown.
Dathinel commented 2026-11-28 17:14:59 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Dathinel on 2026-11-28T17:14:59Z.


A test report from a small card. I ported this by hand to an f4b48ad-lineage tree (https://github.com/Dathinel/victory-4gb, coolfox-4gb, pull request #39 there; that tree's emit has named forms and a driver_loop argument to widen, so it is a port, not a pick) and ran it on an RTX 3050 Laptop 4 GB (32-lane waves), Windows 11, Series S profile, title 1.0.2.1.

Translation, VICTORY_WAVE_WIDE=last, six runs so far, no device loss in any:

Program Unset last
5dc3b25986622949 (CS_TransmissionVolumetrics_Tiled) refused translated, pipeline made, bound
6f225b641c5b0708 (..._Tiled_LocalLights) refused translated, pipeline made, bound
926c46bab3b86bd6 (CS_TransmissionVolumetricsSubmerged) refused translated, pipeline made, bound
02384a60fda6f2d0, 6b82bc7d22016cb5 refused still refused

369cbe906ea72764 and 2cc4c197ee29e291 from your list are taken there by the plain wave-wide form already, so last does not come into it for them.

Picture: the open sea and the boat cutscene go from a dark grey-blue to a clear turquoise with the light through it (the same moments of runs with and without, by eye). Underwater itself was not checked.

Cost: with the boat standing still at the start of free play (about 3,500 draws a frame, 8-minute runs, median of the last frame lines): 114.8 ms a frame with last, 111.5 ms unset. One run a side.

=1 for comparison: loses the device here about 160 s in (one run), as you describe.

One note for whoever merges: on the tree I ported to, wide_option also decides two defaults (a pair of scene kernels that take the wide form when the variable is unset, and a driver-loop retry), so I made last leave both as they are when unset. On this tree that does not arise.

No game files or captures. Measured and written with AI assistance (Claude Code).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7242869518 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1141#issuecomment-7242869518). Originally posted by [Dathinel](https://github.com/Dathinel) on 2026-11-28T17:14:59Z. --- A test report from a small card. I ported this by hand to an `f4b48ad`-lineage tree (https://github.com/Dathinel/victory-4gb, `coolfox-4gb`, pull request #39 there; that tree's `emit` has named forms and a `driver_loop` argument to `widen`, so it is a port, not a pick) and ran it on an RTX 3050 Laptop 4 GB (32-lane waves), Windows 11, Series S profile, title 1.0.2.1. **Translation, `VICTORY_WAVE_WIDE=last`, six runs so far, no device loss in any:** | Program | Unset | `last` | |---|---|---| | `5dc3b25986622949` (`CS_TransmissionVolumetrics_Tiled`) | refused | translated, pipeline made, bound | | `6f225b641c5b0708` (`..._Tiled_LocalLights`) | refused | translated, pipeline made, bound | | `926c46bab3b86bd6` (`CS_TransmissionVolumetricsSubmerged`) | refused | translated, pipeline made, bound | | `02384a60fda6f2d0`, `6b82bc7d22016cb5` | refused | still refused | `369cbe906ea72764` and `2cc4c197ee29e291` from your list are taken there by the plain wave-wide form already, so `last` does not come into it for them. **Picture:** the open sea and the boat cutscene go from a dark grey-blue to a clear turquoise with the light through it (the same moments of runs with and without, by eye). Underwater itself was not checked. **Cost:** with the boat standing still at the start of free play (about 3,500 draws a frame, 8-minute runs, median of the last frame lines): 114.8 ms a frame with `last`, 111.5 ms unset. One run a side. **`=1` for comparison:** loses the device here about 160 s in (one run), as you describe. One note for whoever merges: on the tree I ported to, `wide_option` also decides two defaults (a pair of scene kernels that take the wide form when the variable is unset, and a driver-loop retry), so I made `last` leave both as they are when unset. On this tree that does not arise. No game files or captures. Measured and written with AI assistance (Claude Code).
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/1141:upstream-pr/1141'
git switch 'upstream-pr/1141'

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/1141'
git switch 'upstream-pr/1141'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1141'
git switch 'upstream-pr/1141'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1141'
git switch 'main'
git merge --squash 'upstream-pr/1141'
git switch 'main'
git merge --ff-only 'upstream-pr/1141'
git switch 'main'
git merge 'upstream-pr/1141'
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
fxceless/victory-fork!1138
No description provided.