shader: lower v_swap_b32 in pixel_aot #765
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/771"
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 JB2WIN on 2026-11-23T01:59:48Z.
Change
tools/pixel_aot.pynow lowers VOP1v_swap_b32 vD, vS, with an optional_e32suffix. The two VGPRs exchange their old values. Every vector entry names an immutableprecise floattemporary, so the lowering swaps the two tracked entries and emits no HLSL. A self swap is a no-op.v_swap_b32 v1, v2encodes as[0x02,0xcb,0x02,0x7e]._e64, DPP, SDWA, modifiers, SGPR operands andv256;v_swap_b32(?:_e32)? vD, vSwas added, and the opcode is now in the known VOP1 set.AI-assisted (Claude Code).
Verification
Environment: Windows 11 10.0.26200.9974, NVIDIA GeForce RTX 3080 (driver 32.0.16.2124) and WARP 10.0.26100.9818. The D3D12 debug layer was enabled. Head is rebased on
f714d2f.New draw
draw-swap(pixel_aot_swap_{hardware,warp}). The program moves s44..s47 into v18..v21 and then runs three swaps:Each export is read back at full width and compared against an independent Python reference. The words are normal binary32 bit patterns, because the values pass through float VGPRs.
Mutants: each must report a mismatch, and each does:
Python assertions before the draw check that every mutant changes the expected words.
Dev-time check (not committed): with the new branch removed, the controls fail.
Results:
ctest --preset dev --no-tests=error -R "^pixel_aot_swap_": 2/2 passed (4.5 s on hardware, 1.7 s on WARP).ctest --preset dev --no-tests=error -j4: 334 of 336 passed. Neither failure involves this change:pixel_aot_predicate_rounding_hardwaretimed out at 60 s. That mode is at or past its limit on this adapter onmain(see my note on #448).bvh_differential_warpfailed once under parallel load and passed when rerun on its own (0.25 s).bvh_wave64_hardware,bvh_wave64_warpandwave_shuffle_warp.tests/pixel_aot_check.py binarywith LLVM 15.0.7, using a localclang -cc1asshim forllvm-mc, exits 0.form_coverage_check.py,rdna2_tools_check.py,pso_readiness_check.pyanddocs_links_check.pyall pass.🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-23T02:36:34Z.
Semantics source: LLVM 15.0.7
VOP1Instructions.tdgivesV_SWAP_B32two VGPR outputs ($vdst,$vdst1) and two VGPR inputs, tied with"$vdst = $src1, $vdst1 = $src0". So each register receives the other's old value. The operand classes areVGPR_32only, and there is no VOP3 form (Asm64 = "",Ins64 = (ins)). That matches the refused SGPR,_e64, DPP and SDWA spellings here. On gfx10 it is encoded asVOP1Onlyopcode 0x065 (L815).