shader: lower binary16 DPP reciprocal and square root #3580

Manually merged
github merged 1 commit from github-bot/gh-3578 into gh-pr/3578/base 2026-11-30 10:18:14 +00:00 AGit
Owner

@⁠lambirou on GitHub · 2026-11-30 10:06 UTC · original
lambirou:shader/f16-dpp-unary → main · +423 −9 · 7 files · 1 commits · merged 2026-11-30 10:12 UTC

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

This adds quad-local v_rcp_f16_dpp and v_sqrt_f16_dpp in both the DPP16 (quad_perm with row_mask:0xf bank_mask:0xf) and DPP8 (the same 2x2 selection repeated in lanes 4-7) encodings. The source is read through the existing DPP helpers, widened exactly, evaluated as one binary32 division or sqrt, and narrowed to nearest even. f16_rcp_sqrt_result supplies the signed infinity of a zero reciprocal, keeps sqrt(-0), and leaves the negative-root NaN payload unmodelled (the result gains no finite proof). DPP16 accepts bit-15 abs/neg; DPP8, partial masks, bound_ctrl, fi, cross-quad or non-repeated DPP8, clamp, omod, a non-VGPR source, a non-entry EXEC mask and a non-preserved denormal profile stay refused. The other unary DPP opcodes (v_rsq_f16_dpp, v_exp_f16_dpp, v_log_f16_dpp, v_sin_f16_dpp, v_cos_f16_dpp) and the SDWA spellings stay refused.

Tests

  • pixel_aot_f16_dpp_unary_hardware and pixel_aot_f16_dpp_unary_warp pass on the AMD Radeon RX 9060 XT (driver 32.0.32029.2010) and WARP, Windows 11 build 10.0.26300.10075.
  • Three baked programs cover exact reciprocals and roots, a signed reciprocal, a subnormal root, both signed infinities of a zero reciprocal, an inexact root, the largest finite half, and a chain that feeds DPP16 into DPP8 and back; each also runs under a -denorm ftz build.
  • Two mutations (rcp/sqrt swapped, source read from bits 31:16) report pixel_mismatch; mixing DPP8 and DPP16 controls is refused at translation.
  • check_f16_dpp_unary_controls pins the reference rows and every spelling, proof, control, modifier, mode, scheduling and reader refusal.
  • form_coverage_check.py passes and pins exactly the four new forms (rcp/sqrt times DPP16/DPP8); expected full table: 1,563/1,968 gfx1013 and 1,554/1,863 gfx1030.
  • tests/rdna2_tools_check.py test_binary16_dpp_unary_scanner_translator_agreement passes; the scanner and translator agree on the accepted and refused shapes.

Limits

The high half of the destination is not observed; the console's denormal and rounding state beyond the declared nearest-even entry profile is not measured; NaN payloads and special-function results beyond the modelled infinities are not covered; runtime sources are out of scope; lane routing cannot be exercised because every lane of a statically proven source holds the same word. No title is known to execute these paths.

AI-assisted.

**@⁠lambirou** on GitHub · 2026-11-30 10:06 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3578) `lambirou:shader/f16-dpp-unary` → `main` · +423 −9 · 7 files · 1 commits · merged 2026-11-30 10:12 UTC Part of the f16 VOP1 slice (Refs #839). This adds quad-local `v_rcp_f16_dpp` and `v_sqrt_f16_dpp` in both the DPP16 (`quad_perm` with `row_mask:0xf bank_mask:0xf`) and DPP8 (the same 2x2 selection repeated in lanes 4-7) encodings. The source is read through the existing DPP helpers, widened exactly, evaluated as one binary32 division or `sqrt`, and narrowed to nearest even. `f16_rcp_sqrt_result` supplies the signed infinity of a zero reciprocal, keeps `sqrt(-0)`, and leaves the negative-root NaN payload unmodelled (the result gains no finite proof). DPP16 accepts bit-15 `abs`/`neg`; DPP8, partial masks, `bound_ctrl`, `fi`, cross-quad or non-repeated DPP8, clamp, omod, a non-VGPR source, a non-entry EXEC mask and a non-preserved denormal profile stay refused. The other unary DPP opcodes (`v_rsq_f16_dpp`, `v_exp_f16_dpp`, `v_log_f16_dpp`, `v_sin_f16_dpp`, `v_cos_f16_dpp`) and the SDWA spellings stay refused. ## Tests - `pixel_aot_f16_dpp_unary_hardware` and `pixel_aot_f16_dpp_unary_warp` pass on the AMD Radeon RX 9060 XT (driver 32.0.32029.2010) and WARP, Windows 11 build 10.0.26300.10075. - Three baked programs cover exact reciprocals and roots, a signed reciprocal, a subnormal root, both signed infinities of a zero reciprocal, an inexact root, the largest finite half, and a chain that feeds DPP16 into DPP8 and back; each also runs under a `-denorm ftz` build. - Two mutations (`rcp`/`sqrt` swapped, source read from bits 31:16) report `pixel_mismatch`; mixing DPP8 and DPP16 controls is refused at translation. - `check_f16_dpp_unary_controls` pins the reference rows and every spelling, proof, control, modifier, mode, scheduling and reader refusal. - `form_coverage_check.py` passes and pins exactly the four new forms (rcp/sqrt times DPP16/DPP8); expected full table: **1,563/1,968** gfx1013 and **1,554/1,863** gfx1030. - `tests/rdna2_tools_check.py test_binary16_dpp_unary_scanner_translator_agreement` passes; the scanner and translator agree on the accepted and refused shapes. ## Limits The high half of the destination is not observed; the console's denormal and rounding state beyond the declared nearest-even entry profile is not measured; NaN payloads and special-function results beyond the modelled infinities are not covered; runtime sources are out of scope; lane routing cannot be exercised because every lane of a statically proven source holds the same word. No title is known to execute these paths. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 10:12:21 +00:00
github-bot changed target branch from main to gh-pr/3578/base 2026-11-30 10:18:13 +00:00
github manually merged commit 16b69154fd into gh-pr/3578/base 2026-11-30 10:18:14 +00:00
Author
Owner

@⁠lambirou on GitHub · 2026-11-30 10:16 UTC · original

Local verification on the rebased head 16b69154: the 194-test WARP pixel/compute suite passes (194 pass, 0 fail, 0 skip), and form_coverage.py on those records reports 1,563/1,968 gfx1013 and 1,554/1,863 gfx1030. pixel_aot_f16_dpp_unary_hardware and _warp both pass (RX 9060 XT driver 32.0.32029.2010 / WARP), as do form_coverage_check.py and the scanner/translator agreement test.

**@⁠lambirou** on GitHub · 2026-11-30 10:16 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3578#issuecomment-7275376894) Local verification on the rebased head `16b69154`: the 194-test WARP pixel/compute suite passes (194 pass, 0 fail, 0 skip), and `form_coverage.py` on those records reports **1,563/1,968** gfx1013 and **1,554/1,863** gfx1030. `pixel_aot_f16_dpp_unary_hardware` and `_warp` both pass (RX 9060 XT driver 32.0.32029.2010 / WARP), as do `form_coverage_check.py` and the scanner/translator agreement test.
This discussion has been locked. Commenting is limited to contributors.
No description provided.