Shaders: wrap lane selectors at the guest wave width #298

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

@⁠avt0m4t48 on GitHub · 2026-11-24 23:25 UTC · original
avt0m4t48:fix/shader-wrap-lane-selectors → main · +182 −11 · 5 files · 1 commits · open

RDNA 2 v_readlane_b32 and v_writelane_b32 select a lane modulo the guest wave width. Normalize the guest selector before the native lane operations or the split-wave LDS exchange. In wave32, selectors 3 and 35 also identify the same spill slot and the same descriptor origin. AMD RDNA 2 ISA, section 12.12

The related upstream proposal is VIctory #1312. This patch applies the width rule to this fork's split-wave execution and scalar spill lowering. The EXEC participation problem is tracked separately in #111.

Verification

  • Three source-built regressions failed on 2119b0e and pass here. They cover native and split-wave lowering, a wrapped spill overwriting the same slot, and a wrapped descriptor read finding the latest store.
  • Forcing the emitter to use a 32-lane mask made the split-wave upper-half regression fail.
  • cargo test --locked -p victory-shader --lib on Linux reported 173 passed, two ignored. cargo check --locked --target x86_64-pc-windows-msvc -p victory-shader --tests passed.
  • Microsoft DXIL validation passed for ten synthetic variants. Disassembly showed the expected dynamic selector masks for wave32 on wave32, wave64 on wave64, and wave64 split across wave32.

Native GPU readback and application behavior were outside this run.

**@⁠avt0m4t48** on GitHub · 2026-11-24 23:25 UTC · [original](https://github.com/fxceless/victory-fork/pull/298) `avt0m4t48:fix/shader-wrap-lane-selectors` → `main` · +182 −11 · 5 files · 1 commits · open RDNA 2 `v_readlane_b32` and `v_writelane_b32` select a lane modulo the guest wave width. Normalize the guest selector before the native lane operations or the split-wave LDS exchange. In wave32, selectors 3 and 35 also identify the same spill slot and the same descriptor origin. [AMD RDNA 2 ISA, section 12.12](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf) The related upstream proposal is [VIctory #1312](https://github.com/Marvisak/VIctory/pull/1312). This patch applies the width rule to this fork's split-wave execution and scalar spill lowering. The EXEC participation problem is tracked separately in #111. ## Verification - Three source-built regressions failed on `2119b0e` and pass here. They cover native and split-wave lowering, a wrapped spill overwriting the same slot, and a wrapped descriptor read finding the latest store. - Forcing the emitter to use a 32-lane mask made the split-wave upper-half regression fail. - `cargo test --locked -p victory-shader --lib` on Linux reported 173 passed, two ignored. `cargo check --locked --target x86_64-pc-windows-msvc -p victory-shader --tests` passed. - Microsoft DXIL validation passed for ten synthetic variants. Disassembly showed the expected dynamic selector masks for wave32 on wave32, wave64 on wave64, and wave64 split across wave32. Native GPU readback and application behavior were outside this run.
RDNA 2 V_READLANE_B32 and V_WRITELANE_B32 use the low five or six bits of the selector. Normalize before native or split-wave positioning and use the same index for scalar spill slots and descriptor tracing.

See AMD RDNA 2 ISA section 12.12 opcodes 864 and 865, and Marvisak/VIctory#1312 for the upstream lane lowering proposal.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:40:13 +00:00
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/298/head:github-bot/gh-298'
git switch 'github-bot/gh-298'

Merge

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