Repository navigation
Description
Part of #870. In a local startup run on current main (RX 9070 XT, the post-confirm load), tools/startup/gfx2hlsl.py --pending refuses 12 pipeline requests with unsupported: v_cmpx_le_i32_sdwa. compare() rejects every compare with an _sdwa suffix. tools/disasm_rdna2.py already decodes VOPC SDWA in full (_decode_vopc_sdwa), and pixel_aot lowers only the f32 form with DWORD selects.
Forms in those refused pixel programs. Aggregate count per form, with operands reduced to their kind:
| Count | Form |
|---|---|
| 12 | v_cmpx_le_i32_sdwa <const>, sext(vN) src0_sel:DWORD src1_sel:BYTE_0 |
| 3 | v_cmpx_ne_i32_sdwa sN, vN src0_sel:DWORD src1_sel:BYTE_0 |
| 9 | v_cmp_ne_i32_sdwa sN, sN, vN src0_sel:DWORD src1_sel:BYTE_0 |
| 12 | v_cmpx_class_f32_sdwa <const>, vN src0_sel:DWORD src1_sel:BYTE_1 |
| 39 | v_cmp_class_f32_sdwa sN, <const or sN>, vN src0_sel:DWORD src1_sel:BYTE_1 or WORD_1 |
The translator stops at the first refusal, so the later forms in the same programs are hidden today. The _class_ forms also need v_cmp_class_f32 itself, which compare() 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 _sdwa forms of the existing compare table:
- Operand selects: i32/u32 sources take
src0_sel/src1_selthrough the existingsdwa_sourcehelper, withsext()when printed. - f32 sources: keep DWORD selects only and refuse any other select.
- Destination: EXEC for
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. - Refused:
class, float sources with a non-DWORD select, and any SDWA modifier the decoder does not print for compares.
Acceptance
- Translator check against a reference (in the style of
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. - LLVM 15 round trip: encode and decode for the accepted forms.
- Refusal cases: class, a non-DWORD select on an f32 compare, and an unexpected modifier.
- Draw on WARP and the RX 9070 XT: a source-built pixel program where a
v_cmpx_le_i32_sdwaon a sign-extended byte decides which pixels survive, checked pixel by pixel. - Negative controls: a translation that ignores the select, and one that ignores
sext, must both fail the draw. - Recount on our loading path: report the same run's refusal counts again, aggregate only.
I'd like to take this; PR to follow.
AI-assisted.
Activity
MasterDomino commentedon Nov 24, 2026
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.
startup: keep VOPC SDWA compares integer-only in gfx2hlsl
startup: lower VOPC SDWA compares in gfx2hlsl
R0Y00 commentedon Nov 24, 2026
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 commentedon Nov 24, 2026
#1969 is on main at 9dcf1ae. 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 commentedon Nov 25, 2026
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; startup: add the SDWA forms of v_cmp_class_f16 in gfx2hlsl #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 commentedon Nov 25, 2026
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 startup: lower gfx2hlsl f32 lg/nlg compares as ordered #1930/startup: keep gfx2hlsl f32 n-forms, o and u exact under FXC and DXC #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.
startup: lower gfx2hlsl f32 SDWA compares with DWORD selections (#2212)