shader: lower v_pk_add/sub_i16 and v_pk_add/sub_u16 in the direct compute path #3085

Closed
opened 2026-11-27 14:47:46 +00:00 by github-bot · 0 comments
Owner

@⁠R0D4X on GitHub · 2026-11-27 14:46 UTC · original

Refs #2935.

The ISA table (src/gfx1013_isa_tables.inl) already decodes VOP3P v_pk_add_i16 (0x02), v_pk_sub_i16 (0x03), v_pk_add_u16 (0x0a), and v_pk_sub_u16 (0x0b), and the startup HLSL translator already lowers them, but the direct C++ compute frontend (src/gfx1013_direct_compute.inl) does not lower them yet.

I am taking this slice.

Planned scope

  • Lower VOP3P v_pk_add_i16, v_pk_sub_i16, v_pk_add_u16, and v_pk_sub_u16 in src/gfx1013_direct_compute.inl with full op_sel[1:0] / op_sel_hi[1:0] lane selection, wrapping modulo 2^16 when unclamped, and per-lane saturation ([-32768, 32767] for i16, [0, 65535] for u16) when clamp is set.
  • Refuse neg_lo, neg_hi, op_sel[2], and nonzero src2 (ignoring LLVM's default 2-source op_sel_hi[2] bit 14).
  • Add tests/native_pk_add_sub_16_check.py, tests/cmake/native_pk_add_sub_16.cmake, and docs/experiments/native-pk-add-sub-16.md covering DXIL compile controls, modifier refusals, EXEC masking, op_sel/op_sel_hi swizzles, no-clamp negative controls, and native_store_replay hardware readback.
**@⁠R0D4X** on GitHub · 2026-11-27 14:46 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/3085) Refs #2935. The ISA table (`src/gfx1013_isa_tables.inl`) already decodes VOP3P `v_pk_add_i16` (`0x02`), `v_pk_sub_i16` (`0x03`), `v_pk_add_u16` (`0x0a`), and `v_pk_sub_u16` (`0x0b`), and the startup HLSL translator already lowers them, but the direct C++ compute frontend (`src/gfx1013_direct_compute.inl`) does not lower them yet. I am taking this slice. ### Planned scope - Lower VOP3P `v_pk_add_i16`, `v_pk_sub_i16`, `v_pk_add_u16`, and `v_pk_sub_u16` in `src/gfx1013_direct_compute.inl` with full `op_sel[1:0]` / `op_sel_hi[1:0]` lane selection, wrapping modulo 2^16 when unclamped, and per-lane saturation (`[-32768, 32767]` for `i16`, `[0, 65535]` for `u16`) when `clamp` is set. - Refuse `neg_lo`, `neg_hi`, `op_sel[2]`, and nonzero `src2` (ignoring LLVM's default 2-source `op_sel_hi[2]` bit 14). - Add `tests/native_pk_add_sub_16_check.py`, `tests/cmake/native_pk_add_sub_16.cmake`, and `docs/experiments/native-pk-add-sub-16.md` covering DXIL compile controls, modifier refusals, `EXEC` masking, `op_sel`/`op_sel_hi` swizzles, no-clamp negative controls, and `native_store_replay` hardware readback.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 14:47:46 +00:00
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/R0Y00--Xbox2Windows#3085
No description provided.