shader: lower v_xnor_b32 and draw the integer e64 forms in pixel_aot #722
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/728"
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 rasptum on 2026-11-22T23:21:20Z.
Change
One translator change and one new draw test.
tools/pixel_aot.py:v_xnor_b32is added to the integer table as~(src0 ^ src1), so it lowers in the VOP2 (e32) and VOP3 (e64) encodings with the same operand rules asv_xor_b32. Before this it was accepted only as a quad-local DPP form. The operation is taken from the LLVM 15 AMDGPU backend (VOP2Instructions.tdselectsV_XNOR_B32fornot (xor a, b)), and matches the DPP and scalarxnorlowerings already in the translator. It is not checked against the ISA document here. A float modifier,clamp, a wrong operand count, an unwritten register and the SDWA spelling stay refused, and the test asserts each refusal. The scanner derives its patterns from the same table, sotools/scan_unsupported_shaders.pyneeds no edit.tests/pixel_aot_check.py: three programs drawv_xnor_b32together with the eight integer e64 encodings that the translator already accepted but no fixture drew:v_and_b32_e64,v_or_b32_e64,v_xor_b32_e64,v_not_b32_e64,v_lshlrev_b32_e64,v_lshrrev_b32_e64,v_ashrrev_i32_e64andv_cvt_f32_ubyte2_e64.The draws export through the
R32G32B32A32_UINTreadback target and are compared bit for bit. A, B and C are constants s44, s45 and s46.v_lshlrev_b32_e64,v_lshrrev_b32_e64,v_ashrrev_i32_e64,v_not_b32_e64, sources in SGPRsB << (A & 31),B >> (A & 31)logical, arithmetic,~Bv_and_b32_e64,v_or_b32_e64,v_xor_b32_e64,v_xnor_b32_e64, sources in SGPRsA & B,A | B,A ^ B,~(A ^ B)v_xnor_b32_e32,v_cvt_f32_ubyte2_e64from an SGPR, from a VGPR and withclamp~(A ^ B), byte 2 of C, byte 2 of B, byte 2 of C saturatedEach group runs on two rows. The shift counts are 0x3f800024 and 0x40000023, so a count that is not reduced modulo 32 gives a different word, and B is negative in the first row, so the logical and arithmetic shifts differ. Every input and every expected result is a normal binary32 or zero (asserted), so the draw does not depend on NaN or denormal handling.
Negative controls: fourteen wrong references, each replacing one channel on the first row, must report
pixel_mismatch: swapped shift operands, an unreduced shift count, arithmetic for logical shift and the reverse, a dropped not, or for and, and for or, xnor for xor and the reverse (in both encodings), byte 1 and byte 3 for byte 2, the wrong source register, and a dropped clamp.The draws are registered as their own CTest entries,
pixel_aot_e64_integer_hardwareandpixel_aot_e64_integer_warp(tests/pixel_aot_check.py draw-e64-integer), each with its ownFORM_COVERAGE_RECORD, so nothing is added topixel_aot_hardware. That is 20 draws from 3 compiles and 3 renderer launches. The three programs are added to the LLVM 15 round trip,tests/form_coverage_check.pyasserts the ten forms, anddocs/experiments.mdhas a paragraph.This advances instruction-form coverage of the pixel translator by ten forms.
Verification
Update before opening: rebased onto
mainat121fdc3asa0726e6. On that commit I reran the LLVM 15 round trip,tests/form_coverage_check.pyand the fullpixel_aot_check.py drawrun on WARP (all pass); the hardware and ctest results below are from the commit named there.The full
ctestrun below was made at c7b38cd (this change onmain787ace7). The branch was then rebased onto7c256c3(a966e12), which adds only #683 (README and 11 lines of static controls); the two new tests on both backends, the controls, the round trip,form_coverage_check.py,pso_readiness_check.pyanddocs_links_check.pywere rerun there and passed. Windows 10 Pro 22H2 (10.0.19045.6466), Windows SDK 10.0.26100.0 DXC, Debug build, debug layer enabled in every run.24 tests ran. 23 passed, 1 failed, 0 skipped.
pixel_aot_e64_integer_warppixel_aot_e64_integer_hardwarepixel_aot_*_warptestspixel_aot_*_hardwaretestspixel_aot_blend_scalar_hardwaremainon this machine and this change does not touch it.In both new tests every right reference reports
max_absolute_error=0, every draw reportsdebug_errors=0 debug_warnings=0, and the 14 wrong references each reportmismatch.Other checks, all passed:
python -B tests/pixel_aot_check.py binary <llvm-mc> <llvm-objcopy> <LLVM-C.dll>with LLVM 15.0.7. LLVM 15 prints all twelve new instructions exactly as written, for-mcpu=gfx1013and-mcpu=gfx1030.python -B tests/pixel_aot_check.py(controls).AGENTS.md, includingtests/form_coverage_check.py,tests/pso_readiness_check.pyandtests/docs_links_check.py.Evidence and follow-up
Coverage, counted with
tools/form_coverage.pyfrom the records of the run above. The baseline is the union of the seven record-writing shader tests run on WARP from a clean copy of787ace7.mainat787ace7The forms added are exactly
v_xnor_b32,v_xnor_b32_e64,v_and_b32_e64,v_or_b32_e64,v_xor_b32_e64,v_not_b32_e64,v_lshlrev_b32_e64,v_lshrrev_b32_e64,v_ashrrev_i32_e64andv_cvt_f32_ubyte2_e64, on both lists. None is removed.docs/coverage/dashboard.svgis not regenerated here.What this does not show: that the console computes the same results (the draws run on desktop GPUs), and the
v_xnor_b32semantics against the ISA document.Overlap with open pull requests: #340 (which drew the other accepted e64 forms) is merged and does not contain these. The diffs of the open shader pull requests (38 read) were searched for the ten form names on added lines; none adds them. The closest is #678 (three-operand integer ALU), which uses different instructions. Like every open shader pull request, this one appends a line to the
check_binaryfixture list, so a textual conflict there with whichever lands first is expected and trivial.AI-assisted (Claude Code). The Windows results were measured locally.
🤖 Generated with Claude Code