startup: gfx2hlsl refuses VOPC SDWA compares (v_cmp*_sdwa, v_cmpx*_sdwa) #1906
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#1906
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@MasterDomino on GitHub · 2026-11-24 20:44 UTC · original
Part of #870. In a local startup run on current
main(RX 9070 XT, the post-confirm load),tools/startup/gfx2hlsl.py --pendingrefuses 12 pipeline requests withunsupported: v_cmpx_le_i32_sdwa.compare()rejects every compare with an_sdwasuffix.tools/disasm_rdna2.pyalready decodes VOPC SDWA in full (_decode_vopc_sdwa), andpixel_aotlowers only the f32 form with DWORD selects.Forms in those refused pixel programs. Aggregate count per form, with operands reduced to their kind:
v_cmpx_le_i32_sdwa <const>, sext(vN) src0_sel:DWORD src1_sel:BYTE_0v_cmpx_ne_i32_sdwa sN, vN src0_sel:DWORD src1_sel:BYTE_0v_cmp_ne_i32_sdwa sN, sN, vN src0_sel:DWORD src1_sel:BYTE_0v_cmpx_class_f32_sdwa <const>, vN src0_sel:DWORD src1_sel:BYTE_1v_cmp_class_f32_sdwa sN, <const or sN>, vN src0_sel:DWORD src1_sel:BYTE_1 or WORD_1The translator stops at the first refusal, so the later forms in the same programs are hidden today. The
_class_forms also needv_cmp_class_f32itself, whichcompare()has no condition for (6 separate refusals in the same run). I'd keep that as its own follow-up.Proposed scope
compare()accepts the_sdwaforms of the existing compare table:src0_sel/src1_selthrough the existingsdwa_sourcehelper, withsext()when printed.v_cmpx_*_sdwa(gfx10 forbidssdst_enthere); VCC, or the SGPR pair the decoder prints, forv_cmp_*_sdwa. Same EXEC masking as the non-SDWA path.class, float sources with a non-DWORD select, and any SDWA modifier the decoder does not print for compares.Acceptance
startup_gfx2hlsl_sdwa_check.py). Every compare in the table × every select × sext on/off, with the source chosen so the selected field differs from the full DWORD. The result must equal an integer reference: the selected, extended field compared as the type says. This coversv_cmpinto VCC and into an SGPR pair, andv_cmpxinto EXEC.v_cmpx_le_i32_sdwaon a sign-extended byte decides which pixels survive, checked pixel by pixel.sext, must both fail the draw.I'd like to take this; PR to follow.
AI-assisted.
@MasterDomino on GitHub · 2026-11-24 21:06 UTC · original
PR: #1915. Reference check over every integer compare × destination × select × sext (9,408 forms × 64 value pairs) plus the f32 DWORD forms and the refusals; LLVM 15 decode of all 9,889 accepted forms; a source-built draw where
v_cmpx_le_i32_sdwaon a sign-extended byte decides which pixels survive — 256/256 on WARP and the RX 9070 XT with FXC and DXC, and the select-dropping and sext-dropping mutants fail (120 and 96 pixels). The llvm-mc encode mode runs in the CI LLVM 15 job (no llvm-mc locally). Recount on our loading path: the 12 requests now get past this refusal and stop at the next gap (s_nor_b32); class compares remain the follow-up.AI-assisted.
@R0Y00 on GitHub · 2026-11-24 21:26 UTC · original
The integer-only lowering in #1915 has merged. On the exact candidate the independent translator run passed 9,408 integer forms over 64 value pairs and refused all 720 f32 SDWA forms. The author reported that the 12 loading requests advanced to the next shader refusal, s_nor_b32. That result is a shader translation checkpoint. The main executable's measured slot 148 startup boundary is unchanged.
Keep float SDWA on this issue pending the independent predicate work in #1920. The scalar complement follow-up is already claimed in #1919.
@R0Y00 on GitHub · 2026-11-24 22:43 UTC · original
#1969 is on main at
9dcf1ae1. The binary32 class compare now selects the class mask from SRC1. Independent default FXC and DXC runs matched all 256 pixels on WARP and RTX 4060 Laptop, and bypassing the selector failed the class control. The ordinary f32 comparison predicates are still tracked here.@MasterDomino on GitHub · 2026-11-25 04:31 UTC · original
I'd like to take the f32 SDWA compares in
gfx2hlslthat #1915 left refused. Now that #1930 and #1949 are on main, every f32 predicate in the table is exact on NaN under default-flag FXC and DXC, so the SDWA forms can reuse it.Scope:
v_cmp_*_f32_sdwaandv_cmpx_*_f32_sdwawithsrc0_sel/src1_seland the SDWA neg/abs source modifiers.llvm-mcand LLVM's disassembler.v_cmp_class_f32_sdwastays out of scope; #2020 covers the f16 class forms.Tests:
startup_gfx2hlsl_f32_nan_check.py, applied to the SDWA forms.ps_5_1and DXCps_6_0on WARP and hardware.AI-assisted.
@MasterDomino on GitHub · 2026-11-25 05:23 UTC · original
PR: #2212 (
Refs #1906). It is narrower than my claim and corrects its semantics wording.src0_sel:DWORD src1_sel:DWORD, with any neg/abs, emits exactly the e64 text, including the #1930/#1949 NaN bit test on the registers. That covers 720 forms, checked over the 256 NaN/denormal pairs under IEEE, FXC-rewrite and DXC-fold models, and drawn with default-flag FXC and DXC on WARP and the RX 9070 XT.f32 SDWA byte/word selection depends on the binary32 denormal mode. That's all 34,560 such forms. My claim said a selected field "reads as binary32 bits ... as the ISA defines". The RDNA 2 ISA guide defines only the SDWAB fields, and the zero-extend-then-read-as-binary32 model comes from LLVM'sSIPeepholeSDWA. Under that model, the field is always +0 or a denormal, so the result depends only on the denormal mode, which gfx2hlsl doesn't read.pixel_aotrefuses the same forms.sext()on a float source (integer-only; LLVM 15 doesn't decode it), clamp/omod/dst_sel, and the class compares.AI-assisted.