shader: lower the scalar s_movrel* moves in pixel_aot #1887

Merged
legacy-code-archaeologist merged 1 commit from upstream-pr/1894 into main 2026-11-24 20:33:44 +00:00
legacy-code-archaeologist commented 2026-11-24 20:26:37 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-24T20:26:37Z.


Refs #1882. I built this before the issue had a maintainer reply; if you want the scope narrowed, I'll adjust.

What

tools/pixel_aot.py lowers the five SOP1 relative moves: s_movrels_b32, s_movrels_b64, s_movreld_b32, s_movreld_b64 and s_movrelsd_2_b32. LLVM 15 decodes them identically for gfx1013 and gfx1030, for example be942e28 as s_movrels_b32 s20, s40.

  • Semantics:
    • They use the m0 split of the vector forms. s_movrels reads SGPR[src + m0], s_movreld writes SGPR[dst + m0], and s_movrelsd_2_b32 reads with m0[9:0] and writes with m0[25:16].
    • _b64 moves a pair, with m0 counted in dwords.
    • This follows the RDNA 2 naming and the vector forms. It has not been measured on RDNA hardware.
  • Static m0: the move is an s_mov from or to the indexed SGPR. The tracked value (constant, expression, descriptor or pointer word) and its bit mask carry over.
  • Dynamic m0 with a proven bit mask:
    • It becomes a bounded select over plain numeric SGPRs only, so no resource depends on a runtime index.
    • For s_movreld, each reachable destination keeps its old value unless selected.
  • Order: every source is read before any destination is written.
  • Refused:
    • an unbounded or non-numeric m0;
    • an index past s105;
    • an outstanding scalar load;
    • a symbolic source or destination under a dynamic m0;
    • a _b64 pair base that could be odd: a static odd offset, or a dynamic mask that allows bit 0.

Evidence

SMOVREL_BODY (tests/pixel_aot_check.py) moves cbuffer-indexed words with each form, static and dynamic, and exports weighted sums. On the two DPP_MOVREL_SETS these are 60, 67, 805, 193 and 80, 63, 244, 165, from an independent list reference.

  • Draw controls (pixel_mismatch required):
    • the dynamic m0 replaced by 0, separately for s_movrels_b32, s_movreld_b32 and s_movreld_b64;
    • swapped static halves for s_movrelsd_2_b32.
  • Translation controls, from the no-argument run:
    • Descriptor pointer: moving the texture descriptor pointer with s_movrels_b64 s[72:73], s[16:17] (m0 = 4) translates exactly like two s_mov_b32.
    • Overlaps: checked through the exported constants. Cases: a self-move, a pair read from an overlapping pair, s_movrelsd_2 within one bank, a pair shifted inside one bank, and an odd overlapping pair, which is refused.
    • Dynamic s_movreld whose source lies in its own destination bank: the generated selects must write the source's old value.
    • Ten refusals, including the outstanding-load case, which places the move between the constant s_buffer_load and its s_waitcnt.

Windows 11 Pro 26100.9168, DXC 10.0.26100, debug layer unavailable, commit cc98d047 on b80058f0:

ctest --preset dev --no-tests=error -R "^pixel_aot_smovrel_" -V
Adapter Driver Result
WARP 10.0.26100.8972 4096 pixels, max error 0, both sets; all 4 controls mismatched
NVIDIA Quadro M1000M 32.0.15.7371 same

Other runs:

  • Full ctest --preset dev -E '_hardware$' before the review fixes: 818/818.
  • After the review fixes and the rebase:
    • the pixel_aot_smovrel, _swaprel and _plain_movrel draws pass;
    • the no-argument controls exit 0;
    • tests/form_coverage_check.py and tests/rdna2_tools_check.py pass.
  • tools/form_coverage.py --gaps gfx1030 no longer lists the five forms.

