Shaders: fspx_programs_run_with_the_hardwares_dot_products fails on RDNA1, where the driver folds a constant Dot4AddI8Packed operand as unsigned #1782

Closed
opened 2026-11-26 04:44:29 +00:00 by github-bot · 3 comments
Owner

@⁠Baconzido on GitHub · 2026-11-24 22:29 UTC · original

On main 70564ae, emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products fails on an AMD Radeon RX 5700 and passes on WARP:

assertion `left == right` failed: hardware: [cc164000, 1c0e0501]
  left: 2147516405   (0x80007FF5)
 right: 2147482613   (0x7FFFFBF5)

0x80007FF5 is the dot product with every byte read as unsigned, plus the accumulator. The DXIL asks for the signed one (dot4AddPacked.i32, opcode 163). The lowering is right: WARP runs the same DXIL and gets 0x7FFFFBF5.

The test loads its operands as literals (v_mov_b32 vN, literal), so they reach the driver as constants. I fed the same values in at run time and switched one operand at a time to a literal:

Literal operands RX 5700 WARP
none 0x7FFFFBF5 (signed) 0x7FFFFBF5
accumulator only 0x7FFFFBF5 (signed) 0x7FFFFBF5
first multiplicand 0x80007AF5: that operand's bytes unsigned 0x7FFFFBF5
second multiplicand 0x800000F5: that operand's bytes unsigned 0x7FFFFBF5
both multiplicands 0x80007FF5: all unsigned (the failing case) 0x7FFFFBF5

With run-time operands, both v_dot4c_i32_i8 and v_dot4_i32_i8 give the signed result on the RX 5700 for every case I tried, including negative bytes in either operand. So the driver's compiler zero-extends the bytes of a constant multiplicand. The RX 5700 (gfx1010) has no native dot4, so this is probably in the driver's emulation.

What it means:

  • The translator needs no change for this.
  • In a title shader, only an RDNA1 GPU would be affected, and only by a dot4 whose constant multiplicand has a byte of 0x80 or more. The upscaler constant in the test (0x4000) is not affected.
  • To make the test pass on RDNA1, the cases could feed a, b and the accumulator as user data (as build_valu_cs does) instead of literals. The second case, with the inline 2.0, would still be a constant, but its bytes are below 0x80.

Tested on Windows 11 26300, AMD Radeon RX 5700 (RDNA1, driver 26.11.2) and WARP, dxil.dll from SDK 10.0.26100, Rust 1.98.1. The probes were temporary tests in valu_tests.rs, not committed. No game data used.

AI use: Claude Code (Claude Opus 5.5) wrote the probes and this issue; I ran them on the hardware above.

