Shaders: fspx_programs_run_with_the_hardwares_dot_products fails on RDNA1, where the driver folds a constant Dot4AddI8Packed operand as unsigned #1782
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#1782
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Baconzido on GitHub · 2026-11-24 22:29 UTC · original
On
main70564ae,emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_productsfails on an AMD Radeon RX 5700 and passes on WARP:0x80007FF5is 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 gets0x7FFFFBF5.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:0x7FFFFBF5(signed)0x7FFFFBF50x7FFFFBF5(signed)0x7FFFFBF50x80007AF5: that operand's bytes unsigned0x7FFFFBF50x800000F5: that operand's bytes unsigned0x7FFFFBF50x80007FF5: all unsigned (the failing case)0x7FFFFBF5With run-time operands, both
v_dot4c_i32_i8andv_dot4_i32_i8give 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:
0x80or more. The upscaler constant in the test (0x4000) is not affected.a,band the accumulator as user data (asbuild_valu_csdoes) instead of literals. The second case, with the inline2.0, would still be a constant, but its bytes are below0x80.Tested on Windows 11 26300, AMD Radeon RX 5700 (RDNA1, driver 26.11.2) and WARP,
dxil.dllfrom SDK 10.0.26100, Rust 1.98.1. The probes were temporary tests invalu_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.
@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_productsbuilds its program withbuild_valu_cs— a plain compute shader whose four root constants are the case's inputs — and the multiplicands and accumulator reachv_dot4_i32_i8throughv_mov_b32 vN, sNat run time, instead ofv_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-s3are 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 intov_dot4cand 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. Itsfspx_cshelper goes with the change (nothing else used it), and the doc comment says why the program is no longerACCC-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 below0x80) 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-targetswith and without--all-featuresclean under-D warnings;rustfmt --check0 hunks on the file, which is also 0 onmain, 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.
@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.dllfrom SDK 10.0.26100, Rust 1.98.1. Each at its head,cargo test -p victory-shader --lib:fspx_programs_run_with_the_hardwares_dot_productson the RX 5700main42363ab0x80007FF5, want0x7FFFFBF58682e4a6ef0c4edot4_signed_bytes_with_runtime_operandspasses)5a8fc6151f3cb83bdccbcThe test ran on the hardware device in every row; no
no SM 6.6skip.Notes:
v0to each literal. With a[1, 1, 1]groupv0is always 0, so the operand still reaches the driver as a known constant and is folded the same way.ACCCprogram and the negative-byte values. It hides the constants by adding a word of the zeroed UAV.ACCCprogram, but its literals no longer have bytes of0x80or more. The signed bytes move to a new run-time test, for the plain VOP3P form only.ACCCcontainer path (fspx_cs): the cases go throughbuild_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.
@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_productsincrates/victory-shader/src/emit/valu_tests.rsstill loadsa,band the accumulator withv_mov_b32 vN, literaland runs them throughfspx_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:
Generated by Claude Code