Repository navigation
Conversation
|
AMD RDNA3 (RX 7800 XT) test report for #1896 at head Tested
Not tested
AI use
|
|
@kais7654 thanks for catching that RTX 5070 miss. For this encoding the dump is the right dword: An inline float in That is the only inline constant in On Separate from #1782 (an RDNA1 driver folding that intrinsic's constant as unsigned). No game data. I did not re-run the RTX 5070. Update, now on AMD hardware (Radeon 8060S, RDNA3.5, so not RDNA2 itself). I ran the same VOP3P opcode (
@mercuryVM, you read RDNA2 as ignoring AI-assisted check, run on this machine. |
…e constant is taken by hand from … Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 51f3cb8 on Windows 11, RTX 5070, MSVC:
cargo test -p victory-shader -- --test-threads=1passes the dot-product test on the head, and the remaining failures are the same 5 as on main.- Merged into our fork with #1900: the same results, and clippy is clean.
The change is right. An inline f16 constant ignores op_sel/op_sel_hi on RDNA2, so its pattern sits in the low half. The host's dot4AddPacked with a constant operand reads it differently, so taking that one case by hand from the four byte products keeps the console's result. Non-constant operands still use the intrinsic.
This and #1900 approach the same failure from both sides. Both are worth keeping: #1900 makes the test run what a title runs, and this PR covers titles that do fold a constant.
AI-assisted (Claude Code).
catminou4
left a comment
There was a problem hiding this comment.
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f, cargo test -p victory-shader --locked.
144 passed / 0 failed / 2 ignored (baseline-identical). Packed dot with an inline constant now reads the constant pool by hand instead of relying on the immediate path — closes a real encoding gap.
…s taken by hand from …
|
Automated triage for the maintainers. Merge candidate. Re-reviewed at Reply to @kais7654: thanks, both requested changes are in, so the verdict moves from needs-work. A small optional follow-up: CI: passing ( Generated by Claude Code |
Offline measurement on a retail dumpResult: no count change against I merged head 51f3cb8 onto No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code). |
The dot4 lowering sent an inline constant the f16-operand way, its pattern alone in the low half; AMD reads a constant like any operand — the f32 pattern through the half selection (measured across the nine constants and the selections) — so the constant goes the ordinary way again. A host driver still reads a constant's low half in both halves of its dot, so a dot over one is taken by hand from the byte products as before. Two cases were added: 1.0 at the default selection and 4.0 with the halves swapped. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
51f3cb8 to
9b0824a
Compare
|
Fixed at 9b0824a: the f16-operand branch is gone — an inline constant AI-assisted (Mistral Vibe). |
|
Automated triage for the maintainers, second look (a review against current Closing in favour of #2408, which takes the same by-hand sum (crediting this PR) for every multiplicand a host compiler can fold: inline floats, inline integers, literals and constants moved through a register, and also If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution. |
On an Intel UHD (Xe-LP, 8086:a78b, driver 31.0.101.5445), `fspx_programs_run_with_the_hardwares_dot_products` gives acc - 128 where RDNA 2 gives acc - 320 (Marvisak#1829). The case is `v_dot4_i32_i8 v0, v1, 2.0` with `sel_hi_lo`, a multiplicand of 0x4000. The DXIL is right: the op_sel selection is integer arithmetic on 0x40000000, and the driver folds it to `dot4AddPacked(acc, a, 0x4000)`. The device then multiplies by 0x40004000: -5 * 64 + 3 * 64 = -128. A probe over constant multiplicands on that device shows the rule. Every constant that fits in 16 bits (signed or not) is read as its low half in both halves: 1, 2, 64, -2, -16, 0x4000, 0x7F00, 0xFF80 and 0xFFFF8000 all give the replicated value. 0 and -1 are right only because their replication is themselves. Constants wider than 16 bits (the inline floats as 32-bit patterns, 0x00800000, 0x12345678) are right, and so is every run-time multiplicand. A constant moved into a VGPR or an SGPR first fails the same way, and so does `v_dot4c_i32_i8`. Marvisak#1896 reports the same symptom on an RTX 5070. Both dot lowerings now go through `dot4_i8`. When a multiplicand is something the host compiler can work out before the program runs, the lowering sums the other operand's sign-extended bytes times the constant's non-zero bytes by hand, which is V_DOT4_I32_I8 and V_DOT4C_I32_I8 in the RDNA 2 ISA (November 2020, pp. 140 and 173), so no `dot4AddPacked` sees a constant. `bitcode::Module::known_i32` decides this. It folds constants through integer arithmetic, casts and selects, which covers the op_sel half selection the lowering itself emits. Run-time multiplicands keep the intrinsic. The constant's value is unchanged: an inline float is its 32-bit pattern and op_sel picks its halves, as on `main`. `dot4_takes_every_constant_class_whole` checks against `dot4_ref`, one program per class with its dot products chained through v0: inline integers 0, 1, 2, 15, 16, 63, 64, -1, -2 and -16; the nine inline floats; 16-bit and wider literals (each constant in src1 with four op_sel choices and in src0); constants in a VGPR or an SGPR; `v_dot4c` with literal and inline sources; constant accumulators; and run-time operands with four op_sel choices. With `main`'s lowering the Intel UHD fails the first six classes and passes the last two. With this change it passes all of them, and the FSPX test passes too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
fspx_programs_run_with_the_hardwares_dot_productsfails on NVIDIA (RTX 5070):one
v_dot4_i32_i8case returnsacc - 128instead ofacc - 320when one ofthe dot sources is an inline constant.
The emitted DXIL is semantically correct. Disassembling the dumped shader with
dxc -dumpbinshows the faulting call:b = 16384is the f16 pattern in the low half alone, which is exactly thewanted value. But the driver feeds the low half into BOTH halves of its native
dot instruction (broadcast), so the hardware result drifts. WARP passes the
same test with the fold in place.
Fix
In the
v_dot4_i32_i8lowering (crates/victory-shader/src/emit/lower.rs):f16 pattern in the low half through
f16_operand()and mark theinstruction as
folded.folded, compute the dot by hand — 4 signed-byte products viaselect_bits()accumulated with Mul/Add — instead of emitting thedot4AddPacked.i32intrinsic, which sidesteps the driver bug entirely.Testing
fspx_programs_run_with_the_hardwares_dot_productsPASSES on RTX 5070(laptop) and on WARP.
cargo test -p victory-shader --lib -- --test-threads=1:203 passed, 6 failed — the 6 failures are pre-existing on main (70564ae);
the packed-dot failure is gone (7 → 6).
cargo clippyclean.lower.rs(32 insertions, 8 deletions).