Shader tests: run the 32-lane host form on AMD cards; ds_bpermute reads within its half #363

Open
github-bot wants to merge 2 commits from github-bot/gh-363 into a-publier AGit
Owner

@⁠TinkerBell-90 on GitHub · 2026-11-26 22:17 UTC · original
TinkerBell-90:host-wave32-tests → a-publier · +94 −24 · 3 files · 2 commits · open

Two commits.

1. VICTORY_TEST_HOST_WAVE=32 (test builds only). The shader tests translate with no host width, which lowers console wave64 programs as a 64-lane host does. NVIDIA and Intel cards get another form (two host waves per console wave), and today only some tests in wave64_tests and permlane_tests set that width themselves. An RDNA card runs waves of 32 as well, so with this variable an AMD card runs the whole suite in the form those cards get. It is the test-suite side of what VICTORY_HOST_WAVE does for victory translate, with the GPU run on top. A test that sets its own width keeps it. Documented in docs/README-fxceless.md, after the validator notes:

$env:VICTORY_TEST_HOST_WAVE = '32'
cargo test -p victory-shader --lib --locked -- --test-threads=1

2. ds_bpermute_b32 reads within the lane's 32-lane half. The first full run in that mode changed one result: a_backward_permute_reads_the_lane_its_address_names was refused ("a lane permute across two host waves"). GFX10 runs ds_bpermute_b32 on each half of a wave of 64 on its own: lane l reads lane (l & 32) | (address / 4 & 31). LLVM has supportsWaveWideBPermute false for GFX10 and GFX11 in wave64, and Mesa's ACO says "ds_bpermute is restricted to 32 lanes on GFX10-GFX11.7". So the refusal was not needed, and on 64-lane hosts the translation read the wrong lane whenever the address named the other half. @⁠God489's #128 makes the same reading on main, inside a larger change; this is the a-publier version of that one point. If you would rather take it from #128, I will close this one.

Tested on an RX 9070 XT under Linux: Wine 10 + vkd3d-proton 3.1 with DXVK's dxgi, Mesa 26.0.8 RADV. Not Windows, and nothing was run in game. I have not checked which of the title's programs name a lane in the other half.

victory-shader --lib default VICTORY_TEST_HOST_WAVE=32
a-publier cd8dfc0 + commit 1 300 passed, 1 failed, 4 ignored 299 passed, 2 failed, 4 ignored
+ commit 2 (one new test) 301 passed, 1 failed, 4 ignored 301 passed, 1 failed, 4 ignored

The failure left in every row is stub_pipeline_is_created (vkd3d-proton accepts the zero-digest DXIL). a_first_lane_read_of_a_wave_alike_sum_under_a_wave_alike_loop crashes RADV's compiler on this machine, so it was skipped in every row.

  • New GPU test a_backward_permute_reads_within_the_lanes_half: lane t names lane t ^ 33 and must read t ^ 1, for 64 and 128 threads, on host waves of 64 and of 32. All four shapes ran on the card and pass.
  • Negative control, commit 2's lowering reverted with the test kept: on host waves of 64 lane t reads t ^ 33, and with VICTORY_TEST_HOST_WAVE=32 the translation is refused again.
  • cargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-gnu -- -D warnings is clean; rustfmt reports nothing on the changed lines.
  • ds_permute_b32 (the forward permute) is not touched.

AI-assisted.

