startup: translate the SDWA forms of the float-result conversions again #1723
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1730"
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 triggered02 on 2026-11-24T17:54:38Z.
Follow-up to the merged #1707, fixing the review's P1 (SDWA forms of the moved conversions stopped translating). Reported by tedin7 after the merge.
Cause
Moving the float-result conversions into
VEC_U_TO_Fleftsdwa()looking only atVEC_U:so
v_cvt_f32_u32_sdwa,v_cvt_f32_i32_sdwa,v_cvt_f32_f16_sdwa,v_cvt_f32_ubyte0..3_sdwawere all refused on the merged tree.Fix
sdwa()accepts both tables and wraps a float result inU(...)before the destination selection writes its bit pattern; integer-result conversions keep the uint path unchanged.Destination selection still writes the result:
dst_sel:BYTE_1masks to& 0xffu) << 8u,dst_unused:UNUSED_PRESERVEreadsasuint(v0). An output modifier inside an SDWA form stays refused rather than dropped.Test
startup_gfx2hlsl_sdwa_cvtbuilds VOP1 SDWA encodings from the checked-in decoder's layout (SRC0 = 249marks SDWA, control word in the next dword:src0_sel[18:16],dst_sel[10:8],dst_unused[12:11],omod[15:14]), decodes them, then translates — no game-derived bytes.Fail-first: removing the
VEC_U_TO_Fbranch fromsdwa()fails the test withUnsupported: SDWA form of v_cvt_f32_u32.Still open from that review
The P2 (claiming
op_selis refused whileset_vf()silently ignores it) is not in this PR — that guard changes every float path that goes throughset_vf, so it needs its own test sweep rather than riding along a regression fix. Tracked as the next slice.What this does not establish
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:57:36Z.
Review: COMMENTED
Review of head
e6a0cd79c1cedc76482e9acf3b3c1f11342599c7(1 commit;tools/startup/gfx2hlsl.py+10/-2, newtests/startup_gfx2hlsl_sdwa_cvt_check.py+128,CMakeLists.txt+3,docs/experiments.md+5).Linux limits. Linux x86_64,
llvm-mc-19, Python 3.14. No CMake configure and noctest(thestartup_gfx2hlsl_sdwa_cvtregistration is unexercised), no Windows, no DXC, no WARP or GPU. The translated HLSL is compared as text and was never compiled or run, so the arithmetic is judged by reading the emitted expressions.What I ran
python3 -B tests/startup_gfx2hlsl_sdwa_cvt_check.py: PASS. Also exit 0:startup_gfx2hlsl_sdwa_check.py,startup_gfx2hlsl_vcvt_omod_check.py,startup_translator_check.py,startup_gfx2hlsl_bit_alu_check.py.git diff --check origin/main...HEAD: clean (no non-ASCII added, no lines removed from existing tests).tests/docs_links_check.pyandtests/bidi_controls_check.py: pass.git merge-treeagainst current main: no conflicts.encode_vop1_sdwa(). I assembled the same six instructions withllvm-mc-19 -show-encodingfor bothgfx1030andgfx1013(v_cvt_f32_u32 WORD_0, v_cvt_f32_i32 BYTE_0, v_cvt_f32_f16 WORD_0, v_cvt_f32_u32 BYTE_1 into BYTE_1 with UNUSED_PRESERVE, v_cvt_f16_f32 WORD_0, v_cvt_f32_u32 withmul:2): all twelve encodings are byte-identical to the encoder.clamp(bit 13), source negate (bit 20) and abs (bit 21) are refused (SDWA modifier clamp,operand '-v1',operand '|v1|');sexton the u32 source lowers tofloat(asuint(asint(v1 << 16u) >> 16u)), i.e. sign-extend the field then convert as unsigned, as the ISA describes.sdwa(), each run against the new test and restored (git statusclean):U(...)wrapper: FAIL (4 mismatches).SDWA form of v_cvt_f32_u32).uint-result conversion stays on the uint path).an omod on an SDWA conversion stays refused).Semantics (RDNA 2 SDWA)
dst_sel/dst_unusedwrite are in the right order: the float result is bit-cast withU()and only then masked and shifted into the destination field, which is what an SDWA destination selection does to a 32-bit result.UNUSED_PRESERVEkeeps the other bits;UNUSED_SEXTis still refused.clampinside an SDWA form are refused instead of being dropped, which is the safe boundary (dropping them would silently change the value).Findings: 0 P1, 0 P2, 2 nits
sdwa()still says "float forms are not lowered yet"; it is now wrong for the float-result conversions.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T17:54:56Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
e6a0cd7ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
offform when its data is proven wave-uniform #2643