**@⁠Baconzido** on GitHub · 2026-11-24 22:29 UTC · [original](https://github.com/Marvisak/VIctory/issues/1782) On `main` `70564ae`, `emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products` fails on an AMD Radeon RX 5700 and passes on WARP: ``` assertion `left == right` failed: hardware: [cc164000, 1c0e0501] left: 2147516405 (0x80007FF5) right: 2147482613 (0x7FFFFBF5) ``` `0x80007FF5` is the dot product with every byte read as **unsigned**, plus the accumulator. The DXIL asks for the signed one (`dot4AddPacked.i32`, opcode 163). The lowering is right: WARP runs the same DXIL and gets `0x7FFFFBF5`. The test loads its operands as literals (`v_mov_b32 vN, literal`), so they reach the driver as constants. I fed the same values in at run time and switched one operand at a time to a literal: | Literal operands | RX 5700 | WARP | |---|---|---| | none | `0x7FFFFBF5` (signed) | `0x7FFFFBF5` | | accumulator only | `0x7FFFFBF5` (signed) | `0x7FFFFBF5` | | first multiplicand | `0x80007AF5`: that operand's bytes unsigned | `0x7FFFFBF5` | | second multiplicand | `0x800000F5`: that operand's bytes unsigned | `0x7FFFFBF5` | | both multiplicands | `0x80007FF5`: all unsigned (the failing case) | `0x7FFFFBF5` | With run-time operands, both `v_dot4c_i32_i8` and `v_dot4_i32_i8` give the signed result on the RX 5700 for every case I tried, including negative bytes in either operand. So the driver's compiler zero-extends the bytes of a constant multiplicand. The RX 5700 (gfx1010) has no native dot4, so this is probably in the driver's emulation. What it means: - The translator needs no change for this. - In a title shader, only an RDNA1 GPU would be affected, and only by a dot4 whose constant multiplicand has a byte of `0x80` or more. The upscaler constant in the test (`0x4000`) is not affected. - To make the test pass on RDNA1, the cases could feed `a`, `b` and the accumulator as user data (as `build_valu_cs` does) instead of literals. The second case, with the inline `2.0`, would still be a constant, but its bytes are below `0x80`. Tested on Windows 11 26300, AMD Radeon RX 5700 (RDNA1, driver 26.11.2) and WARP, `dxil.dll` from SDK 10.0.26100, Rust 1.98.1. The probes were temporary tests in `valu_tests.rs`, not committed. No game data used. AI use: Claude Code (Claude Opus 5.5) wrote the probes and this issue; I ran them on the hardware above.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:44:29 +00:00
Author
Owner

@⁠fiestorra on GitHub · 2026-11-25 00:21 UTC · original

The test no longer needs literals: its operands come from user data now

I took the two things the report settled into a change, because you are right that the translator is not where the fix goes and the test is.

What changes: fspx_programs_run_with_the_hardwares_dot_products builds its program with build_valu_cs — a plain compute shader whose four root constants are the case's inputs — and the multiplicands and accumulator reach v_dot4_i32_i8 through v_mov_b32 vN, sN at run time, instead of v_mov_b32 vN, <literal>. The case inputs are [a, b, acc, 0], so the three literal-multiplicand cases are gone.

Why the operands could not stay literals in an FSPX program: in an ACCC-shaped program the user data are the hardware's own SGPRs (s0-s3 are the thread's ids), so a shader of that shape cannot carry operands at all — it can only name them as literals, which is exactly the form the RDNA1 driver folds into v_dot4c and zero-extends. So the test runs the same instructions with values loaded at run time, which is the shape a title's shader has whenever its multiplicands are computed rather than declared. Its fspx_cs helper goes with the change (nothing else used it), and the doc comment says why the program is no longer ACCC-shaped.

What I could not verify, said plainly: my machine is an RTX 4090, where the literal and run-time forms agree, so here the test passed before and passes after — 209 passed, 2 ignored, unchanged. The evidence that it now passes on RDNA1 is yours to give; the reasoning is your table, where "none" and "accumulator only" are the signed result and every case with a literal multiplicand is not. The inline 2.0 (sel_hi_lo, bytes below 0x80) is untouched and stays a constant, as you said it could.

Recipe: cargo test -p victory-shader --locked --lib (209 passed, 2 ignored); cargo clippy --workspace --all-targets with and without --all-features clean under -D warnings; rustfmt --check 0 hunks on the file, which is also 0 on main, so nothing of the file was reformatted.

Pull request: #1893

