pixel_aot: lower v_swaprel_b32 with the movrel m0 indexing #1788

Closed
opened 2026-11-24 18:47:10 +00:00 by legacy-code-archaeologist · 3 comments
legacy-code-archaeologist commented 2026-11-24 18:47:10 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-24T18:47:10Z.


Follow-up to #1739/#1785: v_swaprel_b32 is the last VOP1 relative-indexing form that pixel_aot refuses. It is in the gfx1013 and gfx1030 reference lists, VOP1 only, with no VOP3 form. LLVM 15 decodes 7e18d118 as v_swaprel_b32 v12, v24 for both targets.

Semantics (assumption, please correct):

  • It exchanges VGPR[vdst + m0[25:16]] and VGPR[vsrc + m0[9:0]], the same split as v_movrelsd_2_b32.
  • Both values are read before either write, so an equal pair is unchanged.
  • I have this from the RDNA 2 ISA naming and LLVM's definition (uses M0, untyped, no modifiers). I have not checked it against the ISA text locally, and I have no RDNA hardware to measure it on.

Proposed slice: lower it with the m0 machinery of #1785.

  • A static m0, or a dynamic m0 with proven-bounded bit masks, which becomes bounded conditional selects on both sides.
  • Read both reachable sides first, then write both.
  • Same refusals as the movrel forms:
    • unbounded or interp_base m0;
    • an index past v255;
    • an undefined indexed VGPR;
    • an outstanding sample;
    • a mask other than entry.

Fixture plan: two banks with distinct values on the two DPP_MOVREL_SETS, a static and a dynamic swap, an overlapping-bank swap and an equal-index swap. WARP and hardware draws.

Controls that must mismatch:

  • a one-way move instead of a swap;
  • swapped m0 halves;
  • a dynamic m0 that is ignored.

This builds on #1785. I'd open it as a PR on top of that branch, or after #1785 is merged.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6588984718 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1795). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-24T18:47:10Z. --- Follow-up to #1739/#1785: `v_swaprel_b32` is the last VOP1 relative-indexing form that `pixel_aot` refuses. It is in the gfx1013 and gfx1030 reference lists, VOP1 only, with no VOP3 form. LLVM 15 decodes `7e18d118` as `v_swaprel_b32 v12, v24` for both targets. **Semantics (assumption, please correct):** - It exchanges `VGPR[vdst + m0[25:16]]` and `VGPR[vsrc + m0[9:0]]`, the same split as `v_movrelsd_2_b32`. - Both values are read before either write, so an equal pair is unchanged. - I have this from the RDNA 2 ISA naming and LLVM's definition (uses `M0`, untyped, no modifiers). I have not checked it against the ISA text locally, and I have no RDNA hardware to measure it on. **Proposed slice:** lower it with the `m0` machinery of #1785. - A static `m0`, or a dynamic `m0` with proven-bounded bit masks, which becomes bounded conditional selects on both sides. - Read both reachable sides first, then write both. - **Same refusals as the movrel forms:** - unbounded or `interp_base` `m0`; - an index past v255; - an undefined indexed VGPR; - an outstanding sample; - a mask other than entry. **Fixture plan:** two banks with distinct values on the two `DPP_MOVREL_SETS`, a static and a dynamic swap, an overlapping-bank swap and an equal-index swap. WARP and hardware draws. **Controls that must mismatch:** - a one-way move instead of a swap; - swapped `m0` halves; - a dynamic `m0` that is ignored. This builds on #1785. I'd open it as a PR on top of that branch, or after #1785 is merged.
tedin7 commented 2026-11-25 02:02:08 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:42:21Z.


Picking up v_swaprel_b32 lowering with movrel m0 indexing in pixel_aot, with Linux + Win2025 verification tests.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149860093 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1795#issuecomment-7149860093). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:42:21Z. --- Picking up `v_swaprel_b32` lowering with `movrel` `m0` indexing in `pixel_aot`, with Linux + Win2025 verification tests.
tedin7 commented 2026-11-25 02:02:08 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:43:30Z.


Update: v_swaprel_b32 with movrel m0 indexing appears already on main via #1844 (7a75c9ab) and #1875, so skipping — this issue can likely be closed.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149882164 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1795#issuecomment-7149882164). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:43:30Z. --- Update: `v_swaprel_b32` with `movrel` `m0` indexing appears already on `main` via #1844 (`7a75c9ab`) and #1875, so skipping — this issue can likely be closed.
R0Y00 commented 2026-11-25 02:02:09 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T01:47:15Z.


The bounded static and dynamic swap landed in #1844, including overlapping and equal-register cases and GPU negative controls. #1875 added exact emitted-code checks for both sides of the exchange and the m0 halves. I reran the current pixel translator controls successfully. This closes the implementation slice. The exact indexing on native RDNA hardware remains unmeasured, as documented in #1844.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7149955788 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1795#issuecomment-7149955788). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T01:47:15Z. --- The bounded static and dynamic swap landed in #1844, including overlapping and equal-register cases and GPU negative controls. #1875 added exact emitted-code checks for both sides of the exchange and the m0 halves. I reran the current pixel translator controls successfully. This closes the implementation slice. The exact indexing on native RDNA hardware remains unmeasured, as documented in #1844.
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#1788
No description provided.