LLVM 15 round trip, run locally afterwards:

  • tests/pixel_aot_check.py binary passes with LLVM 15.0.7. llvm-mc is clang 15.0.7's integrated assembler (clang -cc1as), with llvm-objcopy and LLVM-C.dll from the same build.
  • A counter-check confirms the round trip covers the new fixture: with one SMOVREL_BODY operand changed to a VGPR (s_movrels_b32 s71, v60), the run fails with invalid operand for instruction.
  • tests/rdna2_tools_check.py with LLVM_LIB/LLVM_MC/LLVM_OBJCOPY set: 148 tests OK, 1 skipped.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6590743539 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1894). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-24T20:26:37Z. --- Refs #1882. I built this before the issue had a maintainer reply; if you want the scope narrowed, I'll adjust. ## What `tools/pixel_aot.py` lowers the five SOP1 relative moves: `s_movrels_b32`, `s_movrels_b64`, `s_movreld_b32`, `s_movreld_b64` and `s_movrelsd_2_b32`. LLVM 15 decodes them identically for gfx1013 and gfx1030, for example `be942e28` as `s_movrels_b32 s20, s40`. - **Semantics:** - They use the `m0` split of the vector forms. `s_movrels` reads `SGPR[src + m0]`, `s_movreld` writes `SGPR[dst + m0]`, and `s_movrelsd_2_b32` reads with `m0[9:0]` and writes with `m0[25:16]`. - `_b64` moves a pair, with `m0` counted in dwords. - This follows the RDNA 2 naming and the vector forms. **It has not been measured on RDNA hardware.** - **Static `m0`:** the move is an `s_mov` from or to the indexed SGPR. The tracked value (constant, expression, descriptor or pointer word) and its bit mask carry over. - **Dynamic `m0` with a proven bit mask:** - It becomes a bounded select over plain numeric SGPRs only, so no resource depends on a runtime index. - For `s_movreld`, each reachable destination keeps its old value unless selected. - **Order:** every source is read before any destination is written. - **Refused:** - an unbounded or non-numeric `m0`; - an index past s105; - an outstanding scalar load; - a symbolic source or destination under a dynamic `m0`; - a `_b64` pair base that could be odd: a static odd offset, or a dynamic mask that allows bit 0. ## Evidence `SMOVREL_BODY` (`tests/pixel_aot_check.py`) moves cbuffer-indexed words with each form, static and dynamic, and exports weighted sums. On the two `DPP_MOVREL_SETS` these are 60, 67, 805, 193 and 80, 63, 244, 165, from an independent list reference. - **Draw controls** (`pixel_mismatch` required): - the dynamic `m0` replaced by 0, separately for `s_movrels_b32`, `s_movreld_b32` and `s_movreld_b64`; - swapped static halves for `s_movrelsd_2_b32`. - **Translation controls**, from the no-argument run: - **Descriptor pointer:** moving the texture descriptor pointer with `s_movrels_b64 s[72:73], s[16:17]` (`m0 = 4`) translates exactly like two `s_mov_b32`. - **Overlaps:** checked through the exported constants. Cases: a self-move, a pair read from an overlapping pair, `s_movrelsd_2` within one bank, a pair shifted inside one bank, and an odd overlapping pair, which is refused. - **Dynamic `s_movreld`** whose source lies in its own destination bank: the generated selects must write the source's old value. - **Ten refusals**, including the outstanding-load case, which places the move between the constant `s_buffer_load` and its `s_waitcnt`. Windows 11 Pro 26100.9168, DXC 10.0.26100, debug layer unavailable, commit cc98d047 on b80058f0: ``` ctest --preset dev --no-tests=error -R "^pixel_aot_smovrel_" -V ``` | Adapter | Driver | Result | |---|---|---| | WARP | 10.0.26100.8972 | 4096 pixels, max error 0, both sets; all 4 controls mismatched | | NVIDIA Quadro M1000M | 32.0.15.7371 | same | **Other runs:** - Full `ctest --preset dev -E '_hardware$'` before the review fixes: 818/818. - After the review fixes and the rebase: - the `pixel_aot_smovrel`, `_swaprel` and `_plain_movrel` draws pass; - the no-argument controls exit 0; - `tests/form_coverage_check.py` and `tests/rdna2_tools_check.py` pass. - `tools/form_coverage.py --gaps gfx1030` no longer lists the five forms. **LLVM 15 round trip, run locally afterwards:** - `tests/pixel_aot_check.py binary` passes with LLVM 15.0.7. `llvm-mc` is clang 15.0.7's integrated assembler (`clang -cc1as`), with `llvm-objcopy` and `LLVM-C.dll` from the same build. - A counter-check confirms the round trip covers the new fixture: with one `SMOVREL_BODY` operand changed to a VGPR (`s_movrels_b32 s71, v60`), the run fails with `invalid operand for instruction`. - `tests/rdna2_tools_check.py` with `LLVM_LIB`/`LLVM_MC`/`LLVM_OBJCOPY` set: 148 tests OK, 1 skipped. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 21:01:10 +00:00
