Native wave64 compute shaders declare WaveSize(64) where the host runs 64 lanes #204

Open
github-bot wants to merge 1 commit from github-bot/gh-204 into main AGit
Owner

@⁠TobiasFornell on GitHub · 2026-11-25 21:55 UTC · original
TobiasFornell:wave64-native-compute → main · +88 −14 · 5 files · 1 commits · open

lower.rs gives a compute shader a wave size only with console lanes or a one-wave LDS shader. The other native-wave64 compute shaders reach the driver without WaveSize, and RDNA drivers (RADV here) run them as wave32. With this change they declare WaveSize(64) when the host runs 64 lanes. VICTORY_FORCE_WAVE64=0 turns it off; the switch is part of the shader cache key. Diagnostics builds count the compute shaders that declare 64 lanes.

Measured on Linux only (CachyOS, RX 9070 XT, RADV through vkd3d-proton, Proton Experimental), on a Belobug-based tree: 495 compute shaders declare 64 lanes, 319 of them through this change, and no pipeline was refused. The GPU time was not measured (the CPU side dominates the frame there), so this is not shown to be faster; it gives the shaders the lane count they were written for. Not run on Windows.

The branch is one commit on current main; it builds, and clippy finds nothing new in the changed lines.

**@⁠TobiasFornell** on GitHub · 2026-11-25 21:55 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/204) `TobiasFornell:wave64-native-compute` → `main` · +88 −14 · 5 files · 1 commits · open `lower.rs` gives a compute shader a wave size only with console lanes or a one-wave LDS shader. The other native-wave64 compute shaders reach the driver without `WaveSize`, and RDNA drivers (RADV here) run them as wave32. With this change they declare `WaveSize(64)` when the host runs 64 lanes. `VICTORY_FORCE_WAVE64=0` turns it off; the switch is part of the shader cache key. Diagnostics builds count the compute shaders that declare 64 lanes. Measured on Linux only (CachyOS, RX 9070 XT, RADV through vkd3d-proton, Proton Experimental), on a Belobug-based tree: 495 compute shaders declare 64 lanes, 319 of them through this change, and no pipeline was refused. The GPU time was not measured (the CPU side dominates the frame there), so this is not shown to be faster; it gives the shaders the lane count they were written for. Not run on Windows. The branch is one commit on current `main`; it builds, and clippy finds nothing new in the changed lines.
lower.rs gave compute shaders a wave size only with console lanes or a
one-wave LDS shader, so the other native-wave64 compute shaders reached the
driver without WaveSize and ran as wave32 on RDNA (RADV picks wave32 by
default). They now declare WaveSize(64) when the host runs 64 lanes;
VICTORY_FORCE_WAVE64=0 turns it off. The switch is part of the shader cache
key. Diagnostics builds count compute shaders with WaveSize(64).

Linux (Proton Experimental, RADV), RX 9070 XT: 495 compute shaders declare
64 lanes, 319 of them through this change; no pipeline refused. The GPU time
was not measured.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:37:55 +00:00
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-26 00:05 UTC · original

Result on Windows and RDNA2, which the description does not cover: an RX 6950 XT, Windows 11 build 26300, Rust 1.98.1. This PR (bb789c5) merged on main 4f62c2a, cargo test --release -p victory-shader --lib, one run each:

  • main: 275 passed, 2 failed: emit::valu_tests::scalar_counted_in_a_divergent_loop_read_after_it and scalar_counted_in_nested_divergent_loops. These are the wave-size failures of #2; they fail on every run here.
  • With this PR: 277 passed, 0 failed.

victory-gpu and victory-hle tests are the same as on main. For the maintainers: this PR and #144 both change crates/victory-shader/src/emit/mod.rs, and the merge has a conflict there. #110 fixes the same two tests here (278 passed) and merges with #144 cleanly. Not run in the game.

