Shaders: decode and lower v_dot8_i32_i4 #2768
No reviewers
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!2768
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2768"
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?
@lcg007xd-c on GitHub · 2026-11-25 20:07 UTC · original
lcg007xd-c:shader/v-dot8-i32-i4→main· +80 −1 · 3 files · 1 commits · openWhat 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 #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
@cloph-dsp on GitHub · 2026-11-25 20:29 UTC · original
Local verification on Windows / rustc 1.100.0 / MSVC, no game data, no clippy/rustup.
13f91caon this machine (pre-existing).AI-assisted (Hy4 flash).
@fuzeofficlal on GitHub · 2026-11-25 20:38 UTC · original
Reviewed and verified
5bab6d4fon Windows 11 (RTX 5090 + WARP + Windows SDK10.0.26100.0dxil.dll) againstmain(13f91ca).Code review
VOP3P0x018decoding,op_sel/op_sel_hi16-bit half selection, per-nibble(x << (28 - 4 * n)) >> 28signed[-8, +7]sign-extension viaShl+AShr, wrappingAdd(nonsw/nuw), andv.clamprejection all check out cleanly.lower.rs:5941checksv.clamp || v.neg_hi != 0(matching existingv_dot4_i32_i8), leavingv.neg != 0(fields.rs:590,w1 >> 29) unchecked; checkingv.neg != 0too would strictly reject all negation modifier bits onVOP3P.Verification (Windows 11, RTX 5090 + WARP +
dxil.dll)cargo test --locked -p victory-shader --lib --features host semantics_tests::: 35 passed, 0 failed, 1 ignored (all 3nibble_dottests pass on both RTX 5090 and WARP).cargo clippy --locked -p victory-shader --all-targets -- -D warnings(default &--features host): 0 warnings;cargo xtask policy: 184 files ok.git merge-treevs13f91ca,#2771,#2774, and#2766.@Marvisak on GitHub · 2026-11-25 23:21 UTC · original
Automated triage for the maintainers.
This adds VOP3P opcode 0x18
v_dot8_i32_i4tocrates/victory-shader/src/gfx10/opcodes.rs(its neighbours 0x16, 0x17 and 0x19 are already there) and lowers it incrates/victory-shader/src/emit/lower.rs(valu_op) by sharing thev_dot4_i32_i8arm. That keeps the same op_sel/op_sel_hi half selection and the same refusal of clamp/neg_hi, and computes eight sign-extended nibble products plus the accumulator with 32-bit wrapping, as the public RDNA2 ISA guide defines it. I checked the shl/ashr sign extension, that the products cannot overflow, and that the CPU model insemantics_tests.rsmatches the hand-worked cases. The decode/lower test runs on every host and the semantics probe runs on Windows. CI (check) passes.This is a recommendation for a maintainer to look, not an approval.
Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.