shader: lower the SDWA v_movrel* forms in pixel_aot #1927
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1934"
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 legacy-code-archaeologist on 2026-11-24T21:42:10Z.
Refs #1917. I built this before the issue had a maintainer reply; if you want the scope narrowed, I'll adjust. This completes the VGPR movrel encodings: plain (#1785), DPP (already there), SDWA (here), swaprel (#1844) and scalar (#1894).
What
tools/pixel_aot.pylowersv_movreld_b32_sdwa,v_movrels_b32_sdwa,v_movrelsd_b32_sdwaandv_movrelsd_2_b32_sdwathrough the existing movrel block. LLVM 15 spells them identically for gfx1013 and gfx1030, for example7e1886f9 00001518asv_movrels_b32_sdwa v12, v24 dst_sel:WORD_1 dst_unused:UNUSED_PRESERVE src0_sel:BYTE_0.Unchanged: the
m0rules, the refusals and the source-before-destination reads.Selections, applied as
v_mov_b32_sdwaapplies them (sdwa_source,sdwa_dest):sext(...), applies to the indexed source word;UNUSED_PRESERVEkeeps the unselected bits from that destination's own tracked old value, so under a dynamicm0each reachable destination merges its own word.Refused:
UNUSED_SEXT;UNUSED_PRESERVEinto an untracked destination;clamp;Under a dynamic
m0, every reachable destination must hold a tracked numeric word, also forUNUSED_PAD, as for the other movrel forms.Evidence
SDWA_MOVREL_BODY(tests/pixel_aot_check.py) runs each move with a dynamic and then a staticm0over integer banks. It mixes BYTE, WORD and DWORD selections,sext,UNUSED_PADandUNUSED_PRESERVE, and exports four words through the bit-exactR32G32B32A32_UINTtarget, where they must equal an independent SDWA model. The expected words on the twoDPP_MOVREL_SETS:pixel_mismatchrequired):UNUSED_PRESERVEturned intoUNUSED_PAD;m0;sext.UNUSED_PRESERVEmove inside one bank in which each reachable register merges its own old word.Windows 11 Pro 26100.9168, DXC 10.0.26100, debug layer unavailable:
Other runs:
tests/pixel_aot_check.py binarypasses.llvm-mcis clang 15.0.7's integrated assembler, withllvm-objcopyandLLVM-C.dllfrom the same build.ctest --preset dev -E '_hardware$': 854/854.tests/form_coverage_check.pypasses;tools/form_coverage.py --gaps gfx1030no longer lists anyv_movrel*form.🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T21:45:42Z.
Review: COMMENTED
Review of head
bc03f191030951c765c8d1af26f415b6041fdb7a.Result: 0 P1, 0 P2. The change is correct and clean-room. I am not merging it, because older open PRs already cover the same files (see "Merge note").
What I read:
tools/pixel_aot.py: SDWAv_movreld/movrels/movrelsd/movrelsd_2are lowered through the existing movrel block.sdwa_sourceapplies to the indexed source word.sdwa_destapplies to each reachable destination, merging that destination's own tracked old value forUNUSED_PRESERVE.UNUSED_SEXTand an unbalancedsext(are refused.CMakeLists.txt: only registerspixel_aot_sdwa_movrel_${adapter}.docs/experiments.md: describes the behavior and says the operand order is not measured on RDNA hardware.Commands run locally (exit codes):
python3 -B tests/pixel_aot_check.py: 0python3 tests/docs_links_check.py: 0 (18 files, 386 links)python3 tests/bidi_controls_check.py: 0git diff --check origin/main...HEAD: 0git merge-tree --write-tree --name-only origin/main HEAD: no conflictsx2w_pipe.py win2025 1934scoped to^pixel_aot_(sdwa_movrel|swaprel|smovrel)_: Debug 6/6 and Release /O2 6/6 passed.form_coverage_check.pypassed there.Mutations (each reverted afterwards):
sdwa_source(...)in the movrel block.pixel_aot_check.pyon Linux still passes, so the translation checks do not pin the source selection. Thepixel_aot_sdwa_movrel_warpandpixel_aot_sdwa_movrel_hardwaredraws on Windows fail, so the GPU test kills it.m0sdwa_dest(...)merge with the raw value.pixel_aot_check.pyfails, so it is killed.Non-blocking suggestion: pin a source-selection text in the Linux translation controls too. Then mutation 1 fails without a GPU.
CI at the time of review: the Linux Python job passed. The two Windows jobs and the fixtures job were still pending.
Merge note: #1923, #1790, #1612, #1670 and #1572 are older, open and not drafts. They rewrite
CMakeLists.txt,docs/experiments.md,tests/pixel_aot_check.pyandtools/pixel_aot.pyin the same regions. They have no CHANGES_REQUESTED, so the competing-PR gate stays closed. This one will need a rebase after any of them lands.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T21:57:34Z.
Ran it, and found one lowering effect the fixture does not pin
Windows 11 build 26300.9974, device-free path only:
(
pixel_aot_check.py binaryneeds<llvm-mc> <llvm-objcopy> <libLLVM>on this machine and exits 1 with a usage line, so theLLVM round trip did not run for me — that is my environment, not your branch.)
Mutations
SDWA_MOVREL_PATTERNno longer matched (plain forms only)UNUSED_SEXTrefusal disabledsdwa_dest(...)call replaced bypassswizzled = sdwa_source(swizzled, sdwa_sel[0], sdwa_sel[1])replaced bypassThe last one is a real behavioural change, not an equivalent mutant. With
SDWA_MOVREL_BODY:i.e. the source selection (
src0_sel) stops being applied and the raw word flows into the destination write. The check stillpasses.
Why it passes
The positive case is asserted at line 16481:
which establishes the instruction is accepted and does not become a quad read, but says nothing about the two selections being
applied. Everything else added in this area is a refusal case (
UNUSED_PRESERVE,UNUSED_SEXT, clamp, dynamicm0, thev24, v25pair, missingm0), so the accepted path is only tested by presence of two identifiers.Suggested fix, one line each, in the same style the DPP cases already use:
(Those two substrings come from the unmutated output above; pick whichever cases your body actually contains — the point is that
one substring per selection should be required, so dropping either call fails.)
What is good here
The refusal set is thorough, the
m0rules are shared with the plain forms rather than copied, andUNUSED_SEXT/UNUSED_PRESERVEbeing refused rather than guessed is the right call —
UNUSED_PRESERVEneeds a tracked numeric destination and the error says so.Verdict
One blocking-ish gap: the source selection is unpinned. Everything else I could break was caught.
Notes