Shaders: lower row permutations on wave32 hosts #40

Open
github-bot wants to merge 2 commits from github-bot/gh-40 into main AGit
Owner

@⁠jaschinski97-ops on GitHub · 2026-11-24 20:48 UTC · original
jaschinski97-ops:fix/permlane-compute → main · +504 −0 · 3 files · 2 commits · open

The translator rejects ordinary v_permlane16_b32 and v_permlanex16_b32 instructions outside recognized whole-wave reduction patterns. v_permlanex16_b32 is among the outstanding translation failures reported in #26 and the RTX 3080 report in #22.

This change lowers both instructions to DXIL row selection and lane reads, including both runtime selector words, EXEC, fetch-inactive, bound-control and aliased source/destination registers. It also marks the instructions as requiring console lane layout, allowing the existing Wave64-on-Wave32 path to handle their 32-lane-local permutations. Fetch-inactive inside a divergent host branch remains explicitly unsupported because the absent invocations' last VGPR values are unavailable. Cross-lane use outside compute retains its existing rejection.

Validation on Windows 11 / NVIDIA RTX 3080 (driver 32.0.16.2140), Rust 1.98.1, Windows GNU target with a local LLVM/MinGW linker:

  • Synthetic hardware test: 800 dispatches, 102,400 lane results checked across Wave32 and Wave64-on-Wave32, both instructions, all FI/BC combinations, aliasing, five selector patterns and five EXEC masks. Emitted containers pass the available DXIL validator.
  • Regression test checks rejection of FI inside a divergent host branch.
  • cargo test --locked -p victory-shader --lib -- --test-threads=1: 212 passed, 0 failed, 2 existing ignored tests.
  • cargo clippy --locked -p victory-shader --all-targets --features diagnostics,host -- -D warnings: clean.
  • cargo xtask policy: 170 files OK. git diff --check: clean.
  • The local WARP device reports 4..4 lanes; the new row-permutation execution tests skip it based on its advertised capabilities.
  • Local integration with #52: 217 shader tests passed, 0 failed, 2 existing ignored; Clippy with diagnostics,host and -D warnings and the asset policy pass. The two changes combine without conflicts.

No title data or shader dumps are included. No gameplay, performance or native Wave64-device validation was performed; this addresses a translation gap rather than demonstrating that the title is playable. Instruction semantics follow AMD's RDNA 2 ISA, section 12.12: https://docs.amd.com/v/u/en-US/rdna2-shader-instruction-set-architecture

AI-assisted contribution with Codex; code and synthetic hardware tests run locally.

Additional independent review found that per-lane loop-limit returns can bypass later reconvergence. Commit 39f1717 adds a dedicated FI participation analysis including those synthetic return edges, leaving the existing LDS/split-wave analysis unchanged. The new loop-abort case fails before the correction and passes afterwards; all four control-flow regression tests and shader Clippy (all targets/all features, warnings denied) pass. The GPU matrix reported above was run for the original change. No game test is claimed.

