Repository navigation
Shaders: decode and lower v_dot8_i32_i4 - #2768
lcg007xd-c wants to merge 1 commit into
Conversation
|
Local verification on Windows / rustc 1.100.0 / MSVC, no game data, no clippy/rustup.
AI-assisted (Hy4 flash). |
|
Reviewed and verified Code review
Verification (Windows 11, RTX 5090 + WARP +
|
VOP3P 0x18 was missing from the opcode table (0x16, 0x17 and 0x19 are there; LLVM's gfx1030 disassembler and AMD's RDNA2 ISA list it), so a program using it failed to decode. It now lowers as eight signed nibble products plus the accumulator, wrapping, with op_sel/op_sel_hi read as for v_dot4_i32_i8; the saturating form stays refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5bab6d4 to
52a9929
Compare
|
Automated triage for the maintainers. This adds VOP3P opcode 0x18 This is a recommendation for a maintainer to look, not an approval. Generated by Claude Code |
Dukestar69
left a comment
There was a problem hiding this comment.
Tested merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP, dxil.dll validator active):
cargo test -p victory-shader --lib nibble_dot: 3 passed, 0 failed (v_dot8_i32_i4: 245 inputs, 0 mismatches on both RTX 5090 hardware and WARP, 0 hardware/WARP differences).cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
What this fixes
VOP3P opcode 0x18,
v_dot8_i32_i4, is missing fromgfx10/opcodes.rs. Its neighbours 0x16v_dot4_i32_i8, 0x17v_dot4_u32_u8and 0x19v_dot8_u32_u4are all there, so any program using it fails at decode. AMD's RDNA2 ISA guide lists it, and so does LLVM'sllvm-mc --disassemble -mcpu=gfx1030, which I used to cross-check the table. None of the open dot-product PRs (#157, #1292, #2092, #2202, #2408) add this entry.The change
(0x018, "v_dot8_i32_i4").v_dot4_i32_i8arm, soop_sel/op_sel_hiselect the halves exactly as they do there, and clamp orneg_histays refused. The result is eight signed nibble products added to the accumulator with 32-bit wrapping (RDNA2 ISA:D.i32 = Σ S0.i4[k] · S1.i4[k] + S2.i32). Each nibble is shifted to the top of the dword and shifted back arithmetically. The code is plain 32-bitshl/ashr/mul/add, with no 64-bit integers and no new DXIL op.Tests
emit::lower::tests::signed_nibble_dot_product_decodes_and_lowers(runs on every host): the encoding decodes tov_dot8_i32_i4, a program that stores the result translates, and the clamped form is refused. It fails without the table entry.emit::semantics_tests::nibble_dot_products_match_the_hardware(Windows, as with the other probes): runs the instruction on the hardware adapter and WARP and compares it with a CPU model. The edge inputs are all-8, all7, all-1, alternating nibbles, and accumulators ati32::MAX/MIN. A second test,nibble_dot_model_follows_the_isa, pins down the model itself with values worked out by hand.Run here (Linux, Rust 1.98.1):
cargo test -p victory-shader --lib: 159 passed, 0 failed, 2 ignored. Building the shader tests on Linux needs Shader tests: the descriptor-join tests build off Windows #2766; the commit itself is independent of it.cargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-msvc -- -D warnings: clean.Not run here: the hardware probe, since I have no Windows machine with a GPU. CI's Windows job will run it on WARP.
🤖 Generated with Claude Code