Shaders: pass SignedOpKind::Signed for float dx.op.wavePrefixOp #3151

Open
github-bot wants to merge 1 commit from github-bot/gh-3151 into main AGit
Owner

@⁠reeledMarek on GitHub · 2026-11-26 10:27 UTC · original
reeledMarek:fix/shader-wave-prefix-f32-signed-kind → main · +132 −1 · 3 files · 1 commits · open

Summary

  • In crates/victory-shader/src/emit/lower.rs (Lower::shape), wavePrefixOp unconditionally passed SignedOpKind = 1 (Unsigned) even when op == Op::AddF (dx.op.wavePrefixOp.f32).
  • DXIL requires SignedOpKind = 0 (Signed) for floating-point wavePrefixOp (matching waveActiveOp directly below at Op::AddF => (0, 0)), otherwise dxil.dll validation rejects the shader.
  • Pass self.s.m.i8(u8::from(!float)) and add a synthetic compute wave32 prefix-sum test in crates/victory-shader/src/emit/lower/wave_prefix_tests.rs verifying SignedOpKind = 0 for Op::AddF (plus DXIL validator check on Windows) and SignedOpKind = 1 for Op::AddU.
**@⁠reeledMarek** on GitHub · 2026-11-26 10:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/3151) `reeledMarek:fix/shader-wave-prefix-f32-signed-kind` → `main` · +132 −1 · 3 files · 1 commits · open ## Summary - In `crates/victory-shader/src/emit/lower.rs` (`Lower::shape`), `wavePrefixOp` unconditionally passed `SignedOpKind = 1` (`Unsigned`) even when `op == Op::AddF` (`dx.op.wavePrefixOp.f32`). - DXIL requires `SignedOpKind = 0` (`Signed`) for floating-point `wavePrefixOp` (matching `waveActiveOp` directly below at `Op::AddF => (0, 0)`), otherwise `dxil.dll` validation rejects the shader. - Pass `self.s.m.i8(u8::from(!float))` and add a synthetic compute wave32 prefix-sum test in `crates/victory-shader/src/emit/lower/wave_prefix_tests.rs` verifying `SignedOpKind = 0` for `Op::AddF` (plus DXIL validator check on Windows) and `SignedOpKind = 1` for `Op::AddU`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:08:49 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-26 10:44 UTC · original

Independent WARP verification of head c9b42b64 (parent main 63bcca4). Synthetic only, no game data.

Setup: VICTORY_D3D12_WARP=1, VICTORY_WARP=1; DXGI adapter reported "Microsoft Basic Render Driver" (flags=2 software, 0 video memory). The physical GPU was not opened. DXIL validator: dxil.dll 1.8.2502.11 (Windows Kits 10.0.26100.0). rustc: rustc 1.98.1 (48a229cea 2026-09-01). cargo test -j 4.

Result: no defect found in the change.

  • emit::lower::wave_prefix_tests::wave_prefix_op_sets_signed_op_kind_for_float_and_unsigned_for_int passes on head. With only the self.s.m.i8(u8::from(!float)) line put back to i8(1), it fails on the float assertion (left [121, None, 0, 1], right [121, None, 0, 0]), so the test does discriminate the change.
  • Integer path unchanged: the i32 call still gets sop = 1 (Unsigned).
  • cargo test -p victory-shader --no-fail-fast -- --test-threads=1: head 299 passed, 4 failed, 3 ignored. main: 298 passed, 4 failed, 3 ignored. The same 4 fail on both: synthetic_tests::{a_mask_joined_with_data_at_a_uniform_loop_is_its_number, gathers_at_a_level_match_the_hardware, permutes_mask_high_address_bits_and_divergent_branches, permutes_read_the_lane_named_and_zero_from_lanes_left_out}. They are not caused by this PR (the wave-of-32 ones are WARP refusing the fixed-wave pipeline).

Limits of what I could show:

  • dxil.dll 1.8.2502.11 validates the float wavePrefixOp module with sop = 1 (before) and sop = 0 (after), so the validator does not enforce "Signed required for float" here. The change follows the DXIL operand definition, which I did not find a way to confirm through this validator.
  • I could not run the float prefix sum on WARP: a local program with the same shape lowers and validates, but WARP refuses the fixed-wave-32 pipeline (The parameter is incorrect), exactly as it does for the existing wave-of-32 tests above. So there is no runtime comparison of results on WARP; the evidence is the emitted operands plus validation.

