Skip to content

shader: lower binary16 VOP1 reciprocal and square root - #3556

Merged
tedin7 merged 9 commits into
R0Y00:mainfrom
lambirou:shader/f16-vop1
Nov 30, 2026
Merged

tedin7 merged 9 commits into
R0Y00:mainfrom
lambirou:shader/f16-vop1

Conversation

@lambirou

Copy link
Copy Markdown
Contributor

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

This adds the plain binary16 VOP1 forms of v_rcp_f16 and v_sqrt_f16, in e32 and e64 spellings (four reference rows):

  • Widen the low half exactly, evaluate 1.0f / x or sqrt(x) in binary32, then narrow with the existing integer nearest-even conversion.
  • Keep the static result proof with f16_rcp_sqrt_result: binary32 rounding is applied before binary16 narrowing, so the result is not double-rounded; rcp(±0) gives ±infinity, sqrt(-0) keeps -0, and a negative square root has no modelled NaN payload.
  • The same guards as the other plain f16 VOP1 ops: finite proven source, half_denorm=preserve, destination 0..255, no outstanding sample. Modifiers, clamp, op_sel, DPP and SDWA stay refused.

Tests

  • pixel_aot_f16_rcp_sqrt_hardware passed on the AMD RX 9060 XT (driver 32.0.32029.2010), 6.76 s.
  • pixel_aot_f16_rcp_sqrt_warp passed on WARP, 5.46 s.
  • Negative controls: rcp/sqrt swapped and high-half source read report pixel_mismatch; an unproven source is refused.
  • tests/form_coverage_check.py passes, including the new check_f16_rcp_sqrt_forms; the scanner/translator agreement tests pass.
  • The targeted JUnit records all four forms: v_rcp_f16_e32/e64 and v_sqrt_f16_e32/e64.

Expected full table after both this and #3549: 1,546/1,968 gfx1013 and 1,537/1,863 gfx1030.

Limits

No console measurement. The high half of the destination is not observed. The NaN payload of a negative sqrt and special values beyond rcp infinities are not modelled. DPP, SDWA, v_rsq_f16 and the five other VOP1 f16 ops remain out of scope.

The branch is based on #3549, itself based on red main 44a3ad5; #3542 fixes the pre-existing startup_triage_run failure that can turn the Linux check red.

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 R0Y00#3457 did for startup_resource_retire. The expectation is unchanged.

Refs R0Y00#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 R0Y00#839
@tedin7
tedin7 merged commit bee8be4 into R0Y00:main Nov 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants