Repository navigation
Shaders: lower v_dot2_{i32_i16,u32_u16}, v_dot4_u32_u8, v_dot8_u32_u4, and saturating dot4 clamp - #1292
Shaders: lower v_dot2_{i32_i16,u32_u16}, v_dot4_u32_u8, v_dot8_u32_u4, and saturating dot4 clamp#1292ESAT586 wants to merge 1 commit into
Conversation
|
Independent verification of \36260ae\ on Windows 11 / AMD Radeon RX 9060 XT (RDNA4, \gfx1200) / Rust 1.98.1 MSVC:
Code audit: the two-word 64-bit signed accumulation (\lo/\hi\ without requiring \INT64\ capability) is exact—each \i16 * i16\ product fits in \i32, \4 * i8 * i8\ stays in [-65024, 65536], and \hi == (lo >> 31)\ accurately detects 32-bit signed saturation. AI-assisted; synthetic tests only, no game files. |
|
NVIDIA data point to go with the RDNA4 run above: RTX 5070 (desktop, driver 621.40, the only adapter), Windows 11 26300, Rust 1.98.1, head |
|
Reviewed at head 1. Semantics verified exhaustively against exact arithmetic. The new arm lowers 2. Hardware evidence on this machine. 3. Checks: 4. Notes, not defects: only Nothing found that would block this. |
|
Automated triage for the maintainers. Needs work. The rebase on What blocks it:
With the file-size fix and CI green, this would be a merge candidate again. The earlier hardware runs and the exhaustive model check in the comments support the semantics. CI: failing ( Generated by Claude Code |
36260ae to
06a1725
Compare
|
Rebased onto \main\ (\940d32f) at $sha. Kept \main's hardware \dot4AddPacked.i32\ path for wrapping \�_dot4_i32_i8\ / \�_dot4c_i32_i8\ and extended both with saturating \clamp\ (32-bit saturating add, no INT64); lowered the remaining \�_dot2_{i32_i16,u32_u16}, \�_dot4_u32_u8, and \�_dot8_u32_u4\ with VOP3P \opsel/\opsel_hi\ support and \clamp. Verified on RTX 3060 Ti + WARP: \integer_dot_products_match_rdna2, \spx_programs_run_with_the_hardwares_dot_products, and \�yte_dot_products_match_the_hardware\ all passed, strict Clippy (--all-targets\ and --all-features) clean, \cargo xtask policy\ ok. |
…, and saturating dot4 clamp
06a1725 to
461730e
Compare
…atch's thread count outside EXEC (port of fxceless PR Marvisak#1292) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YZ2PrBCXiMRWPWfcXFvb59
Summary
Lowers all 6 GFX10/RDNA2 integer packed dot-product instructions in
victory-shader, with exact wrapping and saturating (clamp) 32-bit accumulation:v_dot2_i32_i16(VOP3P0x014)v_dot2_u32_u16(VOP3P0x015)v_dot4_i32_i8(VOP3P0x016)v_dot4_u32_u8(VOP3P0x017)v_dot4c_i32_i8(VOP20x00dand VOP30x10d, accumulating intovdst)v_dot8_u32_u4(VOP3P0x019)Implementation Notes
INT64shader capability required).clampon signed operations, accumulates in exact 64-bit(lo, hi)two-word form before saturating to[i32::MIN, i32::MAX]so edge cases like(-32768 * -32768) * 2 + 0 = +2^31or+ i32::MAXsaturate accurately instead of wrapping mid-sum.clampon unsigned operations, tracks carry across terms and saturates tou32::MAXon overflow.omod(integer output modifiers), and writes throughself.writeto preserve EXEC lane guards and SDWA placement.Verification
Tested locally on Windows 11 with NVIDIA GeForce RTX 3060 Ti (
Driver 32.0.16.1656) + Microsoft WARP +dxil.dllvalidator, Rust1.98.1MSVC:cargo clippy --workspace --all-targets --locked -- -D warnings— 0 warningscargo clippy --workspace --all-targets --all-features --locked -- -D warnings— 0 warningscargo test -p victory-shader --locked— 121 passed, 0 failed, 1 ignored (includinginteger_dot_products_match_rdna2covering all 6 opcodes, wrapping + clamped, positive/negative overflow, and both VOP2/VOP3 encodings ofv_dot4c_i32_i8on RTX 3060 Ti and WARP)cargo xtask policy— 154 files ok