AI use: Claude Code (Claude Sonnet 5.5) ran this verification; Claude Code (Claude Opus 5.5) coordinated. No game files, dumps, shader names or hashes were used.

**@⁠oni-swr** on GitHub · 2026-11-26 10:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/3151#issuecomment-7189763311) Independent WARP verification of head c9b42b64 (parent main 63bcca4). Synthetic only, no game data. **Setup:** `VICTORY_D3D12_WARP=1`, `VICTORY_WARP=1`; DXGI adapter reported "Microsoft Basic Render Driver" (flags=2 software, 0 video memory). The physical GPU was not opened. DXIL validator: dxil.dll 1.8.2502.11 (Windows Kits 10.0.26100.0). rustc: rustc 1.98.1 (48a229cea 2026-09-01). `cargo test -j 4`. **Result: no defect found in the change.** - `emit::lower::wave_prefix_tests::wave_prefix_op_sets_signed_op_kind_for_float_and_unsigned_for_int` passes on head. With only the `self.s.m.i8(u8::from(!float))` line put back to `i8(1)`, it fails on the float assertion (left `[121, None, 0, 1]`, right `[121, None, 0, 0]`), so the test does discriminate the change. - Integer path unchanged: the i32 call still gets sop = 1 (Unsigned). - `cargo test -p victory-shader --no-fail-fast -- --test-threads=1`: head 299 passed, 4 failed, 3 ignored. main: 298 passed, 4 failed, 3 ignored. The same 4 fail on both: `synthetic_tests::{a_mask_joined_with_data_at_a_uniform_loop_is_its_number, gathers_at_a_level_match_the_hardware, permutes_mask_high_address_bits_and_divergent_branches, permutes_read_the_lane_named_and_zero_from_lanes_left_out}`. They are not caused by this PR (the wave-of-32 ones are WARP refusing the fixed-wave pipeline). **Limits of what I could show:** - dxil.dll 1.8.2502.11 validates the float `wavePrefixOp` module with sop = 1 (before) and sop = 0 (after), so the validator does not enforce "Signed required for float" here. The change follows the DXIL operand definition, which I did not find a way to confirm through this validator. - I could not run the float prefix sum on WARP: a local program with the same shape lowers and validates, but WARP refuses the fixed-wave-32 pipeline (`The parameter is incorrect`), exactly as it does for the existing wave-of-32 tests above. So there is no runtime comparison of results on WARP; the evidence is the emitted operands plus validation. AI use: Claude Code (Claude Sonnet 5.5) ran this verification; Claude Code (Claude Opus 5.5) coordinated. No game files, dumps, shader names or hashes were used.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 11:31 UTC · original · approved these changes

Verified against origin/main (63bcca4):

  • cargo test -p victory-shader --lib wave_prefix_tests:: -- --test-threads=1: passed (wave_prefix_op_sets_signed_op_kind_for_float_and_unsigned_for_int).
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: 192 files ok.

Cleanly passes SignedOpKind::Signed for float dx.op.wavePrefixOp calls per DXIL spec.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 11:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/3151#pullrequestreview-6073410987) · **approved these changes** Verified against `origin/main` (`63bcca4`): - `cargo test -p victory-shader --lib wave_prefix_tests:: -- --test-threads=1`: passed (`wave_prefix_op_sets_signed_op_kind_for_float_and_unsigned_for_int`). - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 192 files ok. Cleanly passes `SignedOpKind::Signed` for float `dx.op.wavePrefixOp` calls per DXIL spec. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3151/head:github-bot/gh-3151'
git switch 'github-bot/gh-3151'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3151'
git switch 'github-bot/gh-3151'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3151'
git switch 'github-bot/gh-3151'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3151'
git switch 'main'
git merge --squash 'github-bot/gh-3151'
git switch 'main'
git merge --ff-only 'github-bot/gh-3151'
git switch 'main'
git merge 'github-bot/gh-3151'
git push origin 'main'
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!3151
No description provided.