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

Manually merged
github merged 1 commit from gh-pr/1790/head into gh-pr/1790/base 2026-11-26 04:44:40 +00:00
Owner

@⁠Ingenioeren on GitHub · 2026-11-24 22:38 UTC · original
Ingenioeren:fix/1782-dot4-runtime-operands → main · +8 −3 · 1 files · 1 commits · merged 2026-11-25 21:51 UTC

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

**@⁠Ingenioeren** on GitHub · 2026-11-24 22:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/1790) `Ingenioeren:fix/1782-dot4-runtime-operands` → `main` · +8 −3 · 1 files · 1 commits · merged 2026-11-25 21:51 UTC ## 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)
The RX 5700's driver zero-extends the bytes of a dot4 multiplicand it
sees as a constant, so fspx_programs_run_with_the_hardwares_dot_products
failed on RDNA1 although the DXIL asks for signed bytes. Each operand is
now a literal plus a word loaded from the zeroed UAV.

Fixes #1782

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:44:39 +00:00
github manually merged commit 8682e4a7fb into gh-pr/1790/base 2026-11-26 04:44:40 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 06:22 UTC · original

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

**@⁠Marvisak** on GitHub · 2026-11-25 06:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/1790#issuecomment-7154725790) <!-- 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)_
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!1790
No description provided.