Repository navigation
Shaders: decode and lower v_dot8_i32_i4 - #22
Merged
Merged
Conversation
5 of 7 tasks
Merged
6 of 7 tasks
2 of 23 tasks
6 of 7 tasks
VOP3P opcode 0x18 was missing from the decoder, so any program using it failed to decode. It is lowered as eight signed nibble products plus the accumulator, wrapping, like the RDNA2 ISA; clamp is refused, as for v_dot4_i32_i8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lcg007xd-c
force-pushed
the
shader/v-dot8-i32-i4
branch
from
November 25, 2026 21:45
85d2d09 to
39ed039
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
VOP3P opcode 0x18,
v_dot8_i32_i4, is missing fromgfx10/opcodes.rs(0x17v_dot4_u32_u8and 0x19v_dot8_u32_u4are there). A program that uses it fails to decode, so the whole shader is lost. LLVM's gfx1030 disassembler and the RDNA2 ISA both list it:The change:
gfx10/opcodes.rs: adds(0x018, "v_dot8_i32_i4").emit/lower.rs: lowers it in thev_dot4_i32_i8arm, so it gets the same operand handling (op_sel / op_sel_hi, folded inline constants). The result is eight signed nibble products plus the accumulator, wrapping. Each nibble is shifted to the top and arithmetic-shifted back by 28 to extend its sign. As withv_dot4_i32_i8,clampandneg_hiare refused (anUnsupportederror) rather than computed wrongly.emit::lower::tests::signed_nibble_dot_products_decode_and_lower: decodes the encoding above, lowers it with the result stored to LDS, and checks that theclampform is refused. This runs on any host.emit::semantics_tests::nibble_dot_products_match_the_hardware: a hardware probe next tobyte_dot_products_match_the_hardware, against a CPU model of the instruction.nibble_dot_model_follows_the_isachecks that model on hand-worked cases (all -8 nibbles, -1 × 7, a single pair, a wrapping sum). Both are Windows/D3D12 only, like the rest of that file.This ports the same change I sent upstream (Marvisak/VIctory#2768, not merged there yet). It was merged in uiliannn/VItoriaBr#44.
Checked
docs/asset-policy.mdbuild.rs, git hook,.cargoconfig, CI change or script (or an issue explains why)cargo test --workspacepasses (onlyviport-shader --libon Linux, see below)cargo clippy --workspace --all-targets --locked -- -D warningspasses (forviport-shader, with CI: clear the clippy errors that keep main red since a3e7f17 #21 applied, see below)rustfmt; I did not reformat lines I did not changeWhat I ran
On Linux, Rust 1.98.1 (pinned):
cargo test -p viport-shader --lib --locked: 191 passed, 0 failed, 3 ignored.Unsupported { offset: 8, what: "v_dot8_i32_i4" }.cargo clippy -p viport-shader --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings: the only errors are the two already onmain(fixed in CI: clear the clippy errors that keep main red since a3e7f17 #21). With CI: clear the clippy errors that keep main red since a3e7f17 #21 merged in locally, it is clean.Not run: the Windows/D3D12 tests in
semantics_tests.rs, including the new hardware probe. I have no Windows machine or GPU, so the lowering has not been executed on a device. Its arithmetic is plain 32-bit integer shifts, multiplies and adds, andnibble_dot_products_match_the_hardwarewill check it against the model on WARP and the host GPU.Overlaps
#21 (CI clippy fix) also edits
lower.rs, but in other functions. The two merge cleanly in either order; I checked that locally. #27 moves thelower.rsunit tests intoemit/lower_tests.rs. If it lands first, the newsigned_nibble_dot_products_decode_and_lowertest has to move with them; I will rebase this PR if so. No other open PR touches the dot-product lowering or the VOP3P table.🤖 Generated with Claude Code