harness machine: rx6950xt-w11 | AMD Radeon RX 6950 XT (RDNA2), driver 32.0.21045.29003 | 32 GB RAM | Windows 11 build 26300

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

**@⁠MamaLeVrai** on GitHub · 2026-11-26 00:05 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/204#issuecomment-7178383141) Result on Windows and RDNA2, which the description does not cover: an RX 6950 XT, Windows 11 build 26300, Rust 1.98.1. This PR (`bb789c5`) merged on `main` `4f62c2a`, `cargo test --release -p victory-shader --lib`, one run each: - `main`: 275 passed, **2 failed**: `emit::valu_tests::scalar_counted_in_a_divergent_loop_read_after_it` and `scalar_counted_in_nested_divergent_loops`. These are the wave-size failures of #2; they fail on every run here. - With this PR: **277 passed, 0 failed**. `victory-gpu` and `victory-hle` tests are the same as on `main`. For the maintainers: this PR and #144 both change `crates/victory-shader/src/emit/mod.rs`, and the merge has a conflict there. #110 fixes the same two tests here (278 passed) and merges with #144 cleanly. Not run in the game. harness machine: rx6950xt-w11 | AMD Radeon RX 6950 XT (RDNA2), driver 32.0.21045.29003 | 32 GB RAM | Windows 11 build 26300 AI-assisted (Claude Code); no game data.
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-26 19:49 UTC · original

Tested on Windows 11 (26300) with an RX 7900 XT (RDNA3, driver 32.0.32029.2010). Head bb789c5, base 4f62c2a. I ran the whole title shaders.rpf through victory translate --validate --list and compared per-program DXIL hashes against 4f62c2a.

Host lanes 32-64 (RDNA):

  • 747 of 2682 compute programs change. No vertex, pixel or mesh program changes.
  • Each of the 747 goes from no wave size to WaveSize(64). In dxc -dumpbin that is the only difference in all 747. Each one is 8 to 28 bytes bigger.
  • Compute programs that declare 64 lanes go from 404 to 1151. The 898 that declare 32 lanes do not change.
  • IR instruction total, refusals and validation are the same as 4f62c2a. Every emitted program validates.
  • With --pipelines, the RX 7900 XT creates all 2682 compute pipelines on both base and PR. Nothing is refused.
  • With VICTORY_FORCE_WAVE64=0, the output is identical to 4f62c2a.

Other host lane ranges:

  • 64-64: the same 747 compute programs change, with the same refusals as 4f62c2a.
  • 32-32: no program changes.

Tests:

  • cargo test -p victory-shader --lib -- --test-threads=1: 277 passed, 0 failed, 6 ignored. 4f62c2a gives the same counts.
  • I applied the emit/mod.rs part (helpers and test) to 4f62c2a without the lower.rs change. programs_reading_no_other_lanes_translate_for_any_wave_size then fails on the Some(64) assertion. With the lower.rs change it passes.

One small thing: the counters in pipeline.rs and the log line in queue.rs are only behind cfg(windows), not the diagnostics feature. So every Windows build counts them, not only diagnostics builds as the description says. The line is also logged only once, at frame 256, so compute shaders translated after that are not in the number.

Not tested: GPU time or an in-game run on Windows. I also did not check which wave size the Windows driver picks for compute shaders without WaveSize.

