Shaders: lower v_permlane16_b32 and v_permlanex16_b32 with EXEC/FI/BC #124

Open
VastyViz wants to merge 1 commit from upstream-pr/124 into main
VastyViz commented 2026-11-25 14:10:58 +00:00 (Migrated from github.com)
First-time contributor

Imported from Zettrox/ztrx. Originally posted by VastyViz on 2026-11-25T13:13:06Z.


Lower v_permlane16_b32 and v_permlanex16_b32 directly to DXIL outside whole-wave sections, and model v_permlane16_b32 alongside v_permlanex16_b32 (with exec, fi, and bound_ctrl) in whole-wave section simulation:

  • Add v_permlane* to console_lanes in emit/lower.rs (keeping it out of crosses, since both instructions stay inside 32-lane halves) so standalone permlane shaders get console lane order and still split cleanly into 32-lane halves on 32-lane hosts.
  • Implement v_permlane16_b32 and v_permlanex16_b32 in valu_op: decode the per-lane 4-bit source index from src1 (row lanes 0..7) or src2 (row lanes 8..15), honor fi (opsel[0]) and bound_ctrl (opsel[1]), and check source-lane liveness with waveActiveBallot(guard.unwrap_or(true)) across both 32-lane and 64-lane host waves (guarded and branched EXEC) without passing inactive lanes to waveReadLaneAt.
  • Extend emit/wave.rs section simulation to cover v_permlane16_b32 and honor exec, fi, and bound_ctrl.
  • Add synthetic compute GPU tests in emit/valu_tests.rs and emit/wave64_tests.rs (wave32, wave64 split into 32-lane halves, native wave64, guarded and branched EXEC, all four (fi, bound_ctrl) modes) plus a section-simulation unit test in emit/wave.rs.

Verified on the title's shader archive (26,503 containers, VICTORY_HOST_WAVE=32): emit: v_permlanex16_b32 drops from 1 to 0 (2,622 -> 2,623 compute shaders emitted & validated, 0 regressions), and the target compute shader creates a D3D12 pipeline on an RTX 3080. Full cargo clippy (default & --all-features), cargo test --workspace --locked, cargo xtask policy, and git diff --check pass.

<!-- greyfinch-sync:Zettrox/ztrx:issue:6605290600 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/124). Originally posted by [VastyViz](https://github.com/VastyViz) on 2026-11-25T13:13:06Z. --- Lower `v_permlane16_b32` and `v_permlanex16_b32` directly to DXIL outside whole-wave sections, and model `v_permlane16_b32` alongside `v_permlanex16_b32` (with `exec`, `fi`, and `bound_ctrl`) in whole-wave section simulation: - Add `v_permlane*` to `console_lanes` in `emit/lower.rs` (keeping it out of `crosses`, since both instructions stay inside 32-lane halves) so standalone permlane shaders get console lane order and still split cleanly into 32-lane halves on 32-lane hosts. - Implement `v_permlane16_b32` and `v_permlanex16_b32` in `valu_op`: decode the per-lane 4-bit source index from `src1` (row lanes 0..7) or `src2` (row lanes 8..15), honor `fi` (`opsel[0]`) and `bound_ctrl` (`opsel[1]`), and check source-lane liveness with `waveActiveBallot(guard.unwrap_or(true))` across both 32-lane and 64-lane host waves (guarded and branched `EXEC`) without passing inactive lanes to `waveReadLaneAt`. - Extend `emit/wave.rs` section simulation to cover `v_permlane16_b32` and honor `exec`, `fi`, and `bound_ctrl`. - Add synthetic compute GPU tests in `emit/valu_tests.rs` and `emit/wave64_tests.rs` (wave32, wave64 split into 32-lane halves, native wave64, guarded and branched `EXEC`, all four `(fi, bound_ctrl)` modes) plus a section-simulation unit test in `emit/wave.rs`. Verified on the title's shader archive (`26,503` containers, `VICTORY_HOST_WAVE=32`): `emit: v_permlanex16_b32` drops from `1` to `0` (`2,622 -> 2,623` compute shaders emitted & validated, `0` regressions), and the target compute shader creates a D3D12 pipeline on an RTX 3080. Full `cargo clippy` (default & `--all-features`), `cargo test --workspace --locked`, `cargo xtask policy`, and `git diff --check` pass.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/124:upstream-pr/124'
git switch 'upstream-pr/124'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/124'
git switch 'upstream-pr/124'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/124'
git switch 'upstream-pr/124'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/124'
git switch 'main'
git merge --squash 'upstream-pr/124'
git switch 'main'
git merge --ff-only 'upstream-pr/124'
git switch 'main'
git merge 'upstream-pr/124'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Zettrox/ztrx!124
No description provided.