shader: lower binary16 SDWA reciprocal, square root and special functions #3586

Manually merged
github merged 1 commit from github-bot/gh-3584 into gh-pr/3584/base 2026-11-30 11:11:22 +00:00 AGit
Owner

@⁠lambirou on GitHub · 2026-11-30 10:59 UTC · original
lambirou:shader/f16-sdwa-unary → main · +587 −21 · 7 files · 1 commits · merged 2026-11-30 11:06 UTC

Part of the f16 VOP1 slice (Refs #839).

This adds the SDWA spellings of the seven binary16 VOP1 unary opcodes: v_rcp_f16_sdwa, v_sqrt_f16_sdwa, v_rsq_f16_sdwa, v_exp_f16_sdwa, v_log_f16_sdwa, v_sin_f16_sdwa and v_cos_f16_sdwa. The selected source half (src0_sel WORD_0, WORD_1 or DWORD, with bit-15 abs/neg) is widened exactly, evaluated with the same binary32 operation or RDNA 2 special-result helper as the plain opcode, narrowed to nearest even, and placed with dst_sel and dst_unused through the existing SDWA destination helper. A literal source, BYTE selections, sext(), UNUSED_SEXT, clamp, omod, a non-entry EXEC mask, a non-preserved denormal profile and an outstanding sample stay refused. Sources still need a static finite proof.

Tests

  • pixel_aot_f16_sdwa_unary_warp and _hardware pass: 15 positive draws (12 programs plus three -denorm ftz repeats) and five mutations (rcp/sqrt swapped, rsq/exp swapped, sin/cos swapped, high-half source, dst_sel padding) report pixel_mismatch on WARP and on the AMD Radeon RX 9060 XT (driver 32.0.32029.2010, Windows 11 build 26300).
  • check_f16_sdwa_unary_controls pins the reference rows for the seven ops and every spelling, proof, control, modifier, mode, scheduling and reader refusal, including that a 16-bit result's undefined high half is not readable.
  • draw-sdwa-f16 still passes on WARP and hardware; the neighbouring SDWA forms are untouched.
  • form_coverage_check.py pins exactly the seven new SDWA forms; rdna2_tools_check.py passes 161 tests (19 skipped) including the scanner/translator agreement.
  • Expected full table after the merge: 1,570/1,968 gfx1013 and 1,561/1,863 gfx1030.

Limits

The high half of a dst_sel:DWORD result is not observed; the console's denormal and rounding state beyond the declared nearest-even entry profile is not measured; the LLVM 15 binary round-trip was not replayed locally; sources remain under the static finite-proof contract. No title is known to execute these paths.

AI-assisted.

**@⁠lambirou** on GitHub · 2026-11-30 10:59 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3584) `lambirou:shader/f16-sdwa-unary` → `main` · +587 −21 · 7 files · 1 commits · merged 2026-11-30 11:06 UTC Part of the f16 VOP1 slice (Refs #839). This adds the SDWA spellings of the seven binary16 VOP1 unary opcodes: `v_rcp_f16_sdwa`, `v_sqrt_f16_sdwa`, `v_rsq_f16_sdwa`, `v_exp_f16_sdwa`, `v_log_f16_sdwa`, `v_sin_f16_sdwa` and `v_cos_f16_sdwa`. The selected source half (`src0_sel` WORD_0, WORD_1 or DWORD, with bit-15 `abs`/`neg`) is widened exactly, evaluated with the same binary32 operation or RDNA 2 special-result helper as the plain opcode, narrowed to nearest even, and placed with `dst_sel` and `dst_unused` through the existing SDWA destination helper. A literal source, BYTE selections, `sext()`, `UNUSED_SEXT`, clamp, omod, a non-entry EXEC mask, a non-preserved denormal profile and an outstanding sample stay refused. Sources still need a static finite proof. ## Tests - `pixel_aot_f16_sdwa_unary_warp` and `_hardware` pass: 15 positive draws (12 programs plus three `-denorm ftz` repeats) and five mutations (`rcp`/`sqrt` swapped, `rsq`/`exp` swapped, `sin`/`cos` swapped, high-half source, `dst_sel` padding) report `pixel_mismatch` on WARP and on the AMD Radeon RX 9060 XT (driver 32.0.32029.2010, Windows 11 build 26300). - `check_f16_sdwa_unary_controls` pins the reference rows for the seven ops and every spelling, proof, control, modifier, mode, scheduling and reader refusal, including that a 16-bit result's undefined high half is not readable. - `draw-sdwa-f16` still passes on WARP and hardware; the neighbouring SDWA forms are untouched. - `form_coverage_check.py` pins exactly the seven new SDWA forms; `rdna2_tools_check.py` passes 161 tests (19 skipped) including the scanner/translator agreement. - Expected full table after the merge: **1,570/1,968** gfx1013 and **1,561/1,863** gfx1030. ## Limits The high half of a `dst_sel:DWORD` result is not observed; the console's denormal and rounding state beyond the declared nearest-even entry profile is not measured; the LLVM 15 binary round-trip was not replayed locally; sources remain under the static finite-proof contract. No title is known to execute these paths. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 11:05:20 +00:00
github-bot changed target branch from main to gh-pr/3584/base 2026-11-30 11:11:20 +00:00
github manually merged commit a14c80e142 into gh-pr/3584/base 2026-11-30 11:11:22 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.