pixel_aot: lower the scalar s_movrel* moves with static or bounded m0 #1875

Closed
opened 2026-11-24 20:03:12 +00:00 by legacy-code-archaeologist · 2 comments
legacy-code-archaeologist commented 2026-11-24 20:03:12 +00:00 (Migrated from github.com)
Contributor

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


Scalar follow-up to #1739/#1785/#1844: pixel_aot refuses the five SOP1 relative-indexing moves.

  • They are s_movrels_b32, s_movrels_b64, s_movreld_b32, s_movreld_b64 and s_movrelsd_2_b32.
  • All five are in the gfx1013 and gfx1030 reference lists.
  • LLVM 15 decodes them identically for both targets: be942e28 s_movrels_b32 s20, s40, …2f… _b64 s[20:21], s[40:41], …30…/…31… s_movreld_b32/_b64, …49… s_movrelsd_2_b32.

Semantics (RDNA 2 naming, the same split as the vector forms):

  • s_movrels: sdst = SGPR[ssrc + m0].
  • s_movreld: SGPR[sdst + m0] = ssrc.
  • s_movrelsd_2_b32: SGPR[sdst + m0[25:16]] = SGPR[ssrc + m0[9:0]].
  • The _b64 forms move a pair.

Proposed slice:

  • Static m0: the move is exactly an s_mov_b32/s_mov_b64 from or to the indexed SGPR. The tracked value (constant, expression, descriptor or pointer word) and its bit mask carry over unchanged, as s_mov_b32 does today.
  • Dynamic m0 with a proven bit mask: accepted only when every reachable source SGPR holds a plain 32-bit value, a constant or a uint expression. The result is a bounded select, and its mask is the OR of the reachable masks. For s_movreld, each reachable destination gets a select with its old value. Descriptor, pointer or otherwise symbolic sources are refused, so resource tracking never depends on a runtime index.
  • Refused:
    • an unbounded or non-numeric m0;
    • an index past the last SGPR;
    • a write into an outstanding scalar load;
    • for _b64, an odd effective pair base, because I don't want to guess at pair alignment.

Fixture plan:

  • A draw where each form moves cbuffer-derived words, using the two DPP_MOVREL_SETS with static and dynamic m0, into an exported value.
  • A static control in which a descriptor moved by s_movrels_b64 still drives an s_load, so tracking is preserved.
  • Controls that must mismatch: m0 ignored, and the m0 halves swapped for s_movrelsd_2.
  • Refusals: unbounded m0, a symbolic source under dynamic m0, an odd _b64 base, and an index past the last SGPR.
  • Device-free exact pins of the generated selects, as in #1875.

Is this scope OK?

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6590332208 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1882). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-24T20:03:12Z. --- Scalar follow-up to #1739/#1785/#1844: `pixel_aot` refuses the five SOP1 relative-indexing moves. - They are `s_movrels_b32`, `s_movrels_b64`, `s_movreld_b32`, `s_movreld_b64` and `s_movrelsd_2_b32`. - All five are in the gfx1013 and gfx1030 reference lists. - LLVM 15 decodes them identically for both targets: `be942e28` `s_movrels_b32 s20, s40`, `…2f…` `_b64 s[20:21], s[40:41]`, `…30…`/`…31…` `s_movreld_b32/_b64`, `…49…` `s_movrelsd_2_b32`. **Semantics** (RDNA 2 naming, the same split as the vector forms): - `s_movrels`: `sdst = SGPR[ssrc + m0]`. - `s_movreld`: `SGPR[sdst + m0] = ssrc`. - `s_movrelsd_2_b32`: `SGPR[sdst + m0[25:16]] = SGPR[ssrc + m0[9:0]]`. - The `_b64` forms move a pair. **Proposed slice:** - **Static `m0`:** the move is exactly an `s_mov_b32`/`s_mov_b64` from or to the indexed SGPR. The tracked value (constant, expression, descriptor or pointer word) and its bit mask carry over unchanged, as `s_mov_b32` does today. - **Dynamic `m0` with a proven bit mask:** accepted only when every reachable source SGPR holds a plain 32-bit value, a constant or a `uint` expression. The result is a bounded select, and its mask is the OR of the reachable masks. For `s_movreld`, each reachable destination gets a select with its old value. Descriptor, pointer or otherwise symbolic sources are refused, so resource tracking never depends on a runtime index. - **Refused:** - an unbounded or non-numeric `m0`; - an index past the last SGPR; - a write into an outstanding scalar load; - for `_b64`, an odd effective pair base, because I don't want to guess at pair alignment. **Fixture plan:** - A draw where each form moves cbuffer-derived words, using the two `DPP_MOVREL_SETS` with static and dynamic `m0`, into an exported value. - A static control in which a descriptor moved by `s_movrels_b64` still drives an `s_load`, so tracking is preserved. - **Controls that must mismatch:** `m0` ignored, and the `m0` halves swapped for `s_movrelsd_2`. - **Refusals:** unbounded `m0`, a symbolic source under dynamic `m0`, an odd `_b64` base, and an index past the last SGPR. - Device-free exact pins of the generated selects, as in #1875. Is this scope OK?
ChazY11 commented 2026-11-24 21:01:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T20:35:20Z.


