shader: lower compute v_max3_u32 and v_min3_u32 #1567
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1574"
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:31:34Z.
Change
Refs #1546. This adds
v_max3_u32andv_min3_u32to the compute translator (tools/compute_store_aot.py):v_max3_u32 vD, a, b, c→max(max(a, b), c)v_min3_u32 vD, a, b, c→min(min(a, b), c)These are the unsigned maximum and minimum of three sources, as
V_MAX3_U32/V_MIN3_U32(VOP3A) define them in the RDNA2 ISA. Every operand in the generated HLSL isuint-typed (literals with ausuffix,inputData.Load,tid.x,params[]), somaxandmincompare unsigned.The translator change is two
ALUentries plus the two opcodes appended to the three-source matcher group(v_mad_u32_u24|v_max3_u32|v_min3_u32). The fixture and controls live in a newtests/compute_alu_minmax3_check.py, which imports the helpers oftests/compute_store_check.pyand leaves that file unchanged.Fixture. It is a variant of
READ_COMPUTE:0x8b02a7f1to0x8d621df6, anddfalls on both sides of0x80000000. A signed comparison would change 73 of the 150 lanes for each operation.0x8c000000, min3 =0x89134629, XOR =0x05134629.Controls.
controlsmode pins the exact HLSL and refuses 18 forms with the existing messages:v_max3_i32,v_min3_i32,v_max3_u16,v_min3_u16;clamp, an|v1|source, av[1:2]range or a missing third source;v256destination;The new CTest is
compute_store_aot_alu_minmax3_${adapter}, aftercompute_store_aot_mubuf_reduction. A new "Unsigned three-source maximum and minimum" subsection goes indocs/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,draw-guard-readon WARP and thecompile-mimg-atomic-*modes pass.tests/docs_links_check.py,tests/bidi_controls_check.pyandgit diff --checkpass.Notes
v_mad_u32_u24fall through to its row-pitch case. As a result, an unknown source here stops withUnsupported compute instruction: …, notUnverified ALU operand.READ_VOP2style. Its encodings were checked withllvm-mc19 only.v_xor3_b32) appends to the same matcher group. Whichever of the two lands second needs a trivial rebase, which I will do.Checklist
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T15:27:13Z.
Resolved the shared compute matcher conflict in
158626c9. The combined Windows Release build passed both min/max3 and XOR3 on RTX and WARP (4/4, zero skips).upstream-sync referenced this pull request2026-11-24 18:02:49 +00:00