shader: lower gfx1013 three-operand VOP3 integer instructions in pixel_aot #526
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!526
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/526/head"
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?
@Vonsek on GitHub · 2026-11-22 09:17 UTC · original
Vonsek:pixel-aot-int-three-operand→main· +185 −2 · 5 files · 1 commits · closed without mergingChange
tools/pixel_aot.pynow lowers the eight VOP3-only three-operand integer instructions that compilers emit to fold address and bit-packing arithmetic. Each one becomes a single HLSLuintexpression in the existingINTEGERtable:v_lshl_add_u32v_add_lshl_u32v_lshl_or_b32v_and_or_b32v_or3_b32v_xor3_b32v_xad_u32v_add3_u32Sums wrap modulo 2^32, shift counts use bits [4:0] only, and the result keeps its 32-bit pattern in the vector register through
asfloat. Operands go through the existingint_operandpath, so float source modifiers,clamp, a wrong operand count, a 33-bit immediate, unwritten registers, reads of outstanding samples or scalar loads and the whole-quad mask are rejected.tools/scan_unsupported_shaders.pyreads the same table, so it recognises the new forms without a separate list.Tests:
tests/pixel_aot_check.pyaddsint3_program(k). It writes all eight results with SGPR, VGPR, inline, negative inline (-7) and literal (0x0f0f00f0) operands, then exports the four bytes of resultkthroughv_cvt_f32_ubyte0-3, so each channel is an exact integer from 0 to 255.int3_referenceis an independent Python model of the ISA definitions. The two input sets have shift counts with bits above bit 4, left shifts that drop high bits andv_add3_u32sums that carry out of bit 31. Every input and result is the pattern of a normal binary32 value, so the check does not depend on driver flushing or NaN quieting.draw-int3, registered aspixel_aot_int3_hardwareandpixel_aot_int3_warp(60 s timeout,SKIP_RETURN_CODE 77on hardware,FORM_COVERAGE_RECORDset): 8 compiles × 2 input sets, then five negative draws that must reportpixel_mismatch:v_lshl_add_u32→v_lshl_or_b32,v_add_lshl_u32→v_lshl_add_u32,v_and_or_b32→v_or3_b32,v_xad_u32→v_xor3_b32andv_add3_u32→v_xor3_b32.0x100000000, unwritten registers; rejection of the neighbouringv_alignbit_b32,v_alignbyte_b32,v_perm_b32,v_mad_u32_u24,v_mad_u32_u16,v_sad_u32,v_lerp_u8andv_mul_lo_u32; rejection of reads beforevmcnt(0)/lgkmcnt(0)and use under WQM.tests/pixel_aot_check.py binaryround-trips the fixture for results 0 and 7.tests/form_coverage_check.pyasserts the eight VOP3 forms are counted in bothgfx1013.tsvandrdna2.tsv(exactly 8 more covered forms) and the eight rejected neighbours stay out.docs/experiments.md#offline-pixel-shader-recompilationdescribes the forms, the fixture, the negative controls and the new tests.Verification
tests/pixel_aot_check.py binary ...passes (disassembled fixture lowers to the same HLSL as the source text); controls,form_coverage_check,rdna2_tools_check,pso_readiness_check,docs_links_checkandbidi_controls_checkpass.tools/pixel_aot.pyfrommain,tests/pixel_aot_check.pyandtests/form_coverage_check.pyfail withValueError: Unsupported instruction 22: v_lshl_add_u32 v20, s44, s47, v19.uintsemantics matchesint3_referencefor all 8 variants and both input sets.int3_referencefor both input sets, and all five negative draws reportpixel_mismatch, on the RTX 5080 and on WARP.ctest --preset dev --no-tests=error -R '^pixel_aot_(int3_(hardware|warp)|hardware|warp)$' -Vatd8246c4on Windows 11 build 26200.9974, VS Build Tools 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100: 4/4 passed.pixel_aot_int3_hardwareon an NVIDIA GeForce RTX 5080 (driver 32.0.16.1692) took 5.9 s andpixel_aot_int3_warp1.4 s;pixel_aot_hardwareandpixel_aot_warpstill pass. The D3D12 debug layer was not available. The fullctest --preset dev --no-tests=errorpassed 238/238, withbvh_wave64_hardware,bvh_wave64_warpandwave_shuffle_warpskipped.Evidence and follow-up
v_alignbit_b32,v_alignbyte_b32,v_perm_b32,v_mad_u32_u24/v_mad_i32_i24,v_mul_lo_u32/v_mul_hi_u32,v_sad_*,v_lerp_u8andv_mbcnt_*. Bit counts and scans are in open #436.Lower v_lshl_add_u32, v_add_lshl_u32, v_lshl_or_b32, v_and_or_b32, v_or3_b32, v_xor3_b32, v_xad_u32 and v_add3_u32 to one HLSL uint expression each, with wrapping sums and five-bit shift counts. A byte-export fixture draws every result for two input sets against an independent CPU reference, with neighbour substitutions that must mismatch. The draws run as pixel_aot_int3_{hardware,warp}. The controls reject source modifiers, clamp, pending reads and neighbouring VOP3 integer forms, and the coverage check asserts the eight forms are counted in gfx1013 and rdna2.@R0Y00 on GitHub · 2026-11-23 21:58 UTC · original
All eight ternary 32-bit forms landed in #766 with LLVM 15 binary round-trip, WARP and hardware readback, and mutation controls. I verified the same eight names in main. Closing the duplicate implementation and keeping this branch available. The pending-load and opcode-substitution controls here are useful reference material for a focused test follow-up if they expose a gap in the current suite.
Pull request closed