shader: lower binary16 VOP1 reciprocal square root and exponent #3559

Closed
github-bot wants to merge 1 commit from github-bot/gh-3557 into main AGit
Owner

@⁠lambirou on GitHub · 2026-11-30 05:59 UTC · original
lambirou:shader/f16-rsq-exp → main · +653 −26 · 7 files · 1 commits · closed without merging

Part of the VOP1 f16 slice. Stacked on #3558; rebase after it lands.

This adds the plain binary16 VOP1 forms of v_rsq_f16 and v_exp_f16, e32 and e64 (four reference rows):

  • Widen the low half, evaluate rsqrt or exp2 in binary32, then narrow with the existing integer nearest-even conversion.
  • Apply the RDNA 2 special selects: rsq maps zero to source | 0x7c00, 0x7c00 to 0 and anything above 0x7c00 to 0x7e00; exp applies the 70 midpoint corrections, 0xce40 to 0 and magnitudes above 0x7c00 to 0x7e00.
  • f16_rsq_exp_result follows the P4a contract, and a Python midpoint table is checked against the C++ table in the direct compute lowering.

Tests

  • pixel_aot_f16_rsq_exp_hardware passed on the AMD RX 9060 XT, and pixel_aot_f16_rsq_exp_warp passed on WARP.
  • The WARP replay of the 195 pixel_aot_|compute_store_aot_ entries passes 195/195, 0 fail, 0 skip.
  • Coverage on that run: 1,550/1,968 gfx1013 and 1,541/1,863 gfx1030.
  • form_coverage_check.py passes; rdna2_tools_check.py reports 159 tests and 19 LLVM_LIB skips.

Limits

The high half of the destination is not observed. The rsqrt/exp2 error window is not reproduced bit for bit; exp midpoints are corrected and the fixture avoids ambiguous rsq sources. NaN/infinity constants, runtime sources, DPP/SDWA and the remaining log/sin/cos forms are out of scope.

The branch includes the commits of #3544 (and #3551/#3556 below it); they drop out of the diff once those land.

AI-assisted.

**@⁠lambirou** on GitHub · 2026-11-30 05:59 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3557) `lambirou:shader/f16-rsq-exp` → `main` · +653 −26 · 7 files · 1 commits · closed without merging Part of the VOP1 f16 slice. Stacked on #3558; rebase after it lands. This adds the plain binary16 VOP1 forms of `v_rsq_f16` and `v_exp_f16`, e32 and e64 (four reference rows): - Widen the low half, evaluate `rsqrt` or `exp2` in binary32, then narrow with the existing integer nearest-even conversion. - Apply the RDNA 2 special selects: `rsq` maps zero to `source | 0x7c00`, `0x7c00` to 0 and anything above `0x7c00` to `0x7e00`; `exp` applies the 70 midpoint corrections, `0xce40` to 0 and magnitudes above `0x7c00` to `0x7e00`. - `f16_rsq_exp_result` follows the P4a contract, and a Python midpoint table is checked against the C++ table in the direct compute lowering. ## Tests - `pixel_aot_f16_rsq_exp_hardware` passed on the AMD RX 9060 XT, and `pixel_aot_f16_rsq_exp_warp` passed on WARP. - The WARP replay of the 195 `pixel_aot_|compute_store_aot_` entries passes 195/195, 0 fail, 0 skip. - Coverage on that run: **1,550/1,968 gfx1013** and **1,541/1,863 gfx1030**. - `form_coverage_check.py` passes; `rdna2_tools_check.py` reports 159 tests and 19 `LLVM_LIB` skips. ## Limits The high half of the destination is not observed. The `rsqrt`/`exp2` error window is not reproduced bit for bit; `exp` midpoints are corrected and the fixture avoids ambiguous `rsq` sources. NaN/infinity constants, runtime sources, DPP/SDWA and the remaining `log`/`sin`/`cos` forms are out of scope. The branch includes the commits of #3544 (and #3551/#3556 below it); they drop out of the diff once those land. AI-assisted.
case6 of startup_resource_retire_title releases the newer wrapper and calls settle() without waiting for the queues. Every release signals a release-time fence on each registered queue, and settle() only resubmits the drain list, so a fence that has not completed leaves both wrappers retained and the stage fails with retained=131072/2 against 65536/1. Sync the direct and gated queues before settle(), as #3457 did for startup_resource_retire. The expectation is unchanged.

Refs #3507
Lower the 62 v_cmpx_*_sdwa forms of gfx1013/rdna2 in the pixel translator,
reusing the existing v_cmpx EXEC region opener. VOPC SDWA has no destination:
the comparison writes EXEC, so the non-SDWA path is unchanged.

Add draw-cmpx-sdwa (warp/hardware), the static controls and the coverage
assertions, and teach the scanner the new spellings.

Tests: draw-cmpx-sdwa warp/hardware, draw-cmpx-regions warp,
draw-sdwa-cmp warp, form_coverage_check, rdna2_tools_check.
Coverage: 62 of 62 forms in each reference; 1542/1968 gfx1013 and
1533/1863 gfx1030 in the 194-entry WARP replay.
Add v_rcp_f16 and v_sqrt_f16 to the plain pixel VOP1 path in e32 and e64, matching the direct compute binary32 operation and binary16 narrowing. Cover finite-source proofs, mode and modifier refusals, exact and rounded values, chains, readers, scanner agreement, and form coverage.

Refs #839
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 06:02:22 +00:00
github-bot force-pushed github-bot/gh-3557 from 4815a98c6b to 933b8e6926 2026-11-30 09:10:17 +00:00 Compare
Author
Owner

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

Merged as part of #3566: that PR was squashed onto main at f0a10b12, and the reciprocal-square-root/exponent lowerings are in main (the squash body lists this commit). Closing this now-redundant PR. The next DPP slice is #3580.

**@⁠lambirou** on GitHub · 2026-11-30 10:06 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3557#issuecomment-7275137176) Merged as part of #3566: that PR was squashed onto `main` at `f0a10b12`, and the reciprocal-square-root/exponent lowerings are in `main` (the squash body lists this commit). Closing this now-redundant PR. The next DPP slice is #3580.
github-bot closed this pull request 2026-11-30 10:12:22 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.