**@⁠jaschinski97-ops** on GitHub · 2026-11-24 20:48 UTC · [original](https://github.com/fxceless/victory-fork/pull/40) `jaschinski97-ops:fix/permlane-compute` → `main` · +504 −0 · 3 files · 2 commits · open The translator rejects ordinary `v_permlane16_b32` and `v_permlanex16_b32` instructions outside recognized whole-wave reduction patterns. `v_permlanex16_b32` is among the outstanding translation failures reported in #26 and the RTX 3080 report in #22. This change lowers both instructions to DXIL row selection and lane reads, including both runtime selector words, EXEC, fetch-inactive, bound-control and aliased source/destination registers. It also marks the instructions as requiring console lane layout, allowing the existing Wave64-on-Wave32 path to handle their 32-lane-local permutations. Fetch-inactive inside a divergent host branch remains explicitly unsupported because the absent invocations' last VGPR values are unavailable. Cross-lane use outside compute retains its existing rejection. Validation on Windows 11 / NVIDIA RTX 3080 (driver 32.0.16.2140), Rust 1.98.1, Windows GNU target with a local LLVM/MinGW linker: - Synthetic hardware test: 800 dispatches, 102,400 lane results checked across Wave32 and Wave64-on-Wave32, both instructions, all FI/BC combinations, aliasing, five selector patterns and five EXEC masks. Emitted containers pass the available DXIL validator. - Regression test checks rejection of FI inside a divergent host branch. - `cargo test --locked -p victory-shader --lib -- --test-threads=1`: 212 passed, 0 failed, 2 existing ignored tests. - `cargo clippy --locked -p victory-shader --all-targets --features diagnostics,host -- -D warnings`: clean. - `cargo xtask policy`: 170 files OK. `git diff --check`: clean. - The local WARP device reports 4..4 lanes; the new row-permutation execution tests skip it based on its advertised capabilities. - Local integration with #52: 217 shader tests passed, 0 failed, 2 existing ignored; Clippy with `diagnostics,host` and `-D warnings` and the asset policy pass. The two changes combine without conflicts. No title data or shader dumps are included. No gameplay, performance or native Wave64-device validation was performed; this addresses a translation gap rather than demonstrating that the title is playable. Instruction semantics follow AMD's RDNA 2 ISA, section 12.12: https://docs.amd.com/v/u/en-US/rdna2-shader-instruction-set-architecture AI-assisted contribution with Codex; code and synthetic hardware tests run locally. Additional independent review found that per-lane loop-limit returns can bypass later reconvergence. Commit 39f1717 adds a dedicated FI participation analysis including those synthetic return edges, leaving the existing LDS/split-wave analysis unchanged. The new loop-abort case fails before the correction and passes afterwards; all four control-flow regression tests and shader Clippy (all targets/all features, warnings denied) pass. The GPU matrix reported above was run for the original change. No game test is claimed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:35:02 +00:00
Author
Owner

@⁠rostaddotcc on GitHub · 2026-11-24 21:20 UTC · original

Verified at 4d3aaab on a Linux host (CachyOS, x86-64):

  • cargo test -p victory-shader — 171 passed, 0 failed, 2 ignored.
  • cargo test -p victory-pipeline — 4 passed.
  • cargo xtask policy — 169 files ok.
  • cargo xwin build --release -p victory --target x86_64-pc-windows-msvc — clean.

But the two new tests did not run. crates/victory-shader/src/emit/mod.rs:94 registers mod permlane_tests; under #[cfg(all(test, windows))], and the module imports super::validator, which is itself #[cfg(windows)]. The test list on this host is 173 entries both before and after the patch, so nothing from permlane_tests.rs executed here — the build is all a Linux machine can add for this PR.

That gate looks stricter than the code needs. permlane_tests.rs:110-116 already tolerates a missing validator:

match validator::Validator::load(validator::Validator::default_path().as_deref()) {
    ...
    Err(e) => eprintln!("DXIL validator unavailable: {e}"),
}

so the lowering assertions would run on any platform; only the validation step needs dxil.dll. If the validator import were #[cfg(windows)] with a no-op shim elsewhere, mod permlane_tests; could be #[cfg(test)] and these two tests would run in a Linux CI — which is the only place a wave32 lowering change can be tested without a 32-lane GPU.

Since I cannot run them: is the row-permutation rewrite exercised by anything that does run off Windows, e.g. a translate case that checks the emitted container bytes? If not, the "fixes #26/#22" claim rests on a test that only Windows CI can see.

**@⁠rostaddotcc** on GitHub · 2026-11-24 21:20 UTC · [original](https://github.com/fxceless/victory-fork/pull/40#issuecomment-7144800274) Verified at `4d3aaab` on a Linux host (CachyOS, x86-64): - `cargo test -p victory-shader` — 171 passed, 0 failed, 2 ignored. - `cargo test -p victory-pipeline` — 4 passed. - `cargo xtask policy` — 169 files ok. - `cargo xwin build --release -p victory --target x86_64-pc-windows-msvc` — clean. **But the two new tests did not run.** `crates/victory-shader/src/emit/mod.rs:94` registers `mod permlane_tests;` under `#[cfg(all(test, windows))]`, and the module imports `super::validator`, which is itself `#[cfg(windows)]`. The test list on this host is 173 entries both before and after the patch, so nothing from `permlane_tests.rs` executed here — the build is all a Linux machine can add for this PR. That gate looks stricter than the code needs. `permlane_tests.rs:110-116` already tolerates a missing validator: ```rust match validator::Validator::load(validator::Validator::default_path().as_deref()) { ... Err(e) => eprintln!("DXIL validator unavailable: {e}"), } ``` so the lowering assertions would run on any platform; only the validation step needs `dxil.dll`. If the `validator` import were `#[cfg(windows)]` with a no-op shim elsewhere, `mod permlane_tests;` could be `#[cfg(test)]` and these two tests would run in a Linux CI — which is the only place a wave32 lowering change can be tested without a 32-lane GPU. Since I cannot run them: is the row-permutation rewrite exercised by anything that does run off Windows, e.g. a `translate` case that checks the emitted container bytes? If not, the "fixes #26/#22" claim rests on a test that only Windows CI can see.
Author
Owner

@⁠adriaespii on GitHub · 2026-11-24 21:23 UTC · original

Independent test run on commit 4d3aaab (AMD RDNA4):

  • Hardware: AMD Radeon RX 9070 (driver 32.0.32015.7029), AMD Ryzen 5 7600, Windows 11 Pro, Rust 1.98.1 (x86_64-pc-windows-msvc)
  • cargo clippy --workspace --all-targets -- -D warnings: 0 warnings
  • cargo test --workspace: 498 passed, 0 failed, 7 ignored (victory-shader: 212 passed, 0 failed, 2 ignored; victory-gpu: 110 passed, 0 failed, 1 ignored)
  • Not tested: live game run (no game files on this machine)

AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.

**@⁠adriaespii** on GitHub · 2026-11-24 21:23 UTC · [original](https://github.com/fxceless/victory-fork/pull/40#issuecomment-7144859938) Independent test run on commit `4d3aaab` (AMD RDNA4): - **Hardware:** AMD Radeon RX 9070 (driver 32.0.32015.7029), AMD Ryzen 5 7600, Windows 11 Pro, Rust 1.98.1 (`x86_64-pc-windows-msvc`) - `cargo clippy --workspace --all-targets -- -D warnings`: 0 warnings - `cargo test --workspace`: 498 passed, 0 failed, 7 ignored (`victory-shader`: 212 passed, 0 failed, 2 ignored; `victory-gpu`: 110 passed, 0 failed, 1 ignored) - **Not tested:** live game run (no game files on this machine) *AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.*
Author
Owner

@⁠arminkhaleghirod on GitHub · 2026-11-24 21:23 UTC · original

Ran victory translate --validate over the full title on an RTX 4080 (Windows 11), main 90228a7 vs this PR. All 26,148 programs on both.

The only change is the one v_permlanex16_b32 failure, which is gone. Every other failure reason has the same count, and nothing new appears. Total failure lines: 17,907 → 17,906.

**@⁠arminkhaleghirod** on GitHub · 2026-11-24 21:23 UTC · [original](https://github.com/fxceless/victory-fork/pull/40#issuecomment-7144868312) Ran `victory translate --validate` over the full title on an RTX 4080 (Windows 11), main 90228a7 vs this PR. All 26,148 programs on both. The only change is the one `v_permlanex16_b32` failure, which is gone. Every other failure reason has the same count, and nothing new appears. Total failure lines: 17,907 → 17,906.
Author
Owner

@⁠Mesrine67 on GitHub · 2026-11-24 22:00 UTC · original

Independent targeted run on the current PR head 39f1717a9366295726b105a5900269bad33ba3b7:

  • Hardware: AMD Radeon RX 6750 XT (RDNA2), driver 32.0.21045.29003; Windows x86_64-pc-windows-msvc; Rust 1.98.1.
  • Command: cargo test --locked --offline -p victory-shader --lib permlane_ -- --nocapture --test-threads=1
  • Result: 5 passed, 0 failed. The four fetch-inactive control-flow cases all passed, including reconvergence, uniform branch, lane-local loop abort, and rejection outside the host branch.
  • The synthetic row/EXEC matrix ran on the hardware adapter: D3D12 reported wave lanes 32..64, and the test printed all row and EXEC cases passed on hardware. The 4-lane WARP adapter was skipped by the test's capability guard.

This validates the translator's synthetic cases on RDNA2; it does not test the game or establish gameplay/performance.

**@⁠Mesrine67** on GitHub · 2026-11-24 22:00 UTC · [original](https://github.com/fxceless/victory-fork/pull/40#issuecomment-7145686619) Independent targeted run on the current PR head `39f1717a9366295726b105a5900269bad33ba3b7`: - **Hardware:** AMD Radeon RX 6750 XT (RDNA2), driver 32.0.21045.29003; Windows x86_64-pc-windows-msvc; Rust 1.98.1. - **Command:** `cargo test --locked --offline -p victory-shader --lib permlane_ -- --nocapture --test-threads=1` - **Result:** 5 passed, 0 failed. The four fetch-inactive control-flow cases all passed, including reconvergence, uniform branch, lane-local loop abort, and rejection outside the host branch. - The synthetic row/EXEC matrix ran on the hardware adapter: D3D12 reported wave lanes `32..64`, and the test printed `all row and EXEC cases passed on hardware`. The 4-lane WARP adapter was skipped by the test's capability guard. This validates the translator's synthetic cases on RDNA2; it does not test the game or establish gameplay/performance.
Author
Owner

@⁠Mesrine67 on GitHub · 2026-11-24 22:12 UTC · original

Integration test against the latest fork main fetched for this review.

  • PR head: 39f1717a93
  • Fetched origin/main: 2119b0e44c. The PR API still reports base 4e17478b9c, so I tested the combined tree locally rather than changing the author's branch.
  • Merge result: clean, no conflicts; integrated tree 8be816e96c52ee50b36d4e82bcea43276ce7efea.
  • Hardware: AMD Radeon RX 6750 XT, driver 32.0.21045.29003; Rust 1.98.1; Windows x86_64 MSVC.
  • Full crate: cargo test --locked --offline -p victory-shader --lib -- --test-threads=1 — 215 passed, 0 failed, 2 ignored.
  • Wave32 follow-up on the same integrated tree: 5 passed, 0 failed; hardware reported wave lanes 32..64, and all row/EXEC cases passed. WARP reports 4..4 and skips the two-row GPU checks as expected.

Full sanitized log: https://gist.github.com/Mesrine67/4b0a982a3a078aaad1a8d0a45695b892

No game executable was launched; these are shader/runtime tests only. The PR branch and fork main were not modified or pushed.

**@⁠Mesrine67** on GitHub · 2026-11-24 22:12 UTC · [original](https://github.com/fxceless/victory-fork/pull/40#issuecomment-7145939491) Integration test against the latest fork main fetched for this review. - PR head: 39f1717a9366295726b105a5900269bad33ba3b7 - Fetched origin/main: 2119b0e44c53aa9648307b0c5c73590290305b1f. The PR API still reports base 4e17478b9c27bb530643e5b0e16a767cf4419e08, so I tested the combined tree locally rather than changing the author's branch. - Merge result: clean, no conflicts; integrated tree 8be816e96c52ee50b36d4e82bcea43276ce7efea. - Hardware: AMD Radeon RX 6750 XT, driver 32.0.21045.29003; Rust 1.98.1; Windows x86_64 MSVC. - Full crate: cargo test --locked --offline -p victory-shader --lib -- --test-threads=1 — **215 passed, 0 failed, 2 ignored**. - Wave32 follow-up on the same integrated tree: **5 passed, 0 failed**; hardware reported wave lanes 32..64, and all row/EXEC cases passed. WARP reports 4..4 and skips the two-row GPU checks as expected. Full sanitized log: https://gist.github.com/Mesrine67/4b0a982a3a078aaad1a8d0a45695b892 No game executable was launched; these are shader/runtime tests only. The PR branch and fork main were not modified or pushed.
Author
Owner

@⁠Mesrine67 on GitHub · 2026-11-24 23:39 UTC · original

Fresh local rerun on 2026-11-25 at PR head 39f1717a9366295726b105a5900269bad33ba3b7:

  • Hardware/toolchain: AMD Radeon RX 6750 XT (driver 32.0.21045.29003), Windows x86_64 MSVC, Rust 1.100.0.
  • cargo test --locked --offline -p victory-shader --lib permlane_ -- --nocapture --test-threads=1: 5 passed, 0 failed. The hardware adapter reported wave lanes 32..64 and passed the row/EXEC matrix; WARP reported 4..4 and skipped the two-row GPU checks as expected.
  • cargo test --locked --offline -p victory-shader --lib -- --test-threads=1: 215 passed, 0 failed, 2 ignored.
  • cargo clippy --locked --offline -p victory-shader --all-targets --features diagnostics,host -- -D warnings: clean.
  • cargo xtask policy: 170 files OK.

These are translator and synthetic GPU tests only; no game executable was launched and no gameplay or performance result is claimed.

**@⁠Mesrine67** on GitHub · 2026-11-24 23:39 UTC · [original](https://github.com/fxceless/victory-fork/pull/40#issuecomment-7147648969) Fresh local rerun on 2026-11-25 at PR head `39f1717a9366295726b105a5900269bad33ba3b7`: - **Hardware/toolchain:** AMD Radeon RX 6750 XT (driver 32.0.21045.29003), Windows x86_64 MSVC, Rust 1.100.0. - `cargo test --locked --offline -p victory-shader --lib permlane_ -- --nocapture --test-threads=1`: **5 passed, 0 failed**. The hardware adapter reported wave lanes `32..64` and passed the row/EXEC matrix; WARP reported `4..4` and skipped the two-row GPU checks as expected. - `cargo test --locked --offline -p victory-shader --lib -- --test-threads=1`: **215 passed, 0 failed, 2 ignored**. - `cargo clippy --locked --offline -p victory-shader --all-targets --features diagnostics,host -- -D warnings`: clean. - `cargo xtask policy`: **170 files OK**. These are translator and synthetic GPU tests only; no game executable was launched and no gameplay or performance result is claimed.
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/40/head:github-bot/gh-40'
git switch 'github-bot/gh-40'

Merge

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