Shaders: lower v_dot4_u32_u8 and v_dot8_u32_u4 in pure 32-bit DXIL #2090
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2092"
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?
Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-25T04:37:22Z.
Summary
v_dot4_u32_u8andv_dot8_u32_u4incrates/victory-shader/src/emit/lower.rsusing pure 32-bit DXIL (shifts, masks, multiply-adds, and unsigned overflow detection forclamp), reusing the existing VOP3P half-selector and modifier validation fromv_dot4_i32_i8without enablingInt64/WIDE_OPS.crates/victory-shader/src/emit/valu_tests.rscovering unsigned byte products (including0xFF * 0xFF), all 8 nibble positions and max nibble sum (1800), modulo-2^32wraparound (clamp = 0), unsigned saturation to0xFFFF_FFFF(clamp = 1), and VOP3P operand half selection, assertingInt64is not set.Verification
cargo xtask policy: passedcargo clippy -p victory-shader --tests -- -D warnings: passedcargo test -p victory-shader --lib dot_products -- --test-threads=1with Microsoftdxil.dll: 5/5 passed on AMD Radeon RX 9060 XT (RDNA4) and Microsoft Basic Render Driver (WARP)Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T04:41:35Z.
Review: APPROVED
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC, withdxil.dllvalidator):cargo test -p victory-shader --lib unsigned_— 4 passed, 0 failed on both RTX 5090 hardware andVICTORY_D3D12_WARP=1(coveringv_dot4_u32_u8,v_dot8_u32_u4, wrapping/saturating, and operand half selectors)cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean pure-32-bit DXIL lowering of
v_dot4_u32_u8andv_dot8_u32_u4, verified end-to-end on hardware and WARP. Looks good.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-25T04:43:10Z.
Triage verdict — Keep the unsigned dot lowering with operand selectors (
e4eae6b)Evidence
srcoperands without those selectors, while #157 explicitly refuses selector and clamp cases. Current lowering · #1292 patch · #157 patchChecks and limits
Next step
This verification was AI-assisted.
Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-25T04:48:36Z.
Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at
e4eae6b.victory-shader: 247 passed, 3 failed, 3 ignored. The newunsigned_byte_dot_products_wrap_or_saturate,unsigned_nibble_dot_products_wrap_or_saturateandunsigned_packed_dot_products_use_operand_half_selectorspass. The 3 failures are #1744's NVIDIA failures onmain. Same asmainon this hardware.Overlap, from reading: #1292 (open, conflicting with
main) lowersv_dot4_u32_u8andv_dot8_u32_u4too, along withv_dot2_{i32_i16,u32_u16},v_dot4_i32_i8andv_dot4c_i32_i8.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T05:16:24Z.
Review: APPROVED
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main
940d32f69b,cargo test -p victory-shader --locked.144 passed / 0 failed / 2 ignored. v_dot4_u32_u8 and v_dot8_u32_u4 lowered in pure 32-bit DXIL — dot-product ops without i64; relates to #1879's dot4 runtime operands.
Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T08:54:33Z.
Offline measurement on a retail dump
Result: no count change against
main.I merged head
e4eae6b3ontomain940d32f(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 23,918 onmain, 23,918 with this PR.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).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T10:34:33Z.
Automated triage for the maintainers.
Extends the existing
v_dot4_i32_i8arm inemit/lower.rstov_dot4_u32_u8(VOP3P 0x17) andv_dot8_u32_u4(0x19), reusing its op_sel/op_sel_hi operand handling. I checked the opcodes againstgfx10/opcodes.rs, that the byte/nibble product sums fit in 32 bits (so the only overflow is the accumulator add, which theclamppath saturates with an unsigned compare), and the expected values in the three newvalu_tests.rstests, including the half-selector case. This matches the unsigned dot products as AMD's public RDNA ISA guide describes them; citing that in the PR would help. CI passes, and an independent NVIDIA run reports the new tests passing.Notes: #1292 and #157 also touch these two opcodes; there should be one implementation. The
try_build_valu_cschange (panic whenVICTORY_DXILis set but fails to load) also appears in #2097 with a different message, so whichever lands second needs a trivial rebase.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T01:42:44Z.
Code review and RTX 5090 + WARP + DXIL verification at head
e4eae6b3466amerged cleanly ontomain(63bcca43c6a0;emit/lower.rs=522,189B,2,099B under the 512 KiB cap):crates/victory-shader/src/emit/lower.rs:6194-6249):v.opsel/v.opsel_hihalf selection withv_dot4_i32_i8; computes pure 32-bit unsigned 4x8 (<= 260,100) and 8x4 (<= 1,800) dot products withoutu32overflow, detectsacc + dotwrap viapred::IULT(sum, acc)forv.clampsaturation tou32::MAX, and writes underguard. (Consistent withv_dot4_i32_i8, line 6199 checksv.neg_hi != 0.)dxil.dll10.0.26100.0,VICTORY_D3D12_DEBUG=1, Rust 1.98.1):cargo xtask policy:191 files ok;cargo clippy(default +--features diagnostics): 0 warningsdot_product(5/5),emit::lower::tests(33/33), andemit::semantics_tests(34/34 on both RTX 5090 and WARP, 1 ignored) all passed.LGTM.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.