**@⁠TinkerBell-90** on GitHub · 2026-11-26 22:17 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/363) `TinkerBell-90:host-wave32-tests` → `a-publier` · +94 −24 · 3 files · 2 commits · open Two commits. **1. `VICTORY_TEST_HOST_WAVE=32` (test builds only).** The shader tests translate with no host width, which lowers console wave64 programs as a 64-lane host does. NVIDIA and Intel cards get another form (two host waves per console wave), and today only some tests in `wave64_tests` and `permlane_tests` set that width themselves. An RDNA card runs waves of 32 as well, so with this variable an AMD card runs the whole suite in the form those cards get. It is the test-suite side of what `VICTORY_HOST_WAVE` does for `victory translate`, with the GPU run on top. A test that sets its own width keeps it. Documented in `docs/README-fxceless.md`, after the validator notes: ```powershell $env:VICTORY_TEST_HOST_WAVE = '32' cargo test -p victory-shader --lib --locked -- --test-threads=1 ``` **2. `ds_bpermute_b32` reads within the lane's 32-lane half.** The first full run in that mode changed one result: `a_backward_permute_reads_the_lane_its_address_names` was refused ("a lane permute across two host waves"). GFX10 runs `ds_bpermute_b32` on each half of a wave of 64 on its own: lane l reads lane `(l & 32) | (address / 4 & 31)`. LLVM has `supportsWaveWideBPermute` false for GFX10 and GFX11 in wave64, and Mesa's ACO says "ds_bpermute is restricted to 32 lanes on GFX10-GFX11.7". So the refusal was not needed, and on 64-lane hosts the translation read the wrong lane whenever the address named the other half. @⁠God489's #128 makes the same reading on `main`, inside a larger change; this is the `a-publier` version of that one point. If you would rather take it from #128, I will close this one. **Tested** on an RX 9070 XT under Linux: Wine 10 + vkd3d-proton 3.1 with DXVK's dxgi, Mesa 26.0.8 RADV. Not Windows, and nothing was run in game. I have not checked which of the title's programs name a lane in the other half. | `victory-shader --lib` | default | `VICTORY_TEST_HOST_WAVE=32` | |---|---|---| | `a-publier` `cd8dfc0` + commit 1 | 300 passed, 1 failed, 4 ignored | 299 passed, 2 failed, 4 ignored | | + commit 2 (one new test) | 301 passed, 1 failed, 4 ignored | 301 passed, 1 failed, 4 ignored | The failure left in every row is `stub_pipeline_is_created` (vkd3d-proton accepts the zero-digest DXIL). `a_first_lane_read_of_a_wave_alike_sum_under_a_wave_alike_loop` crashes RADV's compiler on this machine, so it was skipped in every row. - New GPU test `a_backward_permute_reads_within_the_lanes_half`: lane t names lane t ^ 33 and must read t ^ 1, for 64 and 128 threads, on host waves of 64 and of 32. All four shapes ran on the card and pass. - Negative control, commit 2's lowering reverted with the test kept: on host waves of 64 lane t reads t ^ 33, and with `VICTORY_TEST_HOST_WAVE=32` the translation is refused again. - `cargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-gnu -- -D warnings` is clean; rustfmt reports nothing on the changed lines. - `ds_permute_b32` (the forward permute) is not touched. AI-assisted.
Without a host width the tests lower console wave64 programs as a
64-lane host does, so the form NVIDIA and Intel cards get (two host
waves per console wave) is only run by the few tests that set the width
themselves. RDNA cards also run waves of 32: with this variable an AMD
card runs the whole suite in that form. A test that sets its own width
keeps it. Test builds only.
GFX10 runs ds_bpermute_b32 on each half of a wave of 64 on its own:
lane l reads lane (l & 32) | (address / 4 & 31). LLVM says so
(supportsWaveWideBPermute is false for GFX10 and GFX11 in wave64), and
so does Mesa's ACO ("ds_bpermute is restricted to 32 lanes on
GFX10-GFX11.7").

The translation read lane (address / 4 & 63): on 64-lane hosts a lane
naming the other half read it, and on 32-lane hosts the program was
refused as a permute across two host waves. It now reads within the
half in both forms, and ds_bpermute no longer makes a console wave64
program exchange between its host waves.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:58:33 +00:00
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-26 23:36 UTC · original