tedin7 commented 2026-11-24 21:01:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T20:32:02Z.

Review: COMMENTED


Review of head cc98d04713 (TIER_D_ISOLATED_SHADER_OPS: CMakeLists.txt, tools/pixel_aot.py, tests/pixel_aot_check.py, docs/experiments.md). No P1, no P2.

Commands executed locally (Linux), all rc=0:

  • git diff --check origin/main...HEAD: rc=0
  • python3 tests/docs_links_check.py: rc=0 (18 files, 376 links)
  • python3 tests/bidi_controls_check.py: rc=0 (1330 files)
  • python3 tests/pixel_aot_check.py (translation controls): rc=0

Windows Server 2025 (Build 26100, MSVC 14.44, WARP), x2w_pipe win2025 1894 --targets offscreen_check --regex pixel_aot_smovrel:

  • Debug (dev preset): pixel_aot_smovrel_warp and pixel_aot_smovrel_hardware, 2/2 passed
  • Release /O2: pixel_aot_smovrel_warp and pixel_aot_smovrel_hardware, 2/2 passed

Mutations of the lowering logic in tools/pixel_aot.py (reverted with git checkout):

  • s_movreld_b32 destination offset changed from m0 to 0: pixel_aot_check.py rc=1 (AssertionError on a register moved onto itself)
  • removed the odd 64-bit pair base refusal: pixel_aot_check.py rc=1 (AssertionError, overlapping pair accepted)

Notes: the new scalar relative moves refuse unbounded or non-numeric m0, indices past s105 and pending scalar loads; every source is read before any destination is written. The _b64 m0 units are from the RDNA 2 naming, as the PR body states.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6046908956 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1894#pullrequestreview-6046908956). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T20:32:02Z. **Review:** COMMENTED --- Review of head cc98d0471318c99f8304957e636b0b061795fe4e (TIER_D_ISOLATED_SHADER_OPS: CMakeLists.txt, tools/pixel_aot.py, tests/pixel_aot_check.py, docs/experiments.md). No P1, no P2. Commands executed locally (Linux), all rc=0: - git diff --check origin/main...HEAD: rc=0 - python3 tests/docs_links_check.py: rc=0 (18 files, 376 links) - python3 tests/bidi_controls_check.py: rc=0 (1330 files) - python3 tests/pixel_aot_check.py (translation controls): rc=0 Windows Server 2025 (Build 26100, MSVC 14.44, WARP), x2w_pipe win2025 1894 --targets offscreen_check --regex pixel_aot_smovrel: - Debug (dev preset): pixel_aot_smovrel_warp and pixel_aot_smovrel_hardware, 2/2 passed - Release /O2: pixel_aot_smovrel_warp and pixel_aot_smovrel_hardware, 2/2 passed Mutations of the lowering logic in tools/pixel_aot.py (reverted with git checkout): - s_movreld_b32 destination offset changed from m0 to 0: pixel_aot_check.py rc=1 (AssertionError on a register moved onto itself) - removed the odd 64-bit pair base refusal: pixel_aot_check.py rc=1 (AssertionError, overlapping pair accepted) Notes: the new scalar relative moves refuse unbounded or non-numeric m0, indices past s105 and pending scalar loads; every source is read before any destination is written. The _b64 m0 units are from the RDNA 2 naming, as the PR body states. AI-assisted; commands listed were executed locally.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1887
No description provided.