shader: accept v_cmpx_class_f32 as a pixel_aot region opener #1404

Merged
Maxim-Root merged 1 commit from upstream-pr/1411 into main 2026-11-24 11:26:41 +00:00
Maxim-Root commented 2026-11-24 10:56:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Maxim-Root on 2026-11-24T10:56:09Z.


Change

The v_cmpx region opener (#932, extended in #1335) accepted the VOPC _e32 forms on binary32 and on 16-, 32- and 64-bit integers. When #932 was closed, class forms were listed as separate follow-up work. This PR adds the binary32 one: v_cmpx_class_f32_e32, one VOPC form.

  • The opener lowers it exactly as the e32 v_cmp_class_f32 does: (class32(src0) & asuint(vsrc1)) != 0u on the raw binary32 encoding of src0. A new control asserts that the two lowerings are identical for an SGPR and a literal src0.
  • The region rules are unchanged: the save must directly precede the compare, the close is an s_mov_b64 or s_or_b64 restore on the saved pair, VCC and SCC keep their tracked values, and the body rules apply. Only the compare is new.
  • Still refused, with controls:
    • the _e64 and SDWA spellings;
    • an SGPR as VSRC1;
    • neg and abs on src0;
    • v_cmpx_class_f16 and v_cmpx_class_f64.
  • tests/form_coverage_check.py now counts 61 v_cmpx forms, adding v_cmpx_class_f32 in VOPC only. The class neighbours that must stay uncovered are now v_cmpx_class_f16 and v_cmpx_class_f64.
  • docs/experiments.md: the v_cmpx paragraph and the fixture paragraph are updated.

Refs #932.

Verification

At 429a8b92 (main) plus this change, Windows 11 Pro 26300.9818, MSVC 14.44.35207, DXC 10.0.26100, Python 3.12.10. NVIDIA GeForce RTX 3070 Ti (10de:2482), driver 32.0.16.2114, and WARP 10.0.26100. D3D12 debug layer enabled.

New draws in pixel_aot_cmpx_regions_{warp,hardware}:

  • Two programs open the ramp region with v_cmpx_class_f32_e32 v20, v21, where v20 = s44 - sample.x and v21 holds the +normal mask 0x100. v20 is a positive normal value exactly where s44 > sample.x: the ramp never equals a threshold and no difference is subnormal. So through both restores, the region must give the existing masked_pixels reference on the mixed (0.5), full (10) and empty (-1) masks: 6 pass cases. The -normal mask 0x8 (the reversed region) and a mask-free body must mismatch on the mixed mask.
  • One program opens four uniform class regions on the v_cmp_class_f32 draw's inputs, alternating the restores: +inf against its own bit, a quiet NaN against both NaN bits, -0 against the +0 bit and a positive denormal against its bit. The expected result is [1, 1, 0, 1], so neither a lost zero sign nor a flushed denormal can pass. Four wrong references, each flipping one channel, must mismatch.
ctest --preset dev --no-tests=error -R '^pixel_aot_cmpx_regions_(warp|hardware)$' -V

2/2 passed (WARP 2.2 s, hardware 10.3 s), no skips.

  • Negative control: with the lowered condition inverted (== 0u), pixel_aot_cmpx_regions_warp fails at the first new case with Expected ['pass', 'pass', 'pass'], got ['mismatch', 'mismatch', 'mismatch'] (cmpx-class-mov-*).
  • LLVM 15 round trip and translator controls: python -B tests/pixel_aot_check.py binary <llvm-mc> <llvm-objcopy> <LLVM-C.dll> exits 0. The tools are LLVM 15.0.7: LLVM-C.dll and llvm-objcopy from the official Windows installer, and llvm-mc built from the GPG-verified 15.0.7 sources (AMDGPU only). The three new programs are assembled for gfx1013, disassembled and must lower identically.
  • ctest --preset dev --no-tests=error -R '^(pixel_aot_|compute_store_aot_).*_warp$' -j 16: 96/96.
  • All 44 pure-Python checks listed in AGENTS.md pass, including form_coverage_check, rdna2_tools_check and docs_links_check.
  • tools/form_coverage.py ... --gaps gfx1013 on that WARP run: VOPC v_cmpx_class_f32 is no longer listed. Its VOP3 _e64 and SDWA rows stay listed, because both are refused.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6580209441 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1411). Originally posted by [Maxim-Root](https://github.com/Maxim-Root) on 2026-11-24T10:56:09Z. --- ## Change The `v_cmpx` region opener (#932, extended in #1335) accepted the VOPC `_e32` forms on binary32 and on 16-, 32- and 64-bit integers. When #932 was closed, class forms were listed as separate follow-up work. This PR adds the binary32 one: `v_cmpx_class_f32_e32`, one VOPC form. - The opener lowers it exactly as the e32 `v_cmp_class_f32` does: `(class32(src0) & asuint(vsrc1)) != 0u` on the raw binary32 encoding of src0. A new control asserts that the two lowerings are identical for an SGPR and a literal src0. - The region rules are unchanged: the save must directly precede the compare, the close is an `s_mov_b64` or `s_or_b64` restore on the saved pair, VCC and SCC keep their tracked values, and the body rules apply. Only the compare is new. - Still refused, with controls: - the `_e64` and SDWA spellings; - an SGPR as VSRC1; - `neg` and `abs` on src0; - `v_cmpx_class_f16` and `v_cmpx_class_f64`. - `tests/form_coverage_check.py` now counts 61 `v_cmpx` forms, adding `v_cmpx_class_f32` in VOPC only. The class neighbours that must stay uncovered are now `v_cmpx_class_f16` and `v_cmpx_class_f64`. - `docs/experiments.md`: the `v_cmpx` paragraph and the fixture paragraph are updated. Refs #932. ## Verification At `429a8b92` (`main`) plus this change, Windows 11 Pro 26300.9818, MSVC 14.44.35207, DXC 10.0.26100, Python 3.12.10. NVIDIA GeForce RTX 3070 Ti (10de:2482), driver 32.0.16.2114, and WARP 10.0.26100. D3D12 debug layer enabled. **New draws in `pixel_aot_cmpx_regions_{warp,hardware}`:** - Two programs open the ramp region with `v_cmpx_class_f32_e32 v20, v21`, where `v20 = s44 - sample.x` and `v21` holds the +normal mask `0x100`. `v20` is a positive normal value exactly where `s44 > sample.x`: the ramp never equals a threshold and no difference is subnormal. So through both restores, the region must give the existing `masked_pixels` reference on the mixed (0.5), full (10) and empty (-1) masks: 6 pass cases. The -normal mask `0x8` (the reversed region) and a mask-free body must mismatch on the mixed mask. - One program opens four uniform class regions on the `v_cmp_class_f32` draw's inputs, alternating the restores: +inf against its own bit, a quiet NaN against both NaN bits, -0 against the +0 bit and a positive denormal against its bit. The expected result is `[1, 1, 0, 1]`, so neither a lost zero sign nor a flushed denormal can pass. Four wrong references, each flipping one channel, must mismatch. ```powershell ctest --preset dev --no-tests=error -R '^pixel_aot_cmpx_regions_(warp|hardware)$' -V ``` 2/2 passed (WARP 2.2 s, hardware 10.3 s), no skips. - **Negative control:** with the lowered condition inverted (`== 0u`), `pixel_aot_cmpx_regions_warp` fails at the first new case with `Expected ['pass', 'pass', 'pass'], got ['mismatch', 'mismatch', 'mismatch']` (`cmpx-class-mov-*`). - **LLVM 15 round trip and translator controls:** `python -B tests/pixel_aot_check.py binary <llvm-mc> <llvm-objcopy> <LLVM-C.dll>` exits 0. The tools are LLVM 15.0.7: `LLVM-C.dll` and `llvm-objcopy` from the official Windows installer, and `llvm-mc` built from the GPG-verified 15.0.7 sources (AMDGPU only). The three new programs are assembled for gfx1013, disassembled and must lower identically. - `ctest --preset dev --no-tests=error -R '^(pixel_aot_|compute_store_aot_).*_warp$' -j 16`: 96/96. - All 44 pure-Python checks listed in `AGENTS.md` pass, including `form_coverage_check`, `rdna2_tools_check` and `docs_links_check`. - `tools/form_coverage.py ... --gaps gfx1013` on that WARP run: `VOPC v_cmpx_class_f32` is no longer listed. Its `VOP3 _e64` and `SDWA` rows stay listed, because both are refused. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 12:02:49 +00:00
tedin7 commented 2026-11-24 12:02:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T11:09:57Z.

Review: COMMENTED


Reviewed at commit 7b6e5896 (4 files, +100/-12):

  • Lowering & controls: tools/pixel_aot.py extends the VOPC _e32 v_cmpx region opener to v_cmpx_class_f32_e32, lowering via (class32(src0) & asuint(src1)) != 0u identically to v_cmp_class_f32_e32 (preserving VCC/SCC through the region, closing via s_mov_b64 or s_or_b64). Negative controls in tests/pixel_aot_check.py cover _e64, _sdwa, _f16/_f64 class forms, non-VGPR VSRC1, and source modifiers; tests/form_coverage_check.py updates cmpx_forms to 61 forms.
  • Linux: git diff --check clean; tests/docs_links_check.py passed (16 Markdown files, 322 links); tests/bidi_controls_check.py passed (1181 files); tests/pixel_aot_check.py passed; tests/form_coverage_check.py passed; cmpx_class binary roundtrip (3/3 fixtures via llvm-mc-19/llvm-objcopy-19/libLLVM-19.so) passed. (Note: full pixel_aot_check.py binary with llvm-mc-19 hits a pre-existing v_cvt_f16_i16_e32 v1, 0xfff0 encoding difference in check_f16_cvt_int16_binary.)
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev): offscreen_check built; ctest -R '^pixel_aot_exec_regions_warp$' 1/1 passed (3.38s).
    • Release /O2 (--preset release): offscreen_check built; ctest -R '^pixel_aot_exec_regions_warp$' 1/1 passed (3.21s).
    • tests/form_coverage_check.py passed (44.5s).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6038129345 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1411#pullrequestreview-6038129345). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T11:09:57Z. **Review:** COMMENTED --- Reviewed at commit `7b6e5896` (4 files, +100/-12): - **Lowering & controls**: `tools/pixel_aot.py` extends the VOPC `_e32` `v_cmpx` region opener to `v_cmpx_class_f32_e32`, lowering via `(class32(src0) & asuint(src1)) != 0u` identically to `v_cmp_class_f32_e32` (preserving VCC/SCC through the region, closing via `s_mov_b64` or `s_or_b64`). Negative controls in `tests/pixel_aot_check.py` cover `_e64`, `_sdwa`, `_f16`/`_f64` class forms, non-VGPR VSRC1, and source modifiers; `tests/form_coverage_check.py` updates `cmpx_forms` to 61 forms. - **Linux**: `git diff --check` clean; `tests/docs_links_check.py` passed (16 Markdown files, 322 links); `tests/bidi_controls_check.py` passed (1181 files); `tests/pixel_aot_check.py` passed; `tests/form_coverage_check.py` passed; `cmpx_class` binary roundtrip (3/3 fixtures via `llvm-mc-19`/`llvm-objcopy-19`/`libLLVM-19.so`) passed. (Note: full `pixel_aot_check.py binary` with `llvm-mc-19` hits a pre-existing `v_cvt_f16_i16_e32 v1, 0xfff0` encoding difference in `check_f16_cvt_int16_binary`.) - **Windows Server 2025** (Build 26100, MSVC 14.44.35207 + D3D12 WARP): - **Debug (`--preset dev`)**: `offscreen_check` built; `ctest -R '^pixel_aot_exec_regions_warp$'` **1/1 passed** (`3.38s`). - **Release `/O2` (`--preset release`)**: `offscreen_check` built; `ctest -R '^pixel_aot_exec_regions_warp$'` **1/1 passed** (`3.21s`). - `tests/form_coverage_check.py` passed (`44.5s`).
Maxim-Root commented 2026-11-24 12:03:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Maxim-Root on 2026-11-24T11:26:26Z.


@tedin7 thanks for the review. One pointer: the draws for this change are in pixel_aot_cmpx_regions_{warp,hardware}, not pixel_aot_exec_regions_*. The exec_regions tests cover the s_and_saveexec_b64 opener, which this PR does not touch. So a run of these tests would exercise the new path:

ctest --preset dev --no-tests=error -R '^pixel_aot_cmpx_regions_(warp|hardware)$' -V

Its new cases are cmpx-class-mov-*, cmpx-class-or-*, cmpx-class-negative-normal, cmpx-class-unmasked and cmpx-class-group*. Here, at 7b6e5896, they pass on WARP and on an RTX 3070 Ti (32.0.16.2114) with the debug layer on. With the class predicate inverted, the WARP test fails at cmpx-class-mov-0.

On the LLVM 19 note: agreed, it is unrelated. The full pixel_aot_check.py binary passes here with LLVM 15.0.7, the version CI uses, and the v_cvt_f16_i16_e32 fixture is not part of this change.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7130099906 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1411#issuecomment-7130099906). Originally posted by [Maxim-Root](https://github.com/Maxim-Root) on 2026-11-24T11:26:26Z. --- @tedin7 thanks for the review. One pointer: the draws for this change are in `pixel_aot_cmpx_regions_{warp,hardware}`, not `pixel_aot_exec_regions_*`. The `exec_regions` tests cover the `s_and_saveexec_b64` opener, which this PR does not touch. So a run of these tests would exercise the new path: ```powershell ctest --preset dev --no-tests=error -R '^pixel_aot_cmpx_regions_(warp|hardware)$' -V ``` Its new cases are `cmpx-class-mov-*`, `cmpx-class-or-*`, `cmpx-class-negative-normal`, `cmpx-class-unmasked` and `cmpx-class-group*`. Here, at `7b6e5896`, they pass on WARP and on an RTX 3070 Ti (32.0.16.2114) with the debug layer on. With the class predicate inverted, the WARP test fails at `cmpx-class-mov-0`. On the LLVM 19 note: agreed, it is unrelated. The full `pixel_aot_check.py binary` passes here with LLVM 15.0.7, the version CI uses, and the `v_cvt_f16_i16_e32` fixture is not part of this change. AI-assisted (Claude Code).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1404
No description provided.