shader: support VOP3P clamp on v_pk_add_f16, v_pk_mul_f16, and v_pk_fma_f16 #3292

Manually merged
github merged 1 commit from github-bot/gh-3290 into gh-pr/3290/base 2026-11-28 06:08:40 +00:00 AGit
Owner

@⁠legacy-code-archaeologist on GitHub · 2026-11-28 05:28 UTC · original
legacy-code-archaeologist:shader/direct-packed-f16-clamp → main · +354 −21 · 6 files · 1 commits · merged 2026-11-28 06:02 UTC

Fixes #3289, Refs #2935.

Summary

  • Admits VOP3P CLAMP on v_pk_add_f16 (0x0f), v_pk_mul_f16 (0x10), and v_pk_fma_f16 (0x0e) in DirectCompute::packed_f16_alu() (src/gfx1013_direct_compute.inl), saturating each rounded binary16 result half to [+0.0, 1.0] with -0.0 -> +0.0 and NaN -> +0.0.
  • Keeps VOP2/VOP3 e64 v_pk_fmac_f16 clamp, unused third-operand modifier/source fields (src2, OP_SEL[2], NEG_HI[2], NEG_LO[2]) on 2-source add/mul, and non-default/dynamic binary16 MODE states refused.
  • Updates stale clamp-refusal negative controls in tests/native_packed_f16_check.py and tests/native_packed_f16_inline_check.py to test unused third-operand bits while verifying clamped compilation.
  • Adds tests/native_packed_f16_clamp_check.py + tests/cmake/native_packed_f16_clamp.cmake (22 cases, 9 refusals across Compute IR/DXIL/lossless 16-bit Pixel readbacks, plus 2064-word Compute replay where SM 6.6 wave32 is supported) and updates docs/experiments/native-packed-f16.md.

Verification

All checks passed on Windows 11 with SDK 10.0.26100.0 (dev and release /O2 presets):

  • python -B tests/docs_links_check.py: passed (141 Markdown files, 662 links)
  • ctest --preset dev & ctest --preset release (-R '^(native_packed_f16_clamp_|native_packed_f16_controls|native_packed_f16_pixel_|native_packed_f16_inline_ir|native_packed_f16_inline_controls|native_pk_fmac_f16_ir|native_f16_alu_ir)'): 11 passed, 1 skipped in each preset:
    • native_f16_alu_ir (435 results, 39 refusals): passed
    • native_packed_f16_controls, _pixel_warp, _pixel_hardware: passed
    • native_packed_f16_clamp_ir (22 cases, 9 refusals), _controls (22 cases compiled, 9 refusals): passed
    • native_packed_f16_clamp_pixel_warp (Microsoft Basic Render Driver, 11 draws / 22 cases) and native_packed_f16_clamp_pixel_hardware (NVIDIA Quadro M1000M driver 32.0.15.7371, debug_layer=unavailable, 11 draws / 22 cases): passed
    • native_packed_f16_inline_ir, _controls (24 cases, 10 refusals), and native_pk_fmac_f16_ir (17 cases, 8 refusals): passed
    • native_packed_f16_clamp_compute_hardware: skipped (77 on local Intel HD Graphics 530 31.0.101.2111 lacking SM 6.6 wave32; Compute SM 6.6 wave32 replay needs an SM 6.6 wave32 GPU)
  • Sensitivity mutants on dev (native_packed_f16_clamp_ir): dropping the NaN check, dropping the sign-bit (32768) check, and dropping the > 15359 upper clamp each failed on the exact affected cases before restoring clean source.

AI-assisted.

