shader: follow constant/uniform v_cndmask terms, constant-mask selects, integer products, and v_readfirstlane in whole-wave sections #512

Open
opened 2026-11-27 22:51:52 +00:00 by github-bot · 2 comments
Owner

@⁠Sheffy007 on GitHub · 2026-11-27 22:48 UTC · original

Summary

Several valid whole-wave reduction and prefix-scan shapes in crates/victory-shader/src/emit/wave.rs and lower.rs are currently refused as a whole-wave section step the simulation does not follow: a value that is no reduction or prefix (or VALU_SGPR / SCALAR):

  1. Constant or uniform active terms in v_cndmask_b32: WavePrefixSum(1), WaveActiveSum(k), WavePrefixSum(s_stride), and WavePrefixCountBits lowered via v_cndmask_b32 v_dst, 0, 1, s_saved (or v_cndmask_b32 v_dst, ident, s_uniform, s_saved) pass Sym::K or Sym::Uni as src1, which wave::simulate rejected as Sym::Unknown without setting why, refusing with a value that is no reduction or prefix.
  2. Constant lane-select masks in v_cndmask_b32 and s_mov_b64: Prefix scans that keep EXEC = -1 and mask rows/halves or lane 0 via s_mov_b32 / s_mov_b64 constant SGPRs into v_cndmask_b32 (or move a constant SGPR into EXEC) fell through to Sym::Unknown / SCALAR.
  3. Integer wave products (WaveActiveProduct / WavePrefixProduct): v_mul_lo_u32 and s_mul_i32 (Op::MulU, identity 1) were missing alongside Op::MulF.
  4. v_readfirstlane_b32 and inclusive-prefix total reads: v_readfirstlane_b32 inside a whole-wave section (reading exec.trailing_zeros(), e.g. lane 0 in place of the 8-byte v_readlane_b32 s, v, 0) hit VALU_SGPR; outside a section, v_readfirstlane_b32 on a section_uniform value or under a constant EXEC mask (s_mov_b64 exec, 1), as well as v_readlane_b32 of lane wave - 1 of an inclusive prefix, did not resolve through section_lanes.

Refs #4, #258

**@⁠Sheffy007** on GitHub · 2026-11-27 22:48 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/508) ## Summary Several valid whole-wave reduction and prefix-scan shapes in `crates/victory-shader/src/emit/wave.rs` and `lower.rs` are currently refused as `a whole-wave section step the simulation does not follow: a value that is no reduction or prefix` (or `VALU_SGPR` / `SCALAR`): 1. **Constant or uniform active terms in `v_cndmask_b32`**: `WavePrefixSum(1)`, `WaveActiveSum(k)`, `WavePrefixSum(s_stride)`, and `WavePrefixCountBits` lowered via `v_cndmask_b32 v_dst, 0, 1, s_saved` (or `v_cndmask_b32 v_dst, ident, s_uniform, s_saved`) pass `Sym::K` or `Sym::Uni` as `src1`, which `wave::simulate` rejected as `Sym::Unknown` without setting `why`, refusing with `a value that is no reduction or prefix`. 2. **Constant lane-select masks in `v_cndmask_b32` and `s_mov_b64`**: Prefix scans that keep `EXEC = -1` and mask rows/halves or lane 0 via `s_mov_b32` / `s_mov_b64` constant SGPRs into `v_cndmask_b32` (or move a constant SGPR into `EXEC`) fell through to `Sym::Unknown` / `SCALAR`. 3. **Integer wave products (`WaveActiveProduct` / `WavePrefixProduct`)**: `v_mul_lo_u32` and `s_mul_i32` (`Op::MulU`, identity `1`) were missing alongside `Op::MulF`. 4. **`v_readfirstlane_b32` and inclusive-prefix total reads**: `v_readfirstlane_b32` inside a whole-wave section (reading `exec.trailing_zeros()`, e.g. lane 0 in place of the 8-byte `v_readlane_b32 s, v, 0`) hit `VALU_SGPR`; outside a section, `v_readfirstlane_b32` on a `section_uniform` value or under a constant `EXEC` mask (`s_mov_b64 exec, 1`), as well as `v_readlane_b32` of lane `wave - 1` of an inclusive prefix, did not resolve through `section_lanes`. Refs #4, #258
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 22:51:52 +00:00
Author
Owner

@⁠Sheffy007 on GitHub · 2026-11-27 22:48 UTC · original

/claim

**@⁠Sheffy007** on GitHub · 2026-11-27 22:48 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/508#issuecomment-7229632581) /claim
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-27 22:48 UTC · original

Claimed by @⁠Sheffy007. Open a draft pull request with Refs #508 in its description within 24 hours, or the claim expires.

**@⁠github-actions[bot]** on GitHub · 2026-11-27 22:48 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/508#issuecomment-7229635068) Claimed by @⁠Sheffy007. Open a draft pull request with `Refs #508` in its description within 24 hours, or the claim expires.
This discussion has been locked. Commenting is limited to contributors.
No description provided.