shader: lower binary16 VOP3 three-way minimum, maximum and median #3566

Manually merged
github merged 5 commits from github-bot/gh-3564 into gh-pr/3564/base 2026-11-30 10:00:21 +00:00 AGit
Owner

@⁠lambirou on GitHub · 2026-11-30 08:14 UTC · original
lambirou:shader/f16-minmax3 → main · +2054 −32 · 7 files · 5 commits · merged 2026-11-30 09:56 UTC

Part of the VOP3 f16 slice. Stacked on #3564; rebase after it lands.

This adds v_min3_f16, v_max3_f16 and v_med3_f16 (three VOP3 rows). The result is one of the three inputs, selected by the same sign-magnitude order as the direct compute path; the median is max(min(a,b), min(max(a,b),c)). Clamp: a negative result becomes 0 and a result above 15360 becomes 15360. Sources must be statically finite; op_sel high halves, neg/abs, omod, subword, DPP and permuted encodings stay refused.

Tests

  • pixel_aot_f16_minmax3_hardware and pixel_aot_f16_minmax3_warp pass; the whole pixel_aot_f16_ group passes 22/22.
  • Two med3 programs (plain and clamp) plus the min3/max3 cases; seven mutations report pixel_mismatch: min/max swapped, sign order inverted, key order inverted, clamp dropped, high-half source read, med3 replaced by min3, med3 replaced by max3.
  • form_coverage_check.py passes and records exactly the three new forms; expected full table after the stack: 1,559/1,968 gfx1013 and 1,550/1,863 gfx1030.

Limits

The high half of the destination is not observed. High-half op_sel and neg/abs are refused although the direct compute path admits them. Runtime sources and NaN/infinity sources remain out of scope.

The branch includes #3544/#3549/#3556/#3557/#3562; those commits drop out once the stack lands.

AI-assisted.

**@⁠lambirou** on GitHub · 2026-11-30 08:14 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3564) `lambirou:shader/f16-minmax3` → `main` · +2054 −32 · 7 files · 5 commits · merged 2026-11-30 09:56 UTC Part of the VOP3 f16 slice. Stacked on #3564; rebase after it lands. This adds `v_min3_f16`, `v_max3_f16` and `v_med3_f16` (three VOP3 rows). The result is one of the three inputs, selected by the same sign-magnitude order as the direct compute path; the median is `max(min(a,b), min(max(a,b),c))`. Clamp: a negative result becomes 0 and a result above 15360 becomes 15360. Sources must be statically finite; `op_sel` high halves, `neg`/`abs`, omod, subword, DPP and permuted encodings stay refused. ## Tests - `pixel_aot_f16_minmax3_hardware` and `pixel_aot_f16_minmax3_warp` pass; the whole `pixel_aot_f16_` group passes 22/22. - Two med3 programs (plain and clamp) plus the min3/max3 cases; seven mutations report `pixel_mismatch`: min/max swapped, sign order inverted, key order inverted, clamp dropped, high-half source read, med3 replaced by min3, med3 replaced by max3. - `form_coverage_check.py` passes and records exactly the three new forms; expected full table after the stack: **1,559/1,968** gfx1013 and **1,550/1,863** gfx1030. ## Limits The high half of the destination is not observed. High-half `op_sel` and `neg`/`abs` are refused although the direct compute path admits them. Runtime sources and NaN/infinity sources remain out of scope. The branch includes #3544/#3549/#3556/#3557/#3562; those commits drop out once the stack lands. 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 08:15:09 +00:00
github-bot changed title from shader: lower binary16 VOP3 three-way minimum and maximum to shader: lower binary16 VOP3 three-way minimum, maximum and median 2026-11-30 09:02:51 +00:00
github-bot force-pushed github-bot/gh-3564 from a03deb4b9a to daa40d9cdc 2026-11-30 09:10:24 +00:00 Compare
github-bot changed target branch from main to gh-pr/3564/base 2026-11-30 10:00:20 +00:00
github manually merged commit daa40d9cdc into gh-pr/3564/base 2026-11-30 10:00:21 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.