shader: lower VOP3P dot-product instructions in pixel_aot #385
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/391"
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 KomaGuy on 2026-11-22T00:09:33Z.
Change
Lower all seven
VOP3Pdot-product forms intools/pixel_aot.py, covering 7 additionalVOP3Pforms on bothgfx1013andgfx1030:v_dot2_f32_f16,v_dot2_i32_i16,v_dot2_u32_u16,v_dot4_i32_i8,v_dot4_u32_u8,v_dot8_i32_i4, andv_dot8_u32_u4.v_dot2_f32_f16semantics: Widenssrc0/src1binary16 lanes throughwiden16usingop_sel(default[0,0,0]) andop_sel_hi(default[1,1,1]), appliesneg_lo(includingneg_lo[2]on thef32accumulatorsrc2) andneg_hi, zero-extends inlinef16float constants insrc0/src1matching RDNA 2 hardware, and optionally saturates to[0, 1]withclamp.v_dot2_{i,u}32_{i,u}16supportop_sel,op_sel_hi, andclamp;v_dot4_{i,u}32_{i,u}8andv_dot8_{i,u}32_{i,u}4supportclamponly (rejectingop_sel/neg_*). All six integer forms accumulate in emulated 64-bit unsigned pairs (uint2) emitted only when used, keeping wrapping and saturatingclamp(INT32_MIN/INT32_MAX/UINT32_MAX) bit-exact on SM 6.0 without requiring 64-bit integer shader support.DOT_BODYandcheck_dot_drawintests/pixel_aot_check.py(assembled ongfx1030incheck_binarybecause LLVM'sgfx1013subtarget omits dot-product instructions) across 4 constant sets covering mixed signs,op_sel/neg_lo/neg_hi,INT32_MAX/INT32_MIN/UINT32_MAXsaturation and wraparound, plus 5 negative mutations and negative controls for invalid modifiers, out-of-scopeVOP3Pneighbors, WQM, andvmcnt/lgkmcnthazards.Verification
Tested on Linux x86_64 (Python 3.13.5, LLVM 19.1.7, Clang 19.1.7) on top of
9bdbb20:python3 -B tests/pixel_aot_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM-19.so— passed (controls, negative controls,llvm-mc -mcpu=gfx1030round-trip assembly→DXBC/XDAT/XBCH/FSSM→disassembly→lowering parity forDOT_BODY, andgfx1013parity for all existing fixtures).python3 -B tests/ffx_dispatch_aot_check.py llvm-mc-19 llvm-objcopy-19 libLLVM-19.so— passed.python3 -B tests/script_state_check.py,tests/bcpack_check.py,tests/resource_ranges_check.py,tests/layout_chunks_check.py,tests/docs_links_check.py,tests/bidi_controls_check.py— all passed.tools/form_coverage.pyrecords all 7 dot-product forms (v_dot2_f32_f16,v_dot2_i32_i16,v_dot2_u32_u16,v_dot4_i32_i8,v_dot4_u32_u8,v_dot8_i32_i4,v_dot8_u32_u4) against bothdocs/coverage/gfx1013.tsvanddocs/coverage/rdna2.tsv.DOT_BODYand all 5 negative mutations (neg_lo,dot2signed vs unsigned,dot4_i32_i8clamp,dot8signed vs unsigned,dot8_u32_u4clamp) as C++20 withclang++-19 -std=c++20 -O2 -Wall -Wextra -Wpedantic -Werror -fsanitize=undefined,address— bit-exact match on all 4 constant sets and all 5 mutations caught; 0 sanitizer errors.dxc -Gis -T ps_6_0), WARP (pixel_aot_warp), and hardware (pixel_aot_hardware) checks were not run locally on Linux; relying on thebuild-and-testWindows CI job to verify DXC compilation and D3D12 WARP readback.Evidence and follow-up
tests/pixel_aot_check.pyare original MIT-licensed RDNA 2 (gfx1030) assembly sequences built from source at test time.v_pk_*_f16) and #389 (v_fma_mix*) without overlapping their opcodes; packed 16-bit integerVOP3Pinstructions stay rejected here for a separate focused PR.Checklist