shader: lower s_cmov_b32, s_cmov_b64 and s_cmovk_i32 in the direct compute path #3070

Closed
opened 2026-11-27 14:04:26 +00:00 by legacy-code-archaeologist · 0 comments
legacy-code-archaeologist commented 2026-11-27 14:04:26 +00:00 (Migrated from github.com)
Contributor

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


Part of #2935 (closing the remaining gfx2hlsl.py gaps in the direct C++ compute path).

src/gfx1013_direct_compute.inl does not yet lower scalar conditional moves s_cmov_b32, s_cmov_b64 and s_cmovk_i32 (they fall through to direct ALU operand modifiers / unsupported wave64 scalar operation).

Scope:

  • Lower s_cmov_b32, s_cmov_b64 (SOP1) and s_cmovk_i32 (SOPK) in the direct compute path matching tools/startup/gfx2hlsl.py (scalar_cmov):
    • D = SCC ? S0 : D, leaving SCC unchanged.
    • s_cmov_b32 / s_cmovk_i32: general SGPR (s0..s105), vcc_lo (106), or wave32 vcc_hi (107) destination; s_cmovk_i32 sign-extends the 16-bit immediate.
    • s_cmov_b64: aligned SGPR pair (s0..s104 even) or vcc (106) destination; aligned SGPR pair, inline integer (-16..64), or 32-bit literal S0.
    • Old destination read via operand32 so a symbolic descriptor destination is refused.
  • Update uses_scc_after() (reads_scc) for all three instructions and transfer() in src/gfx1013_compute_native.cpp for s_cmovk_i32.
  • Add controls + hardware readback fixture (tests/native_salu_cmov_check.py, tests/cmake/native_salu_cmov.cmake) and docs/experiments/native-direct-salu-cmov.md.

I am taking it. AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6647980096 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3070). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-27T14:04:26Z. --- Part of #2935 (closing the remaining `gfx2hlsl.py` gaps in the direct C++ compute path). `src/gfx1013_direct_compute.inl` does not yet lower scalar conditional moves `s_cmov_b32`, `s_cmov_b64` and `s_cmovk_i32` (they fall through to `direct ALU operand modifiers` / `unsupported wave64 scalar operation`). Scope: - Lower `s_cmov_b32`, `s_cmov_b64` (SOP1) and `s_cmovk_i32` (SOPK) in the direct compute path matching `tools/startup/gfx2hlsl.py` (`scalar_cmov`): - `D = SCC ? S0 : D`, leaving `SCC` unchanged. - `s_cmov_b32` / `s_cmovk_i32`: general SGPR (`s0..s105`), `vcc_lo` (`106`), or wave32 `vcc_hi` (`107`) destination; `s_cmovk_i32` sign-extends the 16-bit immediate. - `s_cmov_b64`: aligned SGPR pair (`s0..s104` even) or `vcc` (`106`) destination; aligned SGPR pair, inline integer (`-16..64`), or 32-bit literal `S0`. - Old destination read via `operand32` so a symbolic descriptor destination is refused. - Update `uses_scc_after()` (`reads_scc`) for all three instructions and `transfer()` in `src/gfx1013_compute_native.cpp` for `s_cmovk_i32`. - Add controls + hardware readback fixture (`tests/native_salu_cmov_check.py`, `tests/cmake/native_salu_cmov.cmake`) and `docs/experiments/native-direct-salu-cmov.md`. I am taking it. 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#3070
No description provided.