shader: lower the plain VOP1/VOP3 v_movrel* forms in pixel_aot #1778
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1785"
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-24T18:38:28Z.
Refs #1739. I built this before the issue had a maintainer reply; if you want the scope narrowed, I'll adjust.
What
tools/pixel_aot.pynow lowers the plain VOP1 (_e32) and VOP3 (_e64) encodings of the four relative VGPR-indexing moves:v_movreld_b32,v_movrels_b32,v_movrelsd_b32,v_movrelsd_2_b32;v_movrels_b32_e32 v12, v24/_e64for both gfx1013 and gfx1030. I checked this withLLVMDisasmInstructionon both targets: words7e1885/87/89/91…andd5c2/c3/c4/c8….They go through the existing DPP movrel block (
PLAIN_MOVREL_PATTERN). The block uses the samem0indexing with no quad swizzle (perm=None), so each lane reads and writes its own VGPRs. Everything else is the DPP forms' code:m0;The DPP path is unchanged: its
op == "…_dpp"comparisons becamekind == …, withkind == opfor DPP. Refusal messages for the plain forms name the plain instruction, for exampleUnsupported m0 value for v_movrels_b32.Not in this PR:
v_swaprel_b32, the SDWA forms and the scalars_movrel*.Evidence
PLAIN_MOVREL_BODY(tests/pixel_aot_check.py) runs each move once with a dynamicm0and once with a staticm0. The dynamicm0comes froms_bfe_u32, or froms_and_b64 … 0x30003forv_movrelsd_2.check_plain_movrel_drawdraws it twice: as written (_e32dynamic,_e64static), and with the spellings exchanged. So all eight forms run with both kinds ofm0, on the twoDPP_MOVREL_SETS. Their channel results differ between the sets: (60, 133, 805, 193) and (80, 84, 233, 165).pixel_mismatch:m0replaced by 0, separately forv_movrels,v_movreldandv_movrelsd;m0halves swapped forv_movrelsd_2(0x20001→0x10002).pixel_aot_check.pyrun:dpp_soff/dpp_doff) and noQuadRead;v_movrelsd_2_b32_e32 v12, v12;interp_basem0, an unbounded dynamicm0, a static offset past v255, an indexed VGPR past v255, and an undefined indexed source.check_binaryfixture list.Windows 11 Pro 26100.9168, DXC 10.0.26100, debug layer unavailable, commit
eef8bc21onb4c961cd:Other runs:
pixel_aot_dpp_movrel_{warp,hardware}still pass.python -B tests/pixel_aot_check.py(controls) exits 0.ctest --preset dev -E '_hardware$'before the rebase: 781/781.tools/form_coverage.py --gaps gfx1030no longer lists the eight VOP1/VOP3 movrel forms.Not run locally:
tests/pixel_aot_check.py binary. This PC has nollvm-mc, so the LLVM 15 assemble/disassemble round trip of the new bodies relies on the Ubuntu job.🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-24T18:51:34Z.
Review: APPROVED
Overview
Excellent PR. The approach of normalizing through
kindto reuse the DPP movrel indexing logic is elegant, and the test coverage is outstanding for a 199-line change.Specific observations
kind = op if op.endswith("_dpp") else f"{op}_dpp"correctly maps plain forms to the same indexing rule. The subsequentkind == "v_movreld_b32_dpp"checks then work for both encodings without duplication.v_movrels,v_movreld,v_movrelsd,v_movrelsd_2) with distinct m0 sources, and both constant sets produce different channel outputs to catch incorrect indexing._e32and_e64are hardware-interchangeable for these instructions.v_swaprel_b32, SDWA forms,s_movrel*) are well-documented.Minor notes
docs/experiments.mdentry is dense but matches the existing style.Verdict
No blocking issues. Scope is well-contained -- 4 instruction encodings with ~20 lines of code changes. Ready to merge.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T18:50:06Z.
This PR currently has merge conflicts with
mainateef8bc2113bb08253313ad1e8648e9b414f26fdb; could you please rebase it onto the latestmainso we can verify and review it?AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:29:49Z.
Review: COMMENTED
Review of
eef8bc21(head of this PR). Comment only, no approval.Verdict: no correctness problems found. One test gap (P3) and one note.
Semantics (tools/pixel_aot.py). The plain
_e32/_e64forms are routed into the existing DPP movrel code by mapping the op to its_dppname (kind). So the indexing is the same code the DPP forms already use:v_movreldwrites VGPR[dst + m0],v_movrelsreads VGPR[src + m0],v_movrelsddoes both,v_movrelsd_2reads with m0[9:0] and writes with m0[25:16]. That matches the public RDNA 2 ISA text the PR cites. Operand order (dst first, src second), the 0..255 base check, the static and bounded-dynamic m0 rules and the read-all-sources-before-any-write rule are all inherited unchanged. With no swizzle the source is used asasuint(vN), a bit-exact copy. The regex only matches two plain VGPR operands, soe64spellings with a source modifier, clamp or omod do not match and fall to the generic refusal.plainis only read in the branch where it was assigned (walrus in theor), so there is no unbound-name path.Commands run locally (worktree at the exact SHA above, Linux)
python3 -B tests/pixel_aot_check.py(no arguments, the device-free controls): passed.python3 -B tests/rdna2_tools_check.py: 148 tests, OK (18 skipped).git diff --check origin/main...HEAD,tests/docs_links_check.py(17 files, 366 links),tests/bidi_controls_check.py: clean.tools/pixel_aot.py, each followed by the controls and then reverted withgit checkout -- .(tree clean afterwards):v_movrelsstatic branch swapped to write instead of read: caught (Unbound vector operand v33).Expected a numeric VGPR at v32).raiseattools/pixel_aot.py:5191removed): not caught, controls still pass.P3 – missing control. The plain branch has its own
mask != "entry"refusal attools/pixel_aot.py:5191, but no control exercises it, as the mutation above shows. The docs say the mask refusals are "shared with the DPP forms", which is true of the DPP message at line 5183 but not of this new line. One short control (a plainv_movrels_b32_e32inside a non-entry exec region, expectingoutside entry mask) would cover it.Note. The control list does not include an
_e64form with a modifier or an SGPR operand. I believe the regex refuses them, but I did not add a probe.Not run by me:
pixel_aot_plain_movrel_{warp,hardware}(needs Windows with DXC andoffscreen_check); I rely on the PR text for the GPU results.AI-assisted; commands listed were executed locally.