Tested on Windows with an RDNA 2 card, to complement your Linux/RADV run: RX 6950 XT (waves 32 to 64), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release, at 184da29, cargo test -p victory-shader --lib -- --test-threads=1:

  • without VICTORY_TEST_HOST_WAVE (64-lane form): 303 passed, 0 failed, 4 ignored;
  • with VICTORY_TEST_HOST_WAVE=32 (the form NVIDIA and Intel cards get): 303 passed, 0 failed, 4 ignored, a_backward_permute_reads_the_lane_its_address_names included.

So the whole suite in the 32-lane form also passes on the native D3D12 driver.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-26 23:36 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/363#issuecomment-7205684167) Tested on Windows with an RDNA 2 card, to complement your Linux/RADV run: RX 6950 XT (waves 32 to 64), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release, at `184da29`, `cargo test -p victory-shader --lib -- --test-threads=1`: - without `VICTORY_TEST_HOST_WAVE` (64-lane form): 303 passed, 0 failed, 4 ignored; - with `VICTORY_TEST_HOST_WAVE=32` (the form NVIDIA and Intel cards get): 303 passed, 0 failed, 4 ignored, `a_backward_permute_reads_the_lane_its_address_names` included. So the whole suite in the 32-lane form also passes on the native D3D12 driver. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠lvndrpup on GitHub · 2026-11-27 03:52 UTC · original · reviewed

A native NVIDIA data point, beside the Linux/RADV and Windows RX 6950 XT runs: RTX 3060 Ti 8 GB (Ampere, waves of 32 lanes only), driver 610.88, Ryzen 5 5600X, 32 GB, Windows 11 build 26300, Rust 1.98.1, debug. This PR (184da29) was merged into the current a-publier (4eb6cfd), which it merges into cleanly. Command: victory-shader --lib -- --test-threads=1.

passed failed ignored time
a-publier 4eb6cfd 303 0 4 344 s
with this PR 304 0 4 370 s
with this PR, VICTORY_TEST_HOST_WAVE=32 304 0 4 407 s

a_backward_permute_reads_the_lane_its_address_names and the new a_backward_permute_reads_within_the_lanes_half pass in both forms. So the whole suite in the 32-lane form also passes on a card whose hardware waves are 32 lanes.

**@⁠lvndrpup** on GitHub · 2026-11-27 03:52 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/363#pullrequestreview-6083246427) · **reviewed** A native NVIDIA data point, beside the Linux/RADV and Windows RX 6950 XT runs: RTX 3060 Ti 8 GB (Ampere, waves of 32 lanes only), driver 610.88, Ryzen 5 5600X, 32 GB, Windows 11 build 26300, Rust 1.98.1, debug. This PR (`184da29`) was merged into the current `a-publier` (`4eb6cfd`), which it merges into cleanly. Command: `victory-shader --lib -- --test-threads=1`. | | passed | failed | ignored | time | |---|---|---|---|---| | `a-publier` `4eb6cfd` | 303 | 0 | 4 | 344 s | | with this PR | 304 | 0 | 4 | 370 s | | with this PR, `VICTORY_TEST_HOST_WAVE=32` | 304 | 0 | 4 | 407 s | `a_backward_permute_reads_the_lane_its_address_names` and the new `a_backward_permute_reads_within_the_lanes_half` pass in both forms. So the whole suite in the 32-lane form also passes on a card whose hardware waves are 32 lanes.
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-27 06:49 UTC · original

Tested on an RX 7900 XT (RDNA3), driver 32.0.32029.2010, Windows 11 26300, Rust 1.98.1, release. This PR (184da29) was merged onto a-publier 4eb6cfd and compared with 4eb6cfd.

Negative control on the native Windows driver. I reverted the ds_bpermute lowering change in lower.rs and kept the new test:

  • a_backward_permute_reads_within_the_lanes_half fails 3/3 at "64 threads, host waves of 64", with and without VICTORY_TEST_HOST_WAVE=32. Lane t reads lane t ^ 33 instead of t ^ 1.
  • With the fix in place it passes 3/3 in both modes. All 4 shapes run on the hardware device.

