fix(shader): track constant s_mov_b32 identities in whole-wave reductions #155

Merged
brainbudt merged 1 commit from upstream-pr/155 into main 2026-11-26 22:39:21 +00:00
brainbudt commented 2026-11-26 21:51:14 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by brainbudt on 2026-11-26T21:51:14Z.


Whole-wave reduction simulation in crates/victory-shader/src/emit/wave.rs previously refused scalar moves that load a compile-time constant identity (such as s_mov_b32 s6, INT_MAX before a signed-minimum v_cndmask_b32) with "a whole-wave section step the simulation does not follow: a scalar ALU result".

Changes

  • Track exact constant s_mov_b32 writes to an SGPR as Sym::K in wave::simulate (using the existing constant() helper so non-constant SGPR copies and special registers like vccz/execz/scc remain refused).
  • Add regression tests in crates/victory-shader/src/emit/gfx_refusal_tests.rs checking byte-identical DXIL against a direct literal operand (including with EXEC == 0 at the scalar move), plus negative cases for a wrong constant identity and a dynamic SGPR copy.
  • Document the scope in docs/native-host.md.

Verification

  • cargo test -p victory-shader (261 passed, 0 failed, 2 ignored)
  • cargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings
  • cargo xtask policy (364 files ok)
<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:5517632356 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/155). Originally posted by [brainbudt](https://github.com/brainbudt) on 2026-11-26T21:51:14Z. --- Whole-wave reduction simulation in `crates/victory-shader/src/emit/wave.rs` previously refused scalar moves that load a compile-time constant identity (such as `s_mov_b32 s6, INT_MAX` before a signed-minimum `v_cndmask_b32`) with `"a whole-wave section step the simulation does not follow: a scalar ALU result"`. ## Changes - Track exact constant `s_mov_b32` writes to an SGPR as `Sym::K` in `wave::simulate` (using the existing `constant()` helper so non-constant SGPR copies and special registers like `vccz`/`execz`/`scc` remain refused). - Add regression tests in `crates/victory-shader/src/emit/gfx_refusal_tests.rs` checking byte-identical DXIL against a direct literal operand (including with `EXEC == 0` at the scalar move), plus negative cases for a wrong constant identity and a dynamic SGPR copy. - Document the scope in `docs/native-host.md`. ## Verification - `cargo test -p victory-shader` (261 passed, 0 failed, 2 ignored) - `cargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings` - `cargo xtask policy` (364 files ok)
LakshanSivakumar commented 2026-11-26 22:39:17 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T22:39:17Z.

Review: APPROVED


Reviewed and tested together with the other open PRs on main (macOS x86_64 workspace tests, the setup shell tests, and Windows clippy). Thanks!

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:review:6081188548 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/155#pullrequestreview-6081188548). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T22:39:17Z. **Review:** APPROVED --- Reviewed and tested together with the other open PRs on main (macOS x86_64 workspace tests, the setup shell tests, and Windows clippy). Thanks!
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
LakshanSivakumar/Native-Victory-macOS!155
No description provided.