shader: lower v_permlane16_b32 and v_permlanex16_b32 #30

Manually merged
github merged 2 commits from gh-pr/30/head into gh-pr/30/base 2026-11-26 14:43:06 +00:00
Owner

@⁠claytonblythe on GitHub · 2026-11-26 10:13 UTC · original
claytonblythe:feat/shader-v-permlane16 → main · +97 −5 · 3 files · 2 commits · merged 2026-11-26 10:20 UTC

Summary

During Story Mode world loading (frame 2788 in --console series-s), two compute shaders were refused with GFX10 code: v_permlane16_b32 is not supported.

This change adds support for v_permlane16_b32 (and general VALU lowering for v_permlanex16_b32 outside whole-wave sections):

  • crates/victory-shader/src/emit/wave.rs: handles v_permlane16_b32 alongside v_permlanex16_b32 in whole-wave reduction simulation (same 16-lane row vs cross-row in the same 32-lane half).
  • crates/victory-shader/src/emit/lower.rs:
    • Marks compute shaders using v_permlane* as requiring console_lanes.
    • Lowers v_permlane16_b32 and v_permlanex16_b32 in valu_op using read_in_half (dx.op.waveReadLaneAt), since both stay within the lane's 32-lane half and require no cross-half LDS exchange on wave32 hosts (Apple Silicon Metal).
    • Handles fi:0 inactive-lane fallback (bound_ctrl:1 → 0, bound_ctrl:0 → destination's old value) via waveActiveBallot when guarded.
  • crates/victory-shader/src/emit/wave32_tests.rs: adds permlane16_and_permlanex16_lower_within_host32_half verifying wave32 lowering with 0 exchange barriers.

Verification

  • cargo test -p victory-shader --lib — 216 passed, 0 failed.
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings — 0 warnings.
  • cargo xtask policy — 363 files ok.
**@⁠claytonblythe** on GitHub · 2026-11-26 10:13 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/30) `claytonblythe:feat/shader-v-permlane16` → `main` · +97 −5 · 3 files · 2 commits · merged 2026-11-26 10:20 UTC ## Summary During Story Mode world loading (frame 2788 in `--console series-s`), two compute shaders were refused with `GFX10 code: v_permlane16_b32 is not supported`. This change adds support for `v_permlane16_b32` (and general VALU lowering for `v_permlanex16_b32` outside whole-wave sections): - `crates/victory-shader/src/emit/wave.rs`: handles `v_permlane16_b32` alongside `v_permlanex16_b32` in whole-wave reduction simulation (same 16-lane row vs cross-row in the same 32-lane half). - `crates/victory-shader/src/emit/lower.rs`: - Marks compute shaders using `v_permlane*` as requiring `console_lanes`. - Lowers `v_permlane16_b32` and `v_permlanex16_b32` in `valu_op` using `read_in_half` (`dx.op.waveReadLaneAt`), since both stay within the lane's 32-lane half and require no cross-half LDS exchange on wave32 hosts (Apple Silicon Metal). - Handles `fi:0` inactive-lane fallback (`bound_ctrl:1` → `0`, `bound_ctrl:0` → destination's old value) via `waveActiveBallot` when guarded. - `crates/victory-shader/src/emit/wave32_tests.rs`: adds `permlane16_and_permlanex16_lower_within_host32_half` verifying wave32 lowering with 0 exchange barriers. ## Verification - `cargo test -p victory-shader --lib` — 216 passed, 0 failed. - `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` — 0 warnings. - `cargo xtask policy` — 363 files ok.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:43:05 +00:00
github manually merged commit 07c5df5590 into gh-pr/30/base 2026-11-26 14:43:06 +00:00
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-26 10:17 UTC · original · approved these changes

Reviewed and tested on top of current main together with #29: all tests including the new wave32 permlane test, clippy (Windows target) and policy pass. The row/nibble selection matches the ISA (lanes 8-15 take src2's nibbles), and FI/bound_ctrl map to op_sel[0]/[1] as expected. Follow-up when convenient: a value-level test (e.g. a WARP compute run on Windows CI) for the inactive-lane fallback would be nice, since the current test only checks the lowering.

**@⁠LakshanSivakumar** on GitHub · 2026-11-26 10:17 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/30#pullrequestreview-6072263012) · **approved these changes** Reviewed and tested on top of current main together with #29: all tests including the new wave32 permlane test, clippy (Windows target) and policy pass. The row/nibble selection matches the ISA (lanes 8-15 take src2's nibbles), and FI/bound_ctrl map to op_sel[0]/[1] as expected. Follow-up when convenient: a value-level test (e.g. a WARP compute run on Windows CI) for the inactive-lane fallback would be nice, since the current test only checks the lowering.
Author
Owner

@⁠claytonblythe on GitHub · 2026-11-26 10:19 UTC · original

Live-tested on a 16 GB Apple M4 (--console series-s, --headless, VICTORY_GUESS_GRAPHICS=1) on top of origin/main (a2940ab) + PRs #25/#28:

  • 0 refused shaders across the entire 240 s Story Mode run (both previously refused v_permlane16_b32 compute shaders at frame 2788 now translate and compile on Metal).
  • Reached frame 2880+ (recorded=16593 encoded=16593 no_pipeline=0 no_texture=0).
**@⁠claytonblythe** on GitHub · 2026-11-26 10:19 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/30#issuecomment-7189209190) Live-tested on a 16 GB Apple M4 (`--console series-s`, `--headless`, `VICTORY_GUESS_GRAPHICS=1`) on top of `origin/main` (`a2940ab`) + PRs #25/#28: - **0** refused shaders across the entire 240 s Story Mode run (both previously refused `v_permlane16_b32` compute shaders at frame 2788 now translate and compile on Metal). - Reached frame 2880+ (`recorded=16593 encoded=16593 no_pipeline=0 no_texture=0`).
This discussion has been locked. Commenting is limited to contributors.
No description provided.