Lib suite on this card (--test-threads=1): the same counts as the runs above. 4eb6cfd: 303 passed. This PR: 304 passed, at the default wave and with VICTORY_TEST_HOST_WAVE=32. 0 failed and 4 ignored in every case.

Which of the title's programs this affects. I ran a whole-archive translate --validate, at the default wave and with VICTORY_HOST_WAVE=32, and compared it with 4eb6cfd:

  • 5 of 25694 emitted programs change, at both waves. All 5 are compute: CS_ComputeStickyLips and 4 shadowmask checkerboard generators (CS_GenerateShadowMasks_Checkerboard, _Checkerboard_NoHair, _RaytracedCheckerboard, CS_GenerateShadowMasksCheckerboard_SampleHairScreenSpace).
  • All 5 are console wave32 programs (emitted with WaveSize(32)). For each one, the output at the default wave is the same as at host wave 32. In a wave of 32 the added lane & 32 term is always 0, so these 5 read the same lanes as before.
  • No program changes state, and all 5 validate before and after.
  • No emitted wave64 program changes. One that used ds_bpermute_b32 would change at the default wave, so none of the emitted programs runs a wave64 backward permute. The 195 geometry programs refused before emission are not covered.
  • --pipelines over those 5 programs creates all 5 pipelines, with this PR and with 4eb6cfd, at host waves of 64 and 32.

Not tested: WARP; in game.

**@⁠adrianmjim** on GitHub · 2026-11-27 06:49 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/363#issuecomment-7211876238) Tested on an RX 7900 XT (RDNA3), driver 32.0.32029.2010, Windows 11 26300, Rust 1.98.1, release. This PR (184da29) was merged onto a-publier 4eb6cfd and compared with 4eb6cfd. Negative control on the native Windows driver. I reverted the ds_bpermute lowering change in lower.rs and kept the new test: - `a_backward_permute_reads_within_the_lanes_half` fails 3/3 at "64 threads, host waves of 64", with and without `VICTORY_TEST_HOST_WAVE=32`. Lane t reads lane t ^ 33 instead of t ^ 1. - With the fix in place it passes 3/3 in both modes. All 4 shapes run on the hardware device. Lib suite on this card (`--test-threads=1`): the same counts as the runs above. 4eb6cfd: 303 passed. This PR: 304 passed, at the default wave and with `VICTORY_TEST_HOST_WAVE=32`. 0 failed and 4 ignored in every case. Which of the title's programs this affects. I ran a whole-archive `translate --validate`, at the default wave and with `VICTORY_HOST_WAVE=32`, and compared it with 4eb6cfd: - 5 of 25694 emitted programs change, at both waves. All 5 are compute: `CS_ComputeStickyLips` and 4 shadowmask checkerboard generators (`CS_GenerateShadowMasks_Checkerboard`, `_Checkerboard_NoHair`, `_RaytracedCheckerboard`, `CS_GenerateShadowMasksCheckerboard_SampleHairScreenSpace`). - All 5 are console wave32 programs (emitted with `WaveSize(32)`). For each one, the output at the default wave is the same as at host wave 32. In a wave of 32 the added `lane & 32` term is always 0, so these 5 read the same lanes as before. - No program changes state, and all 5 validate before and after. - No emitted wave64 program changes. One that used `ds_bpermute_b32` would change at the default wave, so none of the emitted programs runs a wave64 backward permute. The 195 geometry programs refused before emission are not covered. - `--pipelines` over those 5 programs creates all 5 pipelines, with this PR and with 4eb6cfd, at host waves of 64 and 32. Not tested: WARP; in game.
Author
Owner

@⁠WellyngtonSantos on GitHub · 2026-11-27 13:08 UTC · original

Tested on a host that runs 64-lane waves only: RX 580 2048SP (Polaris / GCN4), AMD legacy driver 31.0.21925.1001, Windows 11 26200. Cross-compiled with the pinned 1.98.1 toolchain (cargo xwin test -p victory-shader --release --target x86_64-pc-windows-msvc --no-run), run from the crate directory with --test-threads=1.