**@⁠legacy-code-archaeologist** on GitHub · 2026-11-28 05:28 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3290) `legacy-code-archaeologist:shader/direct-packed-f16-clamp` → `main` · +354 −21 · 6 files · 1 commits · merged 2026-11-28 06:02 UTC Fixes #3289, Refs #2935. ## Summary - Admits VOP3P `CLAMP` on `v_pk_add_f16` (`0x0f`), `v_pk_mul_f16` (`0x10`), and `v_pk_fma_f16` (`0x0e`) in `DirectCompute::packed_f16_alu()` (`src/gfx1013_direct_compute.inl`), saturating each rounded binary16 result half to `[+0.0, 1.0]` with `-0.0 -> +0.0` and `NaN -> +0.0`. - Keeps VOP2/VOP3 e64 `v_pk_fmac_f16` clamp, unused third-operand modifier/source fields (`src2`, `OP_SEL[2]`, `NEG_HI[2]`, `NEG_LO[2]`) on 2-source `add`/`mul`, and non-default/dynamic binary16 `MODE` states refused. - Updates stale clamp-refusal negative controls in `tests/native_packed_f16_check.py` and `tests/native_packed_f16_inline_check.py` to test unused third-operand bits while verifying clamped compilation. - Adds `tests/native_packed_f16_clamp_check.py` + `tests/cmake/native_packed_f16_clamp.cmake` (`22` cases, `9` refusals across Compute IR/DXIL/lossless 16-bit Pixel readbacks, plus `2064`-word Compute replay where SM 6.6 wave32 is supported) and updates `docs/experiments/native-packed-f16.md`. ## Verification All checks passed on Windows 11 with SDK `10.0.26100.0` (`dev` and `release` `/O2` presets): - `python -B tests/docs_links_check.py`: passed (`141` Markdown files, `662` links) - `ctest --preset dev` & `ctest --preset release` (`-R '^(native_packed_f16_clamp_|native_packed_f16_controls|native_packed_f16_pixel_|native_packed_f16_inline_ir|native_packed_f16_inline_controls|native_pk_fmac_f16_ir|native_f16_alu_ir)'`): `11` passed, `1` skipped in each preset: - `native_f16_alu_ir` (`435` results, `39` refusals): passed - `native_packed_f16_controls`, `_pixel_warp`, `_pixel_hardware`: passed - `native_packed_f16_clamp_ir` (`22` cases, `9` refusals), `_controls` (`22` cases compiled, `9` refusals): passed - `native_packed_f16_clamp_pixel_warp` (Microsoft Basic Render Driver, `11` draws / `22` cases) and `native_packed_f16_clamp_pixel_hardware` (NVIDIA Quadro M1000M driver `32.0.15.7371`, `debug_layer=unavailable`, `11` draws / `22` cases): passed - `native_packed_f16_inline_ir`, `_controls` (`24` cases, `10` refusals), and `native_pk_fmac_f16_ir` (`17` cases, `8` refusals): passed - `native_packed_f16_clamp_compute_hardware`: skipped (`77` on local Intel HD Graphics 530 `31.0.101.2111` lacking SM 6.6 wave32; Compute SM 6.6 wave32 replay needs an SM 6.6 wave32 GPU) - Sensitivity mutants on `dev` (`native_packed_f16_clamp_ir`): dropping the NaN check, dropping the sign-bit (`32768`) check, and dropping the `> 15359` upper clamp each failed on the exact affected cases before restoring clean source. AI-assisted.
Admit VOP3P CLAMP on v_pk_add_f16, v_pk_mul_f16, and v_pk_fma_f16 in DirectCompute::packed_f16_alu(), saturating each rounded binary16 half to [+0.0, 1.0] with -0.0 -> +0.0 and NaN -> +0.0 while keeping VOP2/e64 v_pk_fmac_f16 clamp and unused third-operand fields refused. Add native_packed_f16_clamp_check.py, CMake registration, and docs updates. Fixes #3287, Refs #2935. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 05:37:31 +00:00
github-bot changed target branch from main to gh-pr/3290/base 2026-11-28 06:08:40 +00:00
github manually merged commit f798488952 into gh-pr/3290/base 2026-11-28 06:08:40 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-28 06:02 UTC · original · approved these changes

Independent Release check on f7984889: ctest --preset release --no-tests=error --output-on-failure -j 1 -R '^native_(packed_f16.*|f16_alu_ir)$' passed 15/15 with no skips. It covered the new wave32 hardware Compute and both WARP and hardware Pixel cases, adjacent unclamped and inline paths, and the modifier/encoding refusal controls. Windows 11 build 26200, DXC 10.0.26100, RTX 4060 Laptop driver 32.0.16.1656 and inbox WARP 10.0.26100.9818. The implementation applies the clamp after the per-half rounded operation and retains the separate FMAC and mode gates.

**@⁠R0Y00** on GitHub · 2026-11-28 06:02 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3290#pullrequestreview-6096193395) · **approved these changes** Independent Release check on `f7984889`: `ctest --preset release --no-tests=error --output-on-failure -j 1 -R '^native_(packed_f16.*|f16_alu_ir)$'` passed 15/15 with no skips. It covered the new wave32 hardware Compute and both WARP and hardware Pixel cases, adjacent unclamped and inline paths, and the modifier/encoding refusal controls. Windows 11 build 26200, DXC 10.0.26100, RTX 4060 Laptop driver 32.0.16.1656 and inbox WARP 10.0.26100.9818. The implementation applies the clamp after the per-half rounded operation and retains the separate FMAC and mode gates.
This discussion has been locked. Commenting is limited to contributors.
No description provided.