lower: lower v_permlanex16_b32 to waveReadLaneAt #1134

Closed
github-bot wants to merge 1 commit from gh-pr/1134/head into gh-pr/1134/base
Owner

@⁠bitzin-dev on GitHub · 2026-11-24 16:06 UTC · original
bitzin-dev:shader/v-permlanex16-b32 → main · +36 −0 · 1 files · 1 commits · closed without merging

Implements lowering for RDNA2 VOP3 opcode v_permlanex16_b32 (Vector Permute Lane Extended 16, 32-bit).

Background

In RDNA2, v_permlanex16_b32 gathers across adjacent 16-lane rows (row 0 <-> row 1, row 2 <-> row 3) using a 64-bit selector composed of scalar operands {s2, s1}. For each 16-lane row, lane i (0..15) extracts 4-bit nibble i:

  • Lanes 0..7 index nibbles 0..7 of s1
  • Lanes 8..15 index nibbles 0..7 of s2

The target lane within the alternate row is alt_row | pick, where alt_row = (lane & !31) | ((lane & 16) ^ 16) and pick = (sel_word >> ((lane & 7) * 4)) & 15. The value is then read via waveReadLaneAt.i32.

Validation

  • Validated on full retail shader pack (victory translate --validate "D:\GTA 6\shaders.rpf"):
    • Resolves rejection of deferred_tiled:CS_WaterTransmittanceOpticalDepthProcessing_44443e79_Wrapped Cs (at 0xd00).
    • Emitted compute programs validated by dxil.dll increased from 1,417 to 1,418 (+1).
    • 0 invalid bitcode errors remaining.
  • All 120 unit tests pass (cargo test -p victory-shader).
  • cargo xtask policy passes cleanly.
**@⁠bitzin-dev** on GitHub · 2026-11-24 16:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/1134) `bitzin-dev:shader/v-permlanex16-b32` → `main` · +36 −0 · 1 files · 1 commits · closed without merging Implements lowering for RDNA2 VOP3 opcode `v_permlanex16_b32` (Vector Permute Lane Extended 16, 32-bit). ### Background In RDNA2, `v_permlanex16_b32` gathers across adjacent 16-lane rows (row 0 <-> row 1, row 2 <-> row 3) using a 64-bit selector composed of scalar operands `{s2, s1}`. For each 16-lane row, lane `i` (0..15) extracts 4-bit nibble `i`: - Lanes 0..7 index nibbles 0..7 of `s1` - Lanes 8..15 index nibbles 0..7 of `s2` The target lane within the alternate row is `alt_row | pick`, where `alt_row = (lane & !31) | ((lane & 16) ^ 16)` and `pick = (sel_word >> ((lane & 7) * 4)) & 15`. The value is then read via `waveReadLaneAt.i32`. ### Validation - Validated on full retail shader pack (`victory translate --validate "D:\GTA 6\shaders.rpf"`): - Resolves rejection of `deferred_tiled:CS_WaterTransmittanceOpticalDepthProcessing_44443e79_Wrapped Cs` (at `0xd00`). - Emitted compute programs validated by `dxil.dll` increased from 1,417 to 1,418 (+1). - 0 invalid bitcode errors remaining. - All 120 unit tests pass (`cargo test -p victory-shader`). - `cargo xtask policy` passes cleanly.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:20:49 +00:00
github-bot closed this pull request 2026-11-26 04:20:49 +00:00
Author
Owner

@⁠bitzin-dev on GitHub · 2026-11-24 16:31 UTC · original

Thanks for pointing that out, @⁠catminou4! Didn't catch that #1014 was opened just about an hour before. It definitely makes sense to close this in favor of #1014 since it handles both v_permlane16_b32 and v_permlanex16_b32 together with the cross-lane guard list check. Closing!

**@⁠bitzin-dev** on GitHub · 2026-11-24 16:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/1134#issuecomment-7137795899) Thanks for pointing that out, @⁠catminou4! Didn't catch that #1014 was opened just about an hour before. It definitely makes sense to close this in favor of #1014 since it handles both `v_permlane16_b32` and `v_permlanex16_b32` together with the cross-lane guard list check. Closing!

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1134
No description provided.