shader: lower compute v_dot2_u32_u16 and v_dot4_u32_u8 #2138
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2146"
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 R0Y00/Xbox2Windows. Originally posted by henriazz10 on 2026-11-25T01:39:39Z.
Change
Refs #721. This is the
v_dot2_u32_u16andv_dot4_u32_u8slice claimed in https://github.com/R0Y00/Xbox2Windows/issues/721#issuecomment-7144791814. It touches onlytools/compute_store_aot.py,tests/compute_store_check.py,CMakeLists.txtanddocs/experiments.md.v_dot2_u32_u16(VOP3P 0x15) andv_dot4_u32_u8(VOP3P 0x17) compute unsigned packed 16-bit (2-element) and 8-bit (4-element) dot products accumulated into a 32-bit unsigned integer, wrapping modulo2^32.dot2_u32_u16anddot4_u32_u8in HLSLuintarithmetic without 64-bit emulation.clamp(v_dot2_u32_u16 ... clamp,v_dot4_u32_u8 ... clamp);op_sel/op_sel_hiandneg_lo/neg_hi;-v4,|v4|),omod(mul:2), and other spellings (v_dot2_i32_i16);v40,s12) andvDabovev255(v256).Verification
Commit
6f784a50, rebased onto8e8b0621. The draws,controls()and the LLVM 15 round trip were re-run on6f784a50. Windows 11 build 26300, VS 2019 Build Tools 16.11 (MSVC 14.29), DXC 1.8.2502.11, Python 3.12, debug layer enabled.offscreen_checkwas built from an earliermain; this PR does not change it.groups=1 compared_words=320 mismatches=0,debug_errors=0 debug_warnings=0groups=1 compared_words=320 mismatches=0,debug_errors=0 debug_warnings=0docs_links_check.py(18 Markdown files, 398 links),bidi_controls_check.py(1437 tracked files), andgit diff --check HEAD~1all exited 0.The LLVM 15 round trip in Docker (
x2w-llvm15) exited 0 (binary_exit=0):dot_u_binary()assemblesDOT_Uongfx1030(since LLVM'sgfx1013subtarget omitsv_dot4_u32_u8), decodes it back to the samev_dot*lines, and requires the same translation.Negative control. With
tools/compute_store_aot.pyfromorigin/main,dot_u_controls()fails withValueError: Unsupported compute instruction: v_dot2_u32_u16 v10, 0xffff0002, 0xffff0003, v4.Evidence
The
DOT_Ufixture is source-built in LLVM 15 spelling (gfx1030). It runs one group of 64 threads (buffer_store_dwordx4, 256 output words plus 64SENTINELwords), covering MSB=1 unsigned lanes (0xffff,0x8001,0xff,0x80,0xfe), SGPR and inline/literal operands, and 32-bit wrap-around ontid.x >= 25, comparing all 320 words against an independent Python model.outputData.Store4(...)line, per-helper emission, unknown/pending sources,v256,clamp,op_sel,neg_lo, source modifiers,omod, andv_dot2_i32_i16.dot2treated as signedi16: word 0;dot4treated as signedi8: word 2;dot2saturated instead of wrapped: word 100;Compute readback differs:dot2_u32_u16drops+ (a >> 16) * (b >> 16);dot4_u32_u8drops+ (a >> 24) * (b >> 24).Checklist
docs/experiments.md).AI-assisted. Gemini 4 Hydrogen (Antigravity CLI) wrote the change and ran the checks; Claude Code reviewed it.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:50:51Z.
Review: COMMENTED
Review of head
6f784a50b4(comment only).Result: not mergeable as is. The PR is CONFLICTING with main (CMakeLists.txt and tests/compute_store_check.py). Please rebase, then re-run the checks below.
Logic (read-only review):
>> 16and>> 24terms need no mask on uint.m.groups()[2:]is exactly the three sources.Commands executed locally in a review worktree:
Not run: the new compute_store test (needs dxc and the D3D12 WARP runner, so Windows only) and the logic mutation check. They are deferred until the rebase.
GitHub: Build and test on Windows = pass; Python checks on Linux = pass; fixtures = pass.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T01:55:08Z.
I resolved the test overlap with the merged add and subtract slices. On Windows WARP and RTX 4060 Laptop, all three compute cases independently compared 320 words with zero mismatches and zero debug messages. Their negative controls and the documentation link check also passed.
upstream-sync referenced this pull request2026-11-25 12:01:50 +00:00