shader: lower v_cvt_norm_i16_f16 and v_cvt_norm_u16_f16 in direct Compute and Pixel DXIL #3291

Closed
opened 2026-11-28 05:34:47 +00:00 by legacy-code-archaeologist · 0 comments
legacy-code-archaeologist commented 2026-11-28 05:34:47 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-28T05:34:47Z.


Refs #2935.

Lower VOP1 (0x63 / 0x64) and VOP3 (0x1e3 / 0x1e4) v_cvt_norm_i16_f16 and v_cvt_norm_u16_f16 in DirectCompute::float_alu() (src/gfx1013_direct_compute.inl) for both direct Compute and Pixel DXIL:

  • Exact 32-bit integer round-to-nearest-even arithmetic matching tools/pixel_aot.py::f16_cvt_norm_result (round_rne(clamp(x, -1, 1) * 32767) and round_rne(clamp(x, 0, 1) * 65535)), avoiding binary32 double-rounding on 0x3801..0x3804 / 0xb801..0xb802 and preserving binary16 subnormals.
  • Non-finite handling: NaN -> 0, +Inf -> +32767 / 65535, -Inf -> -32767 / 0.
  • Support VOP3 abs[0], neg[0], op_sel[0] (high-half VGPR read), op_sel[3] (high-half write preserving unwritten half), and VGPR / SGPR / literal / inline-constant sources under the strict ((mode_bits ^ 0xf0u) & 0x8000ccu) binary16 mode gate, while refusing clamp, omod, unused modifier bits, high-half op_sel on non-VGPR sources, DPP/SDWA, special scalar sources, and dynamic/flush binary16 modes.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6659822067 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3291). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-28T05:34:47Z. --- Refs #2935. Lower VOP1 (`0x63` / `0x64`) and VOP3 (`0x1e3` / `0x1e4`) `v_cvt_norm_i16_f16` and `v_cvt_norm_u16_f16` in `DirectCompute::float_alu()` (`src/gfx1013_direct_compute.inl`) for both direct Compute and Pixel DXIL: - Exact 32-bit integer round-to-nearest-even arithmetic matching `tools/pixel_aot.py::f16_cvt_norm_result` (`round_rne(clamp(x, -1, 1) * 32767)` and `round_rne(clamp(x, 0, 1) * 65535)`), avoiding binary32 double-rounding on `0x3801..0x3804` / `0xb801..0xb802` and preserving binary16 subnormals. - Non-finite handling: `NaN -> 0`, `+Inf -> +32767` / `65535`, `-Inf -> -32767` / `0`. - Support VOP3 `abs[0]`, `neg[0]`, `op_sel[0]` (high-half VGPR read), `op_sel[3]` (high-half write preserving unwritten half), and VGPR / SGPR / literal / inline-constant sources under the strict `((mode_bits ^ 0xf0u) & 0x8000ccu)` binary16 mode gate, while refusing `clamp`, `omod`, unused modifier bits, high-half `op_sel` on non-VGPR sources, DPP/SDWA, special scalar sources, and dynamic/flush binary16 modes. 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#3291
No description provided.