shader: lower packed binary16 VOP3P arithmetic in pixel_aot #370
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/376"
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-21T23:47:02Z.
Change
Lower all five packed binary16
VOP3Parithmetic forms intools/pixel_aot.py, advancingVOP3Pinstruction-form coverage from0/29to5/29on bothgfx1013andgfx1030:v_pk_add_f16,v_pk_mul_f16,v_pk_min_f16,v_pk_max_f16, andv_pk_fma_f16.op_sel,op_sel_hi,neg_lo,neg_hi, andclamp, with default[0, ...](op_sel,neg_lo,neg_hi) and[1, ...](op_sel_hi) matchinggfx1013encoding. Duplicate, wrong-arity, or unsupported modifiers (includingabs/|...|, bare-reg, andmul:2) are rejected.gfx1013inline constant and literal semantics: Each source operand lowers to a 32-bituintword; the nine RDNA 2 inlinef16float constants (±0.5,±1.0,±2.0,±4.0,0.15915494) occupy bits[15:0]with bits[31:16]zeroed (matchinggfx1013rather thangfx11replication), while 32-bit hex literals and integer inline constants (-16..64) supply both halves.pack16_rne(bit-exact IEEE-754 binary32→binary16 round-to-nearest-even independent of driverf32tof16RTZ/RNE differences) andmin16_num/max16_numhelpers only when a shader usesv_pk_*_f16. Existing shaders emit none of these helpers.VOP3P(v_pk_add_u16, etc.), mixed-precision FMA (v_fma_mix_f32), and dot products (v_dot2_f32_f16) remain rejected and are covered as negative controls for follow-up PRs.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, andllvm-mc -mcpu=gfx1013assembly→DXBC/XDAT/XBCH/FSSM→disassembly→lowering parity forVOP3P_BODYand 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— all passed.tools/form_coverage.pyrecords all 5VOP3Pforms (v_pk_add_f16,v_pk_fma_f16,v_pk_max_f16,v_pk_min_f16,v_pk_mul_f16) against bothdocs/coverage/gfx1013.tsvanddocs/coverage/rdna2.tsv.VOP3P_BODYand all 5 negative mutations (neg_lo,neg_hi,min vs max, inline hi zero-extension,clamp) as C++20 withclang++-19 -std=c++20 -O2 -Wall -Wextra -Wpedantic -Werror -fsanitize=undefined,address— bit-exact match on all 3 constant sets (including IEEEminNumagainst quiet NaN0x7e00and exact halfway tie-to-even rounding distinguishingpack16_rnefrom RTZf32tof16) and all 5 mutations caught; 0 sanitizer errors.pack16_rneagainst IEEE binary16 across all 65,536 half encodings and 98,752 critical binary32 transition neighborhoods.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-licensedgfx1013assembly sequences built from source at test time.gfx1013inline-constant behavior follow the AMD RDNA 2 Instruction Set Architecture Reference Guide.VOP3Pwork:v_fma_mix_f32/v_fma_mixlo_f16/v_fma_mixhi_f16,v_dot2_f32_f16, and the 14 packed 16-bit integerv_pk_*_u16/i16/b16forms.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T03:07:52Z.
For your packed and DPP pixel changes, please refresh only #376 first. The packed arithmetic work shares the translator and draw fixtures with #389, #391 and #397. I’ll check the merged base before asking for the next branch, including the separate DPP series.
Imported from R0Y00/Xbox2Windows. Originally posted by KomaGuy on 2026-11-22T08:10:03Z.
Refreshed #376 onto current
main(5a16ee9), keeping both draw suites andv_cvt_f32_ubyte0-3intact; all 4 CI checks pass. Holding off on refreshing #389, #391, #397, and the DPP series until you check this base.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T08:26:14Z.
Merged #376 at
a46dac3. The ordered additions and removals on your refreshed head matched the reviewed patch, and all four CI checks passed. #389 is the next branch in this sequence. Please leave the later branches in place until its combined result lands.