No game data is involved: an opcode, two constants and test counts.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 00:21 UTC · [original](https://github.com/Marvisak/VIctory/issues/1782#issuecomment-7148430244) **The test no longer needs literals: its operands come from user data now** I took the two things the report settled into a change, because you are right that the translator is not where the fix goes and the test is. **What changes**: `fspx_programs_run_with_the_hardwares_dot_products` builds its program with `build_valu_cs` — a plain compute shader whose four root constants are the case's inputs — and the multiplicands and accumulator reach `v_dot4_i32_i8` through `v_mov_b32 vN, sN` at run time, instead of `v_mov_b32 vN, <literal>`. The case inputs are `[a, b, acc, 0]`, so the three literal-multiplicand cases are gone. **Why the operands could not stay literals in an FSPX program**: in an `ACCC`-shaped program the user data are the hardware's own SGPRs (`s0`-`s3` are the thread's ids), so a shader of that shape cannot carry operands at all — it can only name them as literals, which is exactly the form the RDNA1 driver folds into `v_dot4c` and zero-extends. So the test runs the same instructions with values loaded at run time, which is the shape a title's shader has whenever its multiplicands are computed rather than declared. Its `fspx_cs` helper goes with the change (nothing else used it), and the doc comment says why the program is no longer `ACCC`-shaped. **What I could not verify, said plainly**: my machine is an RTX 4090, where the literal and run-time forms agree, so here the test passed before and passes after — 209 passed, 2 ignored, unchanged. The evidence that it now passes on RDNA1 is yours to give; the reasoning is your table, where "none" and "accumulator only" are the signed result and every case with a literal multiplicand is not. The inline `2.0` (`sel_hi_lo`, bytes below `0x80`) is untouched and stays a constant, as you said it could. Recipe: `cargo test -p victory-shader --locked --lib` (209 passed, 2 ignored); `cargo clippy --workspace --all-targets` with and without `--all-features` clean under `-D warnings`; `rustfmt --check` 0 hunks on the file, which is also 0 on `main`, so nothing of the file was reformatted. Pull request: https://git.gtahub.st/github/Marvisak--VIctory/pulls/1893 No game data is involved: an opcode, two constants and test counts. Written with an AI assistant.
Author
Owner

@⁠Baconzido on GitHub · 2026-11-25 00:58 UTC · original

Ran the five pull requests that answer this on the RDNA1 machine from the report: Windows 11 26300, AMD Radeon RX 5700 (driver 26.11.2) and WARP, dxil.dll from SDK 10.0.26100, Rust 1.98.1. Each at its head, cargo test -p victory-shader --lib:

Head fspx_programs_run_with_the_hardwares_dot_products on the RX 5700 Suite
main 42363ab fails: 0x80007FF5, want 0x7FFFFBF5 245 passed, 1 failed, 3 ignored
#1790 8682e4a passes 209 passed, 0 failed, 2 ignored
#1791 6ef0c4e passes (and its new dot4_signed_bytes_with_runtime_operands passes) 210 passed, 0 failed, 2 ignored
#1879 5a8fc61 fails the same way 208 passed, 1 failed, 2 ignored
#1896 51f3cb8 fails the same way 208 passed, 1 failed, 2 ignored
#1900 3bdccbc passes 209 passed, 0 failed, 2 ignored

The test ran on the hardware device in every row; no no SM 6.6 skip.

Notes:

  • #1879 adds v0 to each literal. With a [1, 1, 1] group v0 is always 0, so the operand still reaches the driver as a known constant and is folded the same way.
  • #1896 changes the lowering only for an inline constant (240 to 248) as a dot source. In the failing case the multiplicands are literals moved into VGPRs, so it doesn't reach them. The probes from the report give the same six wrong hardware results with and without it. Whatever it fixes on NVIDIA, it is not this.
  • The three that pass differ in what the test keeps:
    • #1790 keeps the ACCC program and the negative-byte values. It hides the constants by adding a word of the zeroed UAV.
    • #1791 keeps the ACCC program, but its literals no longer have bytes of 0x80 or more. The signed bytes move to a new run-time test, for the plain VOP3P form only.
    • #1900 keeps the values but drops the ACCC container path (fspx_cs): the cases go through build_valu_cs.

No game data used.

AI use: Claude Code (Claude Opus 5.5) ran the comparison and wrote this comment; I ran the tests on the hardware above.

**@⁠Baconzido** on GitHub · 2026-11-25 00:58 UTC · [original](https://github.com/Marvisak/VIctory/issues/1782#issuecomment-7149081026) Ran the five pull requests that answer this on the RDNA1 machine from the report: Windows 11 26300, AMD Radeon RX 5700 (driver 26.11.2) and WARP, `dxil.dll` from SDK 10.0.26100, Rust 1.98.1. Each at its head, `cargo test -p victory-shader --lib`: | | Head | `fspx_programs_run_with_the_hardwares_dot_products` on the RX 5700 | Suite | |---|---|---|---| | `main` | `42363ab` | fails: `0x80007FF5`, want `0x7FFFFBF5` | 245 passed, 1 failed, 3 ignored | | #1790 | `8682e4a` | **passes** | 209 passed, 0 failed, 2 ignored | | #1791 | `6ef0c4e` | **passes** (and its new `dot4_signed_bytes_with_runtime_operands` passes) | 210 passed, 0 failed, 2 ignored | | #1879 | `5a8fc61` | fails the same way | 208 passed, 1 failed, 2 ignored | | #1896 | `51f3cb8` | fails the same way | 208 passed, 1 failed, 2 ignored | | #1900 | `3bdccbc` | **passes** | 209 passed, 0 failed, 2 ignored | The test ran on the hardware device in every row; no `no SM 6.6` skip. Notes: - **#1879** adds `v0` to each literal. With a `[1, 1, 1]` group `v0` is always 0, so the operand still reaches the driver as a known constant and is folded the same way. - **#1896** changes the lowering only for an inline constant (240 to 248) as a dot source. In the failing case the multiplicands are literals moved into VGPRs, so it doesn't reach them. The probes from the report give the same six wrong hardware results with and without it. Whatever it fixes on NVIDIA, it is not this. - The three that pass differ in what the test keeps: - **#1790** keeps the `ACCC` program and the negative-byte values. It hides the constants by adding a word of the zeroed UAV. - **#1791** keeps the `ACCC` program, but its literals no longer have bytes of `0x80` or more. The signed bytes move to a new run-time test, for the plain VOP3P form only. - **#1900** keeps the values but drops the `ACCC` container path (`fspx_cs`): the cases go through `build_valu_cs`. No game data used. AI use: Claude Code (Claude Opus 5.5) ran the comparison and wrote this comment; I ran the tests on the hardware above.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 12:46 UTC · original

Automated triage for the maintainers.

Confirmed in main (940d32f): fspx_programs_run_with_the_hardwares_dot_products in crates/victory-shader/src/emit/valu_tests.rs still loads a, b and the accumulator with v_mov_b32 vN, literal and runs them through fspx_cs, so the multiplicands reach the driver as constants, which the report shows RDNA1 folds as unsigned bytes. The translator needs no change; the fix belongs in the test.

Open pull requests, with the reporter's RX 5700 results:

  • pass on RDNA1: #1790, #1791 and #1900 (#1900 is the change described in the first comment; the link there to #1893 points to an unrelated PR);
  • still fail on RDNA1: #1879 and #1896.

Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 12:46 UTC · [original](https://github.com/Marvisak/VIctory/issues/1782#issuecomment-7162827483) <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-25T00:58:37Z at=2026-11-25T12:45:57Z --> Automated triage for the maintainers. Confirmed in `main` (`940d32f`): `fspx_programs_run_with_the_hardwares_dot_products` in `crates/victory-shader/src/emit/valu_tests.rs` still loads `a`, `b` and the accumulator with `v_mov_b32 vN, literal` and runs them through `fspx_cs`, so the multiplicands reach the driver as constants, which the report shows RDNA1 folds as unsigned bytes. The translator needs no change; the fix belongs in the test. Open pull requests, with the reporter's RX 5700 results: - pass on RDNA1: #1790, #1791 and #1900 (#1900 is the change described in the first comment; the link there to #1893 points to an unrelated PR); - still fail on RDNA1: #1879 and #1896. --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
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#1782
No description provided.