**@⁠adrianmjim** on GitHub · 2026-11-26 19:49 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/204#issuecomment-7201991220) Tested on Windows 11 (26300) with an RX 7900 XT (RDNA3, driver 32.0.32029.2010). Head bb789c5, base 4f62c2a. I ran the whole title shaders.rpf through `victory translate --validate --list` and compared per-program DXIL hashes against 4f62c2a. Host lanes 32-64 (RDNA): - 747 of 2682 compute programs change. No vertex, pixel or mesh program changes. - Each of the 747 goes from no wave size to `WaveSize(64)`. In `dxc -dumpbin` that is the only difference in all 747. Each one is 8 to 28 bytes bigger. - Compute programs that declare 64 lanes go from 404 to 1151. The 898 that declare 32 lanes do not change. - IR instruction total, refusals and validation are the same as 4f62c2a. Every emitted program validates. - With `--pipelines`, the RX 7900 XT creates all 2682 compute pipelines on both base and PR. Nothing is refused. - With `VICTORY_FORCE_WAVE64=0`, the output is identical to 4f62c2a. Other host lane ranges: - 64-64: the same 747 compute programs change, with the same refusals as 4f62c2a. - 32-32: no program changes. Tests: - `cargo test -p victory-shader --lib -- --test-threads=1`: 277 passed, 0 failed, 6 ignored. 4f62c2a gives the same counts. - I applied the `emit/mod.rs` part (helpers and test) to 4f62c2a without the `lower.rs` change. `programs_reading_no_other_lanes_translate_for_any_wave_size` then fails on the `Some(64)` assertion. With the `lower.rs` change it passes. One small thing: the counters in `pipeline.rs` and the log line in `queue.rs` are only behind `cfg(windows)`, not the `diagnostics` feature. So every Windows build counts them, not only diagnostics builds as the description says. The line is also logged only once, at frame 256, so compute shaders translated after that are not in the number. Not tested: GPU time or an in-game run on Windows. I also did not check which wave size the Windows driver picks for compute shaders without `WaveSize`.
Author
Owner

@⁠WellyngtonSantos on GitHub · 2026-11-26 19:54 UTC · original

A data point from a host that runs 64-lane waves only: RX 580 (Polaris / GCN4), AMD legacy driver 31.0.21925.1001 (waves of 64 to 64), Windows 11, Rust 1.98.1, cross-compiled victory-shader tests, --test-threads=1.

passed failed ignored
base 4f62c2a (main) 266 11 6
this PR bb789c5 266 11 6

The list of failing tests is identical: no regression, and nothing fixed on this card either. For whoever looks at main on such hosts, the 11 are:

  • 9 memory_tests, with create memory PSO: "Parâmetro incorreto." (E_INVALIDARG);
  • image_tests::texel_offsets_and_levels_sample_the_texels_they_name, E_INVALIDARG at the PSO;
  • lane_read_loop_tests::lane_reads_in_a_loop_lanes_leave_at_different_iterations, with Unsupported { what: "a console wave size the host does not run" }.

None of them fail on the default branch rx9070xt (cd8dfc0) on the same card, where the whole suite is 302/0 with #290. So they look already handled there.

**@⁠WellyngtonSantos** on GitHub · 2026-11-26 19:54 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/204#issuecomment-7202086534) A data point from a host that runs **64-lane waves only**: **RX 580 (Polaris / GCN4), AMD legacy driver 31.0.21925.1001** (waves of 64 to 64), Windows 11, Rust 1.98.1, cross-compiled `victory-shader` tests, `--test-threads=1`. | | passed | failed | ignored | |---|---|---|---| | base `4f62c2a` (main) | 266 | 11 | 6 | | this PR `bb789c5` | 266 | 11 | 6 | The list of failing tests is identical: no regression, and nothing fixed on this card either. For whoever looks at main on such hosts, the 11 are: - 9 `memory_tests`, with `create memory PSO: "Parâmetro incorreto."` (E_INVALIDARG); - `image_tests::texel_offsets_and_levels_sample_the_texels_they_name`, E_INVALIDARG at the PSO; - `lane_read_loop_tests::lane_reads_in_a_loop_lanes_leave_at_different_iterations`, with `Unsupported { what: "a console wave size the host does not run" }`. None of them fail on the default branch `rx9070xt` (`cd8dfc0`) on the same card, where the whole suite is 302/0 with #290. So they look already handled there.
This pull request can be merged automatically.
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/204/head:github-bot/gh-204'
git switch 'github-bot/gh-204'

Merge

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