shader: lower v_swaprel_b32 with the movrel m0 indexing in pixel_aot #1837
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1844"
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-24T19:23:21Z.
Refs #1795. This builds on #1785: the first commit (
eef8bc21) is #1785's, and only 52c31b09 is new. Please merge after #1785; I'll rebase once it lands.What
tools/pixel_aot.pylowersv_swaprel_b32 vdst, vsrc(VOP1 only; LLVM 15 decodes7e18d118asv_swaprel_b32 v12, v24for gfx1013 and gfx1030).VGPR[vdst + m0[25:16]]andVGPR[vsrc + m0[9:0]], the same split asv_movrelsd_2_b32. This is an assumption from the RDNA 2 naming and LLVM's definition. It has not been measured on RDNA hardware (I have none); a correction is welcome.m0rules and refusals of the movrel forms: static, or dynamic with a proven bit mask, which lowers to bounded selects on both sides.Existing tests changed (please check)
Two checks pinned
v_swaprel_b32as untranslated:tests/form_coverage_check.py::check_swap_coveragenow requiresv_swaprel_b32to be accepted and covered. A new control requires it to be uncovered without its own word, next to the existingv_swap_b32control.tests/rdna2_tools_check.py: only a comment changes. The scanner's static tables still listv_swaprel_b32as untranslated, and the test stays green (148 tests OK).Evidence
SWAPREL_BODYruns the following, against an independent list-swap reference on the twoDPP_MOVREL_SETS:m0 = word3 & 0x30003, which differs between the sets;m0 = 0x30001);0x20002);0x20001).The bank sums are 816, 117, 338, 125 and 218, 128, 338, 125.
Controls (
pixel_mismatchrequired):v_movrelsd_2_b32_e32in place of the dynamic swap;m0halves;m0replaced by 0.Translation controls:
interp_basem0, anm0from an unbounded SGPR, an unbounded dynamicm0(s_add_u32), a static offset past v255, an index past v255, and an undefined register.Windows 11 Pro 26100.9168, DXC 10.0.26100, debug layer unavailable, commit 52c31b09:
Other runs:
python -B tests/pixel_aot_check.py(controls) exits 0.python -B tests/form_coverage_check.pypasses.python -B tests/rdna2_tools_check.py: 148 OK.ctest --preset dev -E '_hardware$': 782/785. The three failures werepixel_aot_warp,pixel_aot_buffer_color_warpandpixel_aot_three_way_warp, which timed out under-j 4and pass when run alone (3/3).tools/form_coverage.py --gaps gfx1030no longer listsv_swaprel_b32.Not run locally:
tests/pixel_aot_check.py binary, because there is nollvm-mchere.🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:38:14Z.
Review: COMMENTED
Peer review of head
7a75c9ab72ebb12b25a34e0ca22cbc88cf4b110f(PRODUCTION_REVIEW_ONLY, technical comment only).No P1 and no semantic defect found in the lowering. One P2 on how much of it the Linux-side check pins, plus a request for Windows evidence.
Lowering (tools/pixel_aot.py,
v_swaprel_b32branch and the plainv_movrel*branch): read in full, no defect.swap_sval/swap_dvalbefore any register is rewritten, so overlapping banks and a swap of a register with itself are correct. I traced the emitted code for the dynamic case (SWAPREL_BODY) and for the static cases0x30001,0x20002and0x20001; each register gets the right value.m0, static offset past 255, indexed VGPR past v255, undefined indexed source, outstanding sample.kindand skip only the quad swizzle (perm is None). The regex requires exactly two VGPR operands, so any extra modifier text is refused rather than dropped. The_dpppath is unchanged.v_swaprel_b32 v12, v24as0x7e18d118.P2: the Linux-mode
tests/pixel_aot_check.pydoes not pin the swap's values.In the no-argument mode the new checks are text assertions (
"swap_doff" in ...,"dpp_soff" in ...) and refusal controls. The value checks are thedraw-swaprelanddraw-plain-movrelmodes, which need dxc and a D3D12 adapter. I applied one-line mutations totools/pixel_aot.py, one at a time, and ran the check with no arguments. The check returned rc=0 for these four:swap_svalinstead ofswap_dvalfor the source-side registers[m0_u & 0x3ff]and[(m0_u >> 16) & 0x3ff]exchanged)m0_mask >> 16value = value)It returned rc=1 for one: forcing
kindtov_movrels_b32_dpp(the m0 range error).These escape the Linux run, so the swap semantics are guarded only by the Windows draw tests (
pixel_aot_swaprel_warp,pixel_aot_plain_movrel_warp). I could not run those here. The PR text says the mutation controls mismatch on WARP and on a discrete adapter; I could not confirm that. A CI-visible Linux value check would help: for example, evaluate the emittedswap_*/alu*_r*lines on a few register states in Python, as the cmp_class check now does for its helper.Request: run the two WARP tests above on Windows Server 2025, and apply at least the first two mutations above through the Windows run to show they fail there.
Other checks:
tests/form_coverage_check.py, the newv_swaprel_b32accepted-word control: pass.main(8e2923ae) has no content conflicts (git merge-tree).binary llvm-mc-19 ...modes ofpixel_aot_check.pyandrdna2_tools_check.pyfail with the same assertions on the PR's merge base (for examplev_cvt_f16_i16_e32 v1, 0xfff0decodes differently), so they are not caused by this PR. They expect a different assembler version, so the binary round trip of the three new fixtures was not exercised here.Commands run (Linux):
git diff --check <merge-base>...HEAD: cleantests/docs_links_check.py: pass (18 files, 370 links)tests/bidi_controls_check.py: passtests/pixel_aot_check.py: passtests/rdna2_tools_check.py: pass (148 tests, 18 skipped)tests/form_coverage_check.py: passtests/pixel_aot_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.soandtests/rdna2_tools_check.py binary ...: fail identically on the merge base (see above)llvm-mc-19 -triple=amdgcn -mcpu=gfx1030 -show-encodingon the three new spellingsgit checkout -- .AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:47:17Z.
Review: COMMENTED
Follow-up Win2025 verification on head
7a75c9ab72ebb12b25a34e0ca22cbc88cf4b110f:--preset dev):ctest --preset dev -R '^(pixel_aot_swaprel_warp|pixel_aot_plain_movrel_warp|pixel_aot_warp|rdna2_tools_check)$'— 4/4 passed (pixel_aot_swaprel_warp4.57s,pixel_aot_plain_movrel_warp6.55s,rdna2_tools_check11.77s,pixel_aot_warp14.71s)./O2(--preset release): 4/4 passed (pixel_aot_swaprel_warp3.33s,pixel_aot_plain_movrel_warp6.38s,rdna2_tools_check10.99s,pixel_aot_warp14.26s).tests/pixel_aot_check.pyok (9.9s),tests/form_coverage_check.pyok (17.0s).v_swaprel_b32m0shift>> 16->>> 17intools/pixel_aot.pyfailed cleanly (rc=1,tests/form_coverage_check.pyrc=1).No P1/P2 defects found.
AI-assisted; commands listed were executed locally.