Implemented by #1894 (shader/scalar-movrel, merged as 23d9d12d), which lowers all five instead of refusing them:

$ git show 23d9d12d --stat
 CMakeLists.txt           |   5 ++
 docs/experiments.md      |   2 +
 tests/pixel_aot_check.py | 217 ++++++++++++++++++++++++++++++++++++++++++++++-
 tools/pixel_aot.py       |  85 ++++++++++++++++++++

The dispatch is in tools/pixel_aot.py line 3838:

elif m := match(r"(s_movrels_b32|s_movrels_b64|s_movreld_b32|s_movreld_b64|s_movrelsd_2_b32) "
                r"(s\d+|s\[\d+:\d+\]), (s\d+|s\[\d+:\d+\])"):
    # Scalar relative moves (#1882): s_movrels reads SGPR[src + m0], s_movreld writes SGPR[dst + m0],
    # and s_movrelsd_2_b32 reads SGPR[src + m0[9:0]] and writes SGPR[dst + m25:16]; _b64 moves a pair.

so the five names the description lists are exactly what it handles, with the _b64 pair form and the split-half
s_movrelsd_2_b32 distinguished.

tests/pixel_aot_check.py grows 217 lines of cases around them, and the controls pass on this machine:

out/pe-env/Scripts/python.exe -B tests/pixel_aot_check.py     # exit 0

Nothing left to do here; this can be closed, and the census row in #870 will see the refusal gone.

  • AI-assisted.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7143777496 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1882#issuecomment-7143777496). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T20:35:20Z. --- Implemented by #1894 (`shader/scalar-movrel`, merged as `23d9d12d`), which lowers all five instead of refusing them: ```text $ git show 23d9d12d --stat CMakeLists.txt | 5 ++ docs/experiments.md | 2 + tests/pixel_aot_check.py | 217 ++++++++++++++++++++++++++++++++++++++++++++++- tools/pixel_aot.py | 85 ++++++++++++++++++++ ``` The dispatch is in `tools/pixel_aot.py` line 3838: ```python elif m := match(r"(s_movrels_b32|s_movrels_b64|s_movreld_b32|s_movreld_b64|s_movrelsd_2_b32) " r"(s\d+|s\[\d+:\d+\]), (s\d+|s\[\d+:\d+\])"): # Scalar relative moves (#1882): s_movrels reads SGPR[src + m0], s_movreld writes SGPR[dst + m0], # and s_movrelsd_2_b32 reads SGPR[src + m0[9:0]] and writes SGPR[dst + m25:16]; _b64 moves a pair. ``` so the five names the description lists are exactly what it handles, with the `_b64` pair form and the split-half `s_movrelsd_2_b32` distinguished. `tests/pixel_aot_check.py` grows 217 lines of cases around them, and the controls pass on this machine: ```powershell out/pe-env/Scripts/python.exe -B tests/pixel_aot_check.py # exit 0 ``` Nothing left to do here; this can be closed, and the census row in #870 will see the refusal gone. - AI-assisted.
legacy-code-archaeologist commented 2026-11-26 23:27:21 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-26T23:27:21Z.


Closing: all five scalar moves are lowered by #1894 (merged as 23d9d12d on 24.11.2026), as ChazY11 noted above.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7205555856 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1882#issuecomment-7205555856). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-26T23:27:21Z. --- Closing: all five scalar moves are lowered by #1894 (merged as 23d9d12d on 24.11.2026), as ChazY11 noted above. AI-assisted.
Sign in to join this conversation.
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#1875
No description provided.