Shaders: pixel wave operations include helper lanes on SM 6.7 hosts #3749

Open
kilolimaVI wants to merge 4 commits from upstream-pr/3749 into main
kilolimaVI commented 2026-11-28 14:45:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-28T14:45:38Z.


Rebase of @Vyto-Line's #2373 onto main 63bcca4, with the one fix it needed to validate. Vyto-Line's commit is kept as-is with his authorship. #2373 is labeled "needs rebase" and has had no reply since the rebased branch was offered there on Nov 27, so this carries it forward. Happy to close this if he updates #2373 instead.

The problem (from #2373): the console's wave operations include a pixel shader's helper lanes; the host's leave them out. Lane-mask loops (v_readfirstlane, then the lanes sharing that value) never serve a helper lane whose value no live lane shares, so it runs to the loop limit. On an RTX 3080 that made single world draws take longer than the driver allows and reset the GPU.

The change:

  1. Vyto-Line's commit (rebased, conflicts resolved): where the host supports shader model 6.7, pixel shaders with wave operations are emitted as 6.7 with waveops-include-helper-lanes (DXC's [WaveOpsIncludeHelperLanes]). Other shaders' bytes are unchanged. The setting is part of the translation, so the shader cache keys each entry on it (entry_build), since the device decides it only after the cache is opened.
  2. Validator version fix: with dx.valver 1.7, every 6.7 pixel shader failed validation ("Container part 'Program Output Signature' does not match expected for module"), because container::signature writes the 1.6 format. dx.version and dx.shaderModel go to 6.7; dx.valver stays 1.6, which the validator accepts.
  3. helper_lane_tests (from #3571) is no longer ignored.

Builds on #3571. Its test commit is the first commit here.

Results, AMD Radeon 780M (RDNA3, SM 6.8) + WARP, Windows 11, validation fatal:

780M (wave64) WARP
main: helper-lane neighbours wrong 8 18
this PR 0 0

Full suite: victory-shader 303 passed, victory-gpu --features diagnostics 246 passed.

Merges cleanly with #3556, #3588, #2841 and #3007. With #3583 and #3613 the only conflict is the order of the test module lines in emit/mod.rs. Related: #1970 also sets WaveOpsIncludeHelperLanes, inside a 38-file local-fork bundle 479 commits behind main.

AI-assisted (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:issue:5541288097 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3749). Originally posted by [kilolimaVI](https://github.com/kilolimaVI) on 2026-11-28T14:45:38Z. --- Rebase of @Vyto-Line's #2373 onto main `63bcca4`, with the one fix it needed to validate. Vyto-Line's commit is kept as-is with his authorship. #2373 is labeled "needs rebase" and has had no reply since the rebased branch was offered there on Nov 27, so this carries it forward. Happy to close this if he updates #2373 instead. **The problem (from #2373):** the console's wave operations include a pixel shader's helper lanes; the host's leave them out. Lane-mask loops (`v_readfirstlane`, then the lanes sharing that value) never serve a helper lane whose value no live lane shares, so it runs to the loop limit. On an RTX 3080 that made single world draws take longer than the driver allows and reset the GPU. **The change:** 1. **Vyto-Line's commit** (rebased, conflicts resolved): where the host supports shader model 6.7, pixel shaders with wave operations are emitted as 6.7 with `waveops-include-helper-lanes` (DXC's `[WaveOpsIncludeHelperLanes]`). Other shaders' bytes are unchanged. The setting is part of the translation, so the shader cache keys each entry on it (`entry_build`), since the device decides it only after the cache is opened. 2. **Validator version fix:** with `dx.valver` 1.7, every 6.7 pixel shader failed validation ("Container part 'Program Output Signature' does not match expected for module"), because `container::signature` writes the 1.6 format. `dx.version` and `dx.shaderModel` go to 6.7; `dx.valver` stays 1.6, which the validator accepts. 3. `helper_lane_tests` (from #3571) is no longer ignored. **Builds on #3571.** Its test commit is the first commit here. **Results**, AMD Radeon 780M (RDNA3, SM 6.8) + WARP, Windows 11, validation fatal: | | 780M (wave64) | WARP | |---|---|---| | main: helper-lane neighbours wrong | 8 | 18 | | this PR | 0 | 0 | Full suite: `victory-shader` 303 passed, `victory-gpu --features diagnostics` 246 passed. Merges cleanly with #3556, #3588, #2841 and #3007. With #3583 and #3613 the only conflict is the order of the test module lines in `emit/mod.rs`. Related: #1970 also sets `WaveOpsIncludeHelperLanes`, inside a 38-file local-fork bundle 479 commits behind main. AI-assisted (Claude).
ColorMeBoom commented 2026-11-28 15:51:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ColorMeBoom on 2026-11-28T15:51:46Z.


Hardware run: RX 5700 XT (Navi 10, RDNA1, 32–64 lanes, driver 32.0.21045.29003, Windows 11 26200), head aa7f8a5 on 63bcca4.

  • lane_mask_loops_serve_helper_lanes_at_a_triangle_edge passes on the card and on WARP: wave64 hardware: 136 pixels, own result wrong 0, neighbour's wrong 0.
  • Full victory-shader --lib --features host: 303 passed, 0 failed, 3 ignored.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7241792434 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3749#issuecomment-7241792434). Originally posted by [ColorMeBoom](https://github.com/ColorMeBoom) on 2026-11-28T15:51:46Z. --- Hardware run: RX 5700 XT (Navi 10, RDNA1, 32–64 lanes, driver 32.0.21045.29003, Windows 11 26200), head `aa7f8a5` on `63bcca4`. - `lane_mask_loops_serve_helper_lanes_at_a_triangle_edge` passes on the card and on WARP: `wave64 hardware: 136 pixels, own result wrong 0, neighbour's wrong 0`. - Full `victory-shader --lib --features host`: 303 passed, 0 failed, 3 ignored. AI use: Claude Code (Claude Opus 5.5).
upipibi commented 2026-11-28 15:59:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-28T15:59:00Z.


NVIDIA row for this PR: it passes on Ampere, and the un-ignored test fails on this card without the fix. This adds an NVIDIA run to the 780M + WARP one in the description.

RTX 3070 (desktop), driver 616.56, Windows 11 Pro 10.0.26100, debug. Head aa7f8a5 on main 63bcca4 (three commits, clean).

  • helper_lane_tests::lane_mask_loops_serve_helper_lanes_at_a_triangle_edge (cargo test --locked -p victory-shader --lib -- helper_lane_tests --nocapture): 1 passed, 0 failed, 0 ignored, in 3 of 3 runs. The test prints one line per adapter, and every run printed both wave64 hardware: 136 pixels, own result wrong 0, neighbour's wrong 0 and the same line for wave64 warp. Three more runs with VICTORY_WARP=1, where every device is WARP, also passed with 0 wrong.

  • Negative control: the test with main's code. That is main's victory-gpu/src/host.rs, victory-gpu/src/shader_cache.rs, emit/bitcode.rs, emit/host.rs, emit/lower.rs and emit/shader.rs, plus emit/mod.rs from the PR's first commit 74ff14bb, which is main's file plus only the mod helper_lane_tests; line. git diff --stat HEAD: 7 files, 8 insertions, 111 deletions. git diff --stat 63bcca4: only helper_lane_tests.rs and the 2-line mod.rs change. Result: 0 passed, 1 failed, in 3 of 3 runs:

    • this card: own result wrong 0, neighbour's wrong 5 of 136 pixels, first (0, 0): neighbour 0 instead of 4;
    • WARP: neighbour's wrong 18 of 136, the same first pixel. That is the 18 the description gives for WARP.

    The 3070 gives 5 where the description's 780M gives 8. The values were the same in all three runs. The VICTORY_WARP=1 control failed 3 of 3 with 18 on both iterations. In the six control runs main's code did not hang or reset the device; each run finished in under a second.

  • The test's shader is translated once, after Host::new(false), so the hardware run uses the 3070's answer to the SM 6.7 check and the VICTORY_WARP=1 runs use WARP's. The count drops to 0 only with the PR's code, so both this driver and WARP take the 6.7 path. I did not log that check directly.

  • cargo test --locked -p victory-shader --lib -- --skip heap_direct_texture_reads_mark_their_heap_index:

    • this PR: 299 passed, 3 failed, 3 ignored;
    • main 63bcca4: 298 passed, 3 failed, 3 ignored.

    The 3 failures are the same on both: stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride, stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros and synthetic_tests::gathers_at_a_level_match_the_hardware. The skipped test crashes the binary on this card (open issue #2571).

  • cargo test --locked -p victory-gpu --lib (the PR changes host.rs and shader_cache.rs there):

    • this PR: 229 passed, 2 failed, 1 ignored;
    • main 63bcca4: 229 passed, 2 failed, 1 ignored.

    The same 2 fail on both: descriptor::host::tests::dynamic_slots_are_held_until_released and memory::tests::lists_share_a_table_and_copies_keep_their_views.

Nothing NVIDIA-specific: Ampere misses fewer helper-lane neighbours than the 780M on main (5 against 8), and none with the PR.

Not tested: a title run, so not the world draws that reset the RTX 3080; --features diagnostics for victory-gpu; the shader cache's entry_build key against an existing cache folder; a host without SM 6.7; the merges with #3556, #3588, #2841, #3007, #3583 or #3613.

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7241883582 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3749#issuecomment-7241883582). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-28T15:59:00Z. --- NVIDIA row for this PR: it passes on Ampere, and the un-ignored test fails on this card without the fix. This adds an NVIDIA run to the 780M + WARP one in the description. RTX 3070 (desktop), driver 616.56, Windows 11 Pro 10.0.26100, debug. Head `aa7f8a5` on main `63bcca4` (three commits, clean). - `helper_lane_tests::lane_mask_loops_serve_helper_lanes_at_a_triangle_edge` (`cargo test --locked -p victory-shader --lib -- helper_lane_tests --nocapture`): 1 passed, 0 failed, 0 ignored, in 3 of 3 runs. The test prints one line per adapter, and every run printed both `wave64 hardware: 136 pixels, own result wrong 0, neighbour's wrong 0` and the same line for `wave64 warp`. Three more runs with `VICTORY_WARP=1`, where every device is WARP, also passed with 0 wrong. - Negative control: the test with main's code. That is main's `victory-gpu/src/host.rs`, `victory-gpu/src/shader_cache.rs`, `emit/bitcode.rs`, `emit/host.rs`, `emit/lower.rs` and `emit/shader.rs`, plus `emit/mod.rs` from the PR's first commit `74ff14bb`, which is main's file plus only the `mod helper_lane_tests;` line. `git diff --stat HEAD`: 7 files, 8 insertions, 111 deletions. `git diff --stat 63bcca4`: only `helper_lane_tests.rs` and the 2-line `mod.rs` change. Result: 0 passed, 1 failed, in 3 of 3 runs: - this card: `own result wrong 0, neighbour's wrong 5` of 136 pixels, first `(0, 0): neighbour 0 instead of 4`; - WARP: `neighbour's wrong 18` of 136, the same first pixel. That is the 18 the description gives for WARP. The 3070 gives 5 where the description's 780M gives 8. The values were the same in all three runs. The `VICTORY_WARP=1` control failed 3 of 3 with 18 on both iterations. In the six control runs main's code did not hang or reset the device; each run finished in under a second. - The test's shader is translated once, after `Host::new(false)`, so the hardware run uses the 3070's answer to the SM 6.7 check and the `VICTORY_WARP=1` runs use WARP's. The count drops to 0 only with the PR's code, so both this driver and WARP take the 6.7 path. I did not log that check directly. - `cargo test --locked -p victory-shader --lib -- --skip heap_direct_texture_reads_mark_their_heap_index`: - this PR: 299 passed, 3 failed, 3 ignored; - main `63bcca4`: 298 passed, 3 failed, 3 ignored. The 3 failures are the same on both: `stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride`, `stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` and `synthetic_tests::gathers_at_a_level_match_the_hardware`. The skipped test crashes the binary on this card (open issue #2571). - `cargo test --locked -p victory-gpu --lib` (the PR changes `host.rs` and `shader_cache.rs` there): - this PR: 229 passed, 2 failed, 1 ignored; - main `63bcca4`: 229 passed, 2 failed, 1 ignored. The same 2 fail on both: `descriptor::host::tests::dynamic_slots_are_held_until_released` and `memory::tests::lists_share_a_table_and_copies_keep_their_views`. Nothing NVIDIA-specific: Ampere misses fewer helper-lane neighbours than the 780M on main (5 against 8), and none with the PR. Not tested: a title run, so not the world draws that reset the RTX 3080; `--features diagnostics` for `victory-gpu`; the shader cache's `entry_build` key against an existing cache folder; a host without SM 6.7; the merges with #3556, #3588, #2841, #3007, #3583 or #3613. AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
andrewpozdnakov7-jpg commented 2026-11-28 16:19:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T16:19:31Z.


I checked the disk-cache question from @upipibi's report on aa7f8a5, with app-local WARP 1.0.22 and Agility SDK 1.620.2. I used the synthetic pixel program from your triangle-edge test and the public use_shader_cache and host_shader entry points.

First process in a fresh cache First two processes Next two processes
Offline translation Miss with SM 6.6, miss with SM 6.7 on WARP Hit with SM 6.7 on WARP, hit with SM 6.6 offline
WARP Miss with SM 6.7, miss with SM 6.6 offline Hit with SM 6.6 offline, hit with SM 6.7 on WARP

Each row shared one disk cache directory across four separate processes. In every case the cached shader matched a fresh translation, including the emitted DXIL. With only the entry key selector reverted to the main behavior, the process with WARP incorrectly hit the offline SM 6.6 entry and the assertion failed. The existing triangle-edge test also passed on WARP with 0 incorrect neighbour values out of 136 pixels.

This checks offline prefill and reuse with an SM 6.7-capable host. The local run used WARP. GitHub lists the upstream CI run as action required with zero jobs started.

Please retain Git authorship if reusing the probe, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding it into another commit. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7242154153 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3749#issuecomment-7242154153). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T16:19:31Z. --- I checked the disk-cache question from @upipibi's report on `aa7f8a5`, with app-local WARP 1.0.22 and Agility SDK 1.620.2. I used the synthetic pixel program from your triangle-edge test and the public `use_shader_cache` and `host_shader` entry points. | First process in a fresh cache | First two processes | Next two processes | | --- | --- | --- | | Offline translation | Miss with SM 6.6, miss with SM 6.7 on WARP | Hit with SM 6.7 on WARP, hit with SM 6.6 offline | | WARP | Miss with SM 6.7, miss with SM 6.6 offline | Hit with SM 6.6 offline, hit with SM 6.7 on WARP | Each row shared one disk cache directory across four separate processes. In every case the cached shader matched a fresh translation, including the emitted DXIL. With only the entry key selector reverted to the main behavior, the process with WARP incorrectly hit the offline SM 6.6 entry and the assertion failed. The existing triangle-edge test also passed on WARP with 0 incorrect neighbour values out of 136 pixels. This checks offline prefill and reuse with an SM 6.7-capable host. The local run used WARP. GitHub lists the [upstream CI run](https://github.com/Marvisak/VIctory/actions/runs/46156313600) as action required with zero jobs started. Please retain Git authorship if reusing the probe, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding it into another commit. AI-assisted with OpenAI Codex.
kilolimaVI commented 2026-11-28 16:26:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-28T16:26:46Z.


@andrewpozdnakov7-jpg thanks, that closes the one part nobody had run: the per-entry cache key, with the negative control showing main's keying would hand WARP the 6.6 entry.

If the probe can live as a test (two translations into one temporary cache folder, one with helper-lane waves on and one off, asserting each reads back its own DXIL), I'd like to add it to this PR with your authorship kept, as with the gather tests on #3613. Could you push it as a commit on top of aa7f8a5 and share the link?

AI-assisted (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7242248840 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3749#issuecomment-7242248840). Originally posted by [kilolimaVI](https://github.com/kilolimaVI) on 2026-11-28T16:26:46Z. --- @andrewpozdnakov7-jpg thanks, that closes the one part nobody had run: the per-entry cache key, with the negative control showing main's keying would hand WARP the 6.6 entry. If the probe can live as a test (two translations into one temporary cache folder, one with helper-lane waves on and one off, asserting each reads back its own DXIL), I'd like to add it to this PR with your authorship kept, as with the gather tests on #3613. Could you push it as a commit on top of `aa7f8a5` and share the link? AI-assisted (Claude).
andrewpozdnakov7-jpg commented 2026-11-28 16:43:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T16:43:32Z.


The test commit 152ebaa is directly on aa7f8a5. It uses a generated straight-line pixel shader and the public shader-cache entry points. In one temporary cache directory the two settings each miss once, then each hits its own entry. At every step the cached HostShader matches a fresh translation, with DXIL shader model 6.6 or 6.7 as appropriate.

The separate integration test executable owns its cache and translation setting. It runs on the CPU and creates no GPU device. With main's entry key the test fails on the first helper-enabled lookup because that lookup hits the earlier entry. The author head passes the integration test, the shader-cache unit tests, strict Clippy, and the asset policy.

You can cherry-pick 152ebaa. Please retain the Git author, or add a Co-authored-by trailer for andrewpozdnakov7-jpg [email protected] if folding the test into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7242463623 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3749#issuecomment-7242463623). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T16:43:32Z. --- The [test commit 152ebaa](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/152ebaae1e6084cafb829d8e5e712a39c6ca2d9a) is directly on aa7f8a5. It uses a generated straight-line pixel shader and the public shader-cache entry points. In one temporary cache directory the two settings each miss once, then each hits its own entry. At every step the cached HostShader matches a fresh translation, with DXIL shader model 6.6 or 6.7 as appropriate. The separate integration test executable owns its cache and translation setting. It runs on the CPU and creates no GPU device. With main's entry key the test fails on the first helper-enabled lookup because that lookup hits the earlier entry. The author head passes the integration test, the shader-cache unit tests, strict Clippy, and the asset policy. You can cherry-pick 152ebaa. Please retain the Git author, or add a Co-authored-by trailer for andrewpozdnakov7-jpg <[email protected]> if folding the test into another commit. AI-assisted with OpenAI Codex.
kilolimaVI commented 2026-11-28 18:08:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-28T18:08:00Z.


@andrewpozdnakov7-jpg's cache test is now on this branch as-is, with his authorship (head 152ebaa). Radeon 780M (RDNA3) + WARP, Windows 11:

result
helper_lane_cache with main's shader_cache.rs fails: the helper-lane lookup hits the earlier entry (helper lanes: true, hit true, want false)
helper_lane_cache on 152ebaa passes, 5 of 5 runs
lane_mask_loops_serve_helper_lanes_at_a_triangle_edge 780M 0/136, WARP 0/136
full suite (victory-shader + victory-gpu --features diagnostics) 553 passed

With upipibi's RTX 3070 (5 → 0 neighbours wrong) and ColorMeBoom's RDNA1 run, that covers the shader change on three GPU families and the cache key with a test. What's left untested is a title run.

AI-assisted (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7243555532 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3749#issuecomment-7243555532). Originally posted by [kilolimaVI](https://github.com/kilolimaVI) on 2026-11-28T18:08:00Z. --- @andrewpozdnakov7-jpg's cache test is now on this branch as-is, with his authorship (head `152ebaa`). Radeon 780M (RDNA3) + WARP, Windows 11: | | result | |---|---| | `helper_lane_cache` with main's `shader_cache.rs` | fails: the helper-lane lookup hits the earlier entry (`helper lanes: true`, hit true, want false) | | `helper_lane_cache` on `152ebaa` | passes, 5 of 5 runs | | `lane_mask_loops_serve_helper_lanes_at_a_triangle_edge` | 780M 0/136, WARP 0/136 | | full suite (`victory-shader` + `victory-gpu --features diagnostics`) | 553 passed | With upipibi's RTX 3070 (5 → 0 neighbours wrong) and ColorMeBoom's RDNA1 run, that covers the shader change on three GPU families and the cache key with a test. What's left untested is a title run. AI-assisted (Claude).
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/3749:upstream-pr/3749'
git switch 'upstream-pr/3749'

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