test(shader): extend int16 ternary matrix for all orderings, ties and med3 chain #834
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/840"
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 alexander-src on 2026-11-23T11:03:06Z.
Summary
Lower the 6 non-packed 3-operand 16-bit integer VOP3 ops (
v_min3_i16,v_max3_i16,v_med3_i16,v_min3_u16,v_max3_u16, andv_med3_u16) intools/pixel_aot.pyunder the existing("low16", alu)contract, with LLVMgfx1013binary round-trip, draw, scanner, and form coverage checks (+6 forms ingfx1013.tsvandrdna2.tsv).Changes
tools/pixel_aot.py:VOP3_INT16_3OP(min3_i16,max3_i16,med3_i16,min3_u16,max3_u16,med3_u16) and the corresponding 3-operand lane expressions inpk_int16_lane_expr._e64spellings under the same("low16", alu)contract asVOP3_INT16: each operand reads bits[15:0](sign-extended fori16, zero-extended foru16), accepts VGPR, SGPR,low16VGPR, inline integers-16..64, or 16-bit literals up to0xffff, and writes a("low16", alu)result refused by whole-word and high-half readers until widened or consumed by another 16-bit op.op_sel,clamp, source modifiers, DPP, SDWA,v_{min3,max3,med3}_f16, out-of-range registers, untracked sources, pending scalar loads, pending sample reads/writes, and non-entry execution masks.tools/scan_unsupported_shaders.py: recognize the 6 supported 3-operand 16-bit integer forms usingINT16_VGPRandINT16_SOURCE.tests/pixel_aot_check.py,CMakeLists.txt: addcheck_int16_min3_controls(), 2 LLVMgfx1013binary round-trip fixtures, anddraw-int16-min3(pixel_aot_int16_min3_{warp,hardware}) losslessR32G32B32A32_UINTdraws covering all 6 ops across 6 word sets (all sixmed3orderings, ties,0x7fff/0x8000/0xffff/0x0000signed/unsigned boundary flips, differing high halves, inline/hex16 constants, and a chainedv_add_nc_u16low16input), plus 1-bit flip controls and shader mutations (i16/u16swaps,med3 -> min3, high-half source reads).tests/form_coverage_check.py,tests/rdna2_tools_check.py,docs/experiments.md: assert all 6 new forms ingfx1013.tsvandrdna2.tsvwhile keepingf16neighbours excluded, add scanner tests, and document behavior.Verification
Ran on Linux x86_64 (
llvm-mc/libLLVM.so23.1.4; Windows DXC/D3D12 WARP and hardware draws run in CI):out/pe-env/bin/python -B tests/form_coverage_check.py: passedout/pe-env/bin/python -B tests/pso_readiness_check.py: passedout/pe-env/bin/python -B tests/rdna2_tools_check.py: 67 tests OK (1 skipped)out/pe-env/bin/python -B tests/docs_links_check.py: passed (13 files, 161 links)out/pe-env/bin/python -B tests/bidi_controls_check.py: passed (677 files)pixel_aot_check.check_controls+llvm-mc -mcpu=gfx1013+libLLVM.soround-trip on bothint16_min3_ops(0)andint16_min3_ops(1)+ mutation output checks: passedAI-assisted: yes
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T11:16:36Z.
The six lowering forms are already on main through #834, with the same low16 contract and LLVM/readback controls. Please keep your authorship and rebase this as a focused test follow-up. The all-six-orderings/ties matrix and chaining a low16 producer into the median are candidates if they exercise cases the current ternary fixture misses. Extend that fixture and its independent reference in place, retaining its MAD and high-half rejection controls. With the lowering already shared, a second dispatch table and duplicate CTests would give the same coverage.
Imported from R0Y00/Xbox2Windows. Originally posted by alexander-src on 2026-11-23T11:34:37Z.
Rebased onto current
main(527a255) in856061cas a focused test follow-up touching onlytests/pixel_aot_check.py, dropping the duplicate lowering table and CTests while keeping all of#834's MAD and high-half rejection controls intact.Specifically,
#834's 6-setINT16_TERNARY_WORDSmissed the signed(1, 2, 0)ordering (c < a < b), the unsigned(2, 0, 1)ordering (b < c < a), all four tie shapes (a == b,b == c,a == c,a == b == c), and chaining alow16producer intov_med3_u16. This follow-up extendsINT16_TERNARY_WORDSto 12 sets with assertions covering all six strict signed and unsigned orderings plus all four tie shapes, addsgroup 4(v_sub_nc_u16 -> v_med3_u16 -> v_med3_i16 -> v_min3_i16) to the existing binary round-trip anddraw-int16-ternaryfixture/reference (withsigned_as_unsignedandmed3_as_min3draw mutations), and addsv_med3_u16full-word andWORD_1refusal checks.Re-ran all 5 Linux test suites,
check_controls, and LLVMgfx1013binary round-trips on groups 0..4; Windows DXC/D3D12 WARP and hardware draws run in CI.