shader: lower compute v_xor3_b32 #1566
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1573"
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 Asimmimx on 2026-11-24T14:30:39Z.
Change
Refs #1546. This lowers
v_xor3_b32in the compute translator,tools/compute_store_aot.py.v_xor3_b32 vD, a, b, cbecomes(a ^ b ^ c), following the RDNA2 ISA definition of VOP3 opcode 0x178 (D.u = S0.u ^ S1.u ^ S2.u).It joins the existing integer ALU subset: one
ALUentry, and the opcode appended to the three-source matcher group(v_mad_u32_u24|v_xor3_b32). Sources are those the subset already accepts: a VGPR, an SGPR holding a known word, an inline constant or a 32-bit literal. The result is data only.The fixture and controls are in a new
tests/compute_alu_xor3_check.py, which imports the helpers oftests/compute_store_check.py. That file is unchanged.Fixture. It is
READ_COMPUTEwith thev_min_u32line replaced by two instructions:The sources therefore cover a result, the dispatch index, an SGPR constant, a literal and a negative inline constant. The expected words come from an independent Python model of the definition, and lane 0 is pinned by hand at
0x2d574c65. The fixture runs the three read dispatches (0, 17 and 150 lanes) and compares all 320 words.Three sets of checks must fail:
+16in place of-16; one word off; a lane past the bound. Each must fail at its first differing word.Unsupported compute instructionforv_or3_b32,v_xad_u32,v_xor3_b32_e64, the-v1/|v1|/neg(s0)/clampforms, av[2:3]destination, a fourth source, and sources that are not known words;Unverified ALU operandfor av256destination;Unsupported store addressandUnsupported read addresswhen the result is used as an address;Unverified lane guard comparewhen the result is a guard operand;ALU expression too largefor a long chain.The new CTest
compute_store_aot_alu_xor3_${adapter}is registered aftercompute_store_aot_mubuf_d16. A "Three-input XOR" subsection is added todocs/experiments.md.Verification
Commit
6c0e5380(main) plus this change,devpreset, Windows 11 Pro build 26300.9974, DXC 1.8.2502.11.1002:73ff), driver 32.0.21045.29003, debug layer enabledRegression with the change:
compute_store_checkcontrols (alu_controls,scalar_alu_controls,f32_controls),draw-guard-readanddraw-f32on WARP, and thecompile-mimg-atomic-*modes all pass.tests/docs_links_check.py,tests/bidi_controls_check.pyandgit diff --checkpass.Notes
and None not in [...]guard, which letsv_mad_u32_u24fall through to its row-pitch case. Av_xor3_b32with an unknown source therefore stops withUnsupported compute instruction: …rather thanUnverified ALU operand. I left the shared matcher unchanged.READ_VOP2. Its encodings were checked withllvm-mc19 (-mcpu=gfx1013). No LLVM 15 binary round trip is wired for it.Checklist
AI-assisted (Claude Code).