victory-shader passed failed ignored
a-publier 4eb6cfd 303 0 4
this PR merged onto 4eb6cfd 304 0 4
this PR's head 184da29 alone 299 4 4
  • Merged onto current a-publier, nothing fails. The extra test is the new a_backward_permute_reads_within_the_lanes_half. On this card it runs the 64-lane host form on the hardware and matches, with 64 and with 128 threads (ran on the hardware device (threads, host wave): [(64, 64), (128, 64)]). The device refuses the 32-lane form, and the test skips it (the hardware device does not take this program; not run) instead of failing.
  • The four failures of the head alone are not from this PR. They are the WaveSize(32) pipelines a 64-lane-only device can't make: ds_min_max_f32_…, v_permlane16_and_x16_…, whole_wave_f64_sum_and_cvt_f32_f64 and partial_dispatch_with_a_cross_half_wave_op_runs_in_32_lane_waves. The branch is based on cd8dfc0, before #290 made them skip on such a host. Merging cleanly into a-publier picks that up; a rebase would make the PR's own CI show it.

So the new ds_bpermute_b32 lowering is checked on real wave64 hardware, not only on a 32-lane host.

**@⁠WellyngtonSantos** on GitHub · 2026-11-27 13:08 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/363#issuecomment-7219101413) Tested on a host that runs **64-lane waves only**: RX 580 2048SP (Polaris / GCN4), AMD legacy driver 31.0.21925.1001, Windows 11 26200. Cross-compiled with the pinned 1.98.1 toolchain (`cargo xwin test -p victory-shader --release --target x86_64-pc-windows-msvc --no-run`), run from the crate directory with `--test-threads=1`. | `victory-shader` | passed | failed | ignored | |---|---|---|---| | `a-publier` `4eb6cfd` | 303 | 0 | 4 | | this PR merged onto `4eb6cfd` | **304** | **0** | 4 | | this PR's head `184da29` alone | 299 | 4 | 4 | - **Merged onto current `a-publier`, nothing fails.** The extra test is the new `a_backward_permute_reads_within_the_lanes_half`. On this card it runs the 64-lane host form on the hardware and matches, with 64 and with 128 threads (`ran on the hardware device (threads, host wave): [(64, 64), (128, 64)]`). The device refuses the 32-lane form, and the test skips it (`the hardware device does not take this program; not run`) instead of failing. - **The four failures of the head alone are not from this PR.** They are the `WaveSize(32)` pipelines a 64-lane-only device can't make: `ds_min_max_f32_…`, `v_permlane16_and_x16_…`, `whole_wave_f64_sum_and_cvt_f32_f64` and `partial_dispatch_with_a_cross_half_wave_op_runs_in_32_lane_waves`. The branch is based on `cd8dfc0`, before #290 made them skip on such a host. Merging cleanly into `a-publier` picks that up; a rebase would make the PR's own CI show it. So the new `ds_bpermute_b32` lowering is checked on real wave64 hardware, not only on a 32-lane host.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/363/head:github-bot/gh-363'
git switch 'github-bot/gh-363'

Merge

Merge the changes and update on Forgejo.
git switch 'a-publier'
git merge --no-ff 'github-bot/gh-363'
git switch 'github-bot/gh-363'
git rebase 'a-publier'
git switch 'a-publier'
git merge --ff-only 'github-bot/gh-363'
git switch 'github-bot/gh-363'
git rebase 'a-publier'
git switch 'a-publier'
git merge --no-ff 'github-bot/gh-363'
git switch 'a-publier'
git merge --squash 'github-bot/gh-363'
git switch 'a-publier'
git merge --ff-only 'github-bot/gh-363'
git switch 'a-publier'
git merge 'github-bot/gh-363'
git push origin 'a-publier'
This discussion has been locked. Commenting is limited to contributors.
No description provided.