Shader tests: dot products take their operands at run time #1789

Merged
Ingenioeren merged 1 commit from upstream-pr/1790 into main 2026-11-25 21:51:35 +00:00
Ingenioeren commented 2026-11-24 22:38:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Ingenioeren on 2026-11-24T22:38:57Z.


What

emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products loaded a, b and the accumulator with v_mov_b32 vN, literal. Now each one is v_add_nc_u32 vN, literal, v4, where v4 comes from a buffer_load_dword of the zeroed result UAV, so the driver sees run-time values. The cases, the expected values and the ACCC container path are the same as before. Only the test changes; the translator does not.

Why

#1782: on an RX 5700 (RDNA1) the driver zero-extends the bytes of a dot4 multiplicand it can treat as a constant. The test then fails with 0x80007FF5 (the unsigned dot product) where it should get 0x7FFFFBF5. The reporter found that with run-time operands the RX 5700 gives the signed result, and that WARP is right either way. The lowering (dot4AddPacked.i32, opcode 163) is correct, so the test is what has to change. As the issue says, the case with the inline 2.0 is still a constant, but none of its bytes is 0x80 or higher.

How tested

Windows 11, AMD Radeon RX 6750 XT (RDNA2) and WARP:

  • cargo test --locked -p victory-shader --lib fspx_programs_run: passes before and after the change.
  • To check that the test still catches signedness errors, I temporarily changed the lowering to the unsigned dot4AddPacked.u32 (164). The test fails with left: 2147516405 (0x80007FF5), the same value as the RDNA1 report. I reverted that change.
  • cargo test --locked -p victory-shader: 207 passed, 2 failed, 2 ignored. The 2 failures (emit::rect::tests::rectangles_get_their_fourth_corner and emit::tests::elements_sharing_a_row_keep_their_order, both DXIL validator unwraps) also fail on a clean 70564ae on this machine, so this change doesn't cause them.
  • cargo clippy --locked -p victory-shader --all-targets: no warnings. cargo run -p xtask -- policy --staged: ok.

Not tested: RDNA1. I have no RX 5700, so I haven't confirmed that this makes the test pass there. That relies on the reporter's measurements in #1782.

Fixes #1782

AI assistance: prepared with Claude Code, reviewed by Ingenioeren.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6592828704 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1790). Originally posted by [Ingenioeren](https://github.com/Ingenioeren) on 2026-11-24T22:38:57Z. --- ## What `emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products` loaded `a`, `b` and the accumulator with `v_mov_b32 vN, literal`. Now each one is `v_add_nc_u32 vN, literal, v4`, where `v4` comes from a `buffer_load_dword` of the zeroed result UAV, so the driver sees run-time values. The cases, the expected values and the ACCC container path are the same as before. Only the test changes; the translator does not. ## Why #1782: on an RX 5700 (RDNA1) the driver zero-extends the bytes of a dot4 multiplicand it can treat as a constant. The test then fails with `0x80007FF5` (the unsigned dot product) where it should get `0x7FFFFBF5`. The reporter found that with run-time operands the RX 5700 gives the signed result, and that WARP is right either way. The lowering (`dot4AddPacked.i32`, opcode 163) is correct, so the test is what has to change. As the issue says, the case with the inline `2.0` is still a constant, but none of its bytes is `0x80` or higher. ## How tested Windows 11, AMD Radeon RX 6750 XT (RDNA2) and WARP: - `cargo test --locked -p victory-shader --lib fspx_programs_run`: passes before and after the change. - To check that the test still catches signedness errors, I temporarily changed the lowering to the unsigned `dot4AddPacked.u32` (164). The test fails with `left: 2147516405` (0x80007FF5), the same value as the RDNA1 report. I reverted that change. - `cargo test --locked -p victory-shader`: 207 passed, 2 failed, 2 ignored. The 2 failures (`emit::rect::tests::rectangles_get_their_fourth_corner` and `emit::tests::elements_sharing_a_row_keep_their_order`, both DXIL validator `unwrap`s) also fail on a clean `70564ae` on this machine, so this change doesn't cause them. - `cargo clippy --locked -p victory-shader --all-targets`: no warnings. `cargo run -p xtask -- policy --staged`: ok. **Not tested:** RDNA1. I have no RX 5700, so I haven't confirmed that this makes the test pass there. That relies on the reporter's measurements in #1782. Fixes #1782 AI assistance: prepared with Claude Code, reviewed by Ingenioeren. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
catminou4 commented 2026-11-24 23:05:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T23:04:16Z.

Review: APPROVED


Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae), cargo test -p victory-shader --locked → 118 passed, 0 failed. GPU execution tests (valu_tests/host) are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests.

Dot products take operands at run time: keeps the FSPX/dot lowering from folding constants so the GPU test exercises real operand fetch. Test-only change class.

<!-- greyfinch-sync:Marvisak/VIctory:review:6048810040 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1790#pullrequestreview-6048810040). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T23:04:16Z. **Review:** APPROVED --- Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae), cargo test -p victory-shader --locked → 118 passed, 0 failed. GPU execution tests (valu_tests/host) are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests. Dot products take operands at run time: keeps the FSPX/dot lowering from folding constants so the GPU test exercises real operand fetch. Test-only change class.
Marvisak commented 2026-11-25 07:03:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T06:22:33Z.


Automated triage for the maintainers.

Merge candidate. fspx_programs_run_with_the_hardwares_dot_products (crates/victory-shader/src/emit/valu_tests.rs) now builds its three operands at run time: each is a literal plus a word loaded from the still-zero UAV. Before, they were v_mov_b32 literals, which the RDNA1 driver folds as unsigned bytes (#1782). The test keeps its original operands with negative bytes, so it still covers the signed case. I checked that the hand-encoded buffer_load_dword v4, off, s[8:11] uses the descriptor fspx_cs loads into s[8:11] and the same UAV the result is stored to. Test-only change.

#1791 targets the same failure but changes the operands to avoid bytes ≥ 0x80; this PR is the better of the two.

CI: no check runs on the head commit.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7154725790 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1790#issuecomment-7154725790). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T06:22:33Z. --- <!-- victory-triage v1 head=8682e4a7fb6da84a1de7b86607b0a8c78d7995d2 verdict=merge-candidate at=2026-11-25T06:51:00Z --> Automated triage for the maintainers. **Merge candidate.** `fspx_programs_run_with_the_hardwares_dot_products` (`crates/victory-shader/src/emit/valu_tests.rs`) now builds its three operands at run time: each is a literal plus a word loaded from the still-zero UAV. Before, they were `v_mov_b32` literals, which the RDNA1 driver folds as unsigned bytes (#1782). The test keeps its original operands with negative bytes, so it still covers the signed case. I checked that the hand-encoded `buffer_load_dword v4, off, s[8:11]` uses the descriptor `fspx_cs` loads into `s[8:11]` and the same UAV the result is stored to. Test-only change. #1791 targets the same failure but changes the operands to avoid bytes ≥ 0x80; this PR is the better of the two. CI: no check runs on the head commit. --- _Generated by [Claude Code](https://claude.ai/code)_
upstream-sync closed this pull request 2026-11-25 22:03:09 +00:00
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
Marvisak/VIctory!1789
No description provided.