shader: lower s_lshl_b64, s_lshr_b64 and s_ashr_i64 in the direct compute path #3062

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

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


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

src/gfx1013_direct_compute.inl does not yet lower SOP2 64-bit scalar shifts s_lshl_b64, s_lshr_b64 and s_ashr_i64 (they reach the direct ALU operand modifiers / unsupported wave64 scalar operation fallback).

Scope:

  • Lower s_lshl_b64, s_lshr_b64 and s_ashr_i64 in the direct compute path matching tools/startup/gfx2hlsl.py (scalar_wide_op):
    • Destination: aligned SGPR pair (s[0..104] even) or vcc (106).
    • S0: aligned SGPR pair, inline integer (-16..64), or 32-bit literal (zero-extended for logical shifts, sign-extended for s_ashr_i64).
    • S1: general SGPR (s0..s105), inline integer, or 32-bit literal, masked to & 63.
    • All sources read before destination writes (safe for overlapping destinations); SCC = (D != 0).
  • Fix src/gfx1013_compute_native.cpp symbolic transfer() pair clearing so _i64 SOP1/SOP2 instructions (s_ashr_i64) clear s[dst + 1] just like _b64.
  • Mark s_lshl_b64, s_lshr_b64, s_ashr_i64 as overwriting SCC in uses_scc_after().
  • Add controls + hardware readback fixture (tests/native_salu_shift64_check.py, tests/cmake/native_salu_shift64.cmake) and docs/experiments/native-direct-salu-shift64.md.

I am taking it. AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6647279201 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3062). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-27T13:21:20Z. --- Part of #2935 (closing the remaining `gfx2hlsl.py` gaps in the direct C++ compute path). `src/gfx1013_direct_compute.inl` does not yet lower SOP2 64-bit scalar shifts `s_lshl_b64`, `s_lshr_b64` and `s_ashr_i64` (they reach the `direct ALU operand modifiers` / `unsupported wave64 scalar operation` fallback). Scope: - Lower `s_lshl_b64`, `s_lshr_b64` and `s_ashr_i64` in the direct compute path matching `tools/startup/gfx2hlsl.py` (`scalar_wide_op`): - Destination: aligned SGPR pair (`s[0..104]` even) or `vcc` (`106`). - `S0`: aligned SGPR pair, inline integer (`-16..64`), or 32-bit literal (zero-extended for logical shifts, sign-extended for `s_ashr_i64`). - `S1`: general SGPR (`s0..s105`), inline integer, or 32-bit literal, masked to `& 63`. - All sources read before destination writes (safe for overlapping destinations); `SCC = (D != 0)`. - Fix `src/gfx1013_compute_native.cpp` symbolic `transfer()` pair clearing so `_i64` SOP1/SOP2 instructions (`s_ashr_i64`) clear `s[dst + 1]` just like `_b64`. - Mark `s_lshl_b64`, `s_lshr_b64`, `s_ashr_i64` as overwriting `SCC` in `uses_scc_after()`. - Add controls + hardware readback fixture (`tests/native_salu_shift64_check.py`, `tests/cmake/native_salu_shift64.cmake`) and `docs/experiments/native-direct-salu-shift64.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#3062
No description provided.