shader: lower gfx1013 v_cmp_class_f32 in pixel_aot #293

Manually merged
github merged 1 commit from gh-pr/293/head into gh-pr/293/base 2026-11-26 21:40:46 +00:00
Owner

@⁠Its3rr0rsWRLD on GitHub · 2026-11-21 21:08 UTC · original
Its3rr0rsWRLD:shader/cmp-class → main · +79 −1 · 3 files · 1 commits · merged 2026-11-22 03:25 UTC

Change

pixel_aot rejected v_cmp_class_f32, which compilers emit for isnan, isinf and similar tests. It is true when the class of S0 is in the 10-bit mask S1, using the bits of LLVM's SIInstrFlags::ClassFlags (llvm/lib/Target/AMDGPU/SIDefines.h): signaling NaN, quiet NaN, -inf, -normal, -denormal, -0, +0, +denormal, +normal, +inf. This adds a class32 helper that classifies the raw binary32 encoding and lowers v_cmp_class_f32 (_e32 and _e64) to a tracked lane condition, so v_cndmask_b32 can select on it like the other comparisons. The mask may be an inline constant, a literal or a register; a mask with modifiers is refused. Independent problem: it widens the comparisons the pixel translator accepts.

One existing control used v_cmp_class_f32_e32 as an example of an unsupported comparison and expected the renamed program to be refused. Since that instruction is now supported, the control renames to v_cmp_eq_f64_e32 instead, which keeps the same check: a renamed, unsupported comparison is still refused.

Overlap: #288 and #292 also edit tools/pixel_aot.py, tests/pixel_aot_check.py and docs/experiments.md on separate lines. I merged the three branches onto d311159 in three different orders without conflicts; the controls and the binary check pass on the combination. None depends on another.

Verification

Commit d311159 plus this change, Windows 10 Enterprise 26H2 build 26300.9974, MSVC 14.51.36231, Windows SDK 10.0.26100.0 DXC.

ctest --preset dev --no-tests=error -R '^pixel_aot_' -V
  • pixel_aot_hardware: Passed on NVIDIA GeForce RTX 4070 Ti (10de:2782), driver 32.0.16.1088.
  • pixel_aot_warp: Passed on WARP 10.0.26100.9818.
  • Every draw reports debug_errors=0 and max_absolute_error=0. Each test runs 41 draws with this change and 40 on d311159; the extra draw is the new one.
  • tests/pixel_aot_check.py binary passes with the program added to the binary fixtures: LLVM 15.0.6 llvm-mc and llvm-objcopy, disassembled through libLLVM-17.so and libLLVM-18.so on Linux (no shared LLVM 15 library was available). Unchanged main passes the same check with both libraries. The Ubuntu CI job runs it with LLVM 15.
  • tests/docs_links_check.py and tests/bidi_controls_check.py pass.

Evidence and follow-up

The fixture is synthetic. Four constant words hold +inf, a quiet NaN, -0 and the smallest positive denormal, and each channel selects 1.0 or 0: +inf against the +inf bit (true), the quiet NaN against both NaN bits (true), -0 against the +0 bit (false) and the denormal against the +denormal bit (true). Each channel isolates one property, so an implementation that ignores the sign of zero or flushes the denormal fails. The +0 mask comes from a register, the others from an inline constant and literals, and the last comparison writes its wave32 lane mask to s0 instead of VCC. Negative controls: a reference with any single channel flipped must report pixel_mismatch, and all four do. The controls also check the four class32 calls and the literal and register masks, and refuse a negated mask and a missing operand. The translator on d311159 rejects the program at its first v_cmp_class_f32.

Not measured here: signaling NaN inputs, which are not drawn, and whether Scarlett classifies a denormal input without flushing it first. Both are recorded in docs/experiments.md.

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: yes. Written with Claude; verified on the hardware listed above.

**@⁠Its3rr0rsWRLD** on GitHub · 2026-11-21 21:08 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/293) `Its3rr0rsWRLD:shader/cmp-class` → `main` · +79 −1 · 3 files · 1 commits · merged 2026-11-22 03:25 UTC ## Change `pixel_aot` rejected `v_cmp_class_f32`, which compilers emit for `isnan`, `isinf` and similar tests. It is true when the class of S0 is in the 10-bit mask S1, using the bits of LLVM's `SIInstrFlags::ClassFlags` (`llvm/lib/Target/AMDGPU/SIDefines.h`): signaling NaN, quiet NaN, -inf, -normal, -denormal, -0, +0, +denormal, +normal, +inf. This adds a `class32` helper that classifies the raw binary32 encoding and lowers `v_cmp_class_f32` (`_e32` and `_e64`) to a tracked lane condition, so `v_cndmask_b32` can select on it like the other comparisons. The mask may be an inline constant, a literal or a register; a mask with modifiers is refused. Independent problem: it widens the comparisons the pixel translator accepts. One existing control used `v_cmp_class_f32_e32` as an example of an unsupported comparison and expected the renamed program to be refused. Since that instruction is now supported, the control renames to `v_cmp_eq_f64_e32` instead, which keeps the same check: a renamed, unsupported comparison is still refused. Overlap: #288 and #292 also edit `tools/pixel_aot.py`, `tests/pixel_aot_check.py` and `docs/experiments.md` on separate lines. I merged the three branches onto d311159 in three different orders without conflicts; the controls and the binary check pass on the combination. None depends on another. ## Verification Commit d311159 plus this change, Windows 10 Enterprise 26H2 build 26300.9974, MSVC 14.51.36231, Windows SDK 10.0.26100.0 DXC. ```powershell ctest --preset dev --no-tests=error -R '^pixel_aot_' -V ``` - `pixel_aot_hardware`: Passed on NVIDIA GeForce RTX 4070 Ti (10de:2782), driver 32.0.16.1088. - `pixel_aot_warp`: Passed on WARP 10.0.26100.9818. - Every draw reports `debug_errors=0` and `max_absolute_error=0`. Each test runs 41 draws with this change and 40 on d311159; the extra draw is the new one. - `tests/pixel_aot_check.py binary` passes with the program added to the binary fixtures: LLVM 15.0.6 `llvm-mc` and `llvm-objcopy`, disassembled through `libLLVM-17.so` and `libLLVM-18.so` on Linux (no shared LLVM 15 library was available). Unchanged main passes the same check with both libraries. The Ubuntu CI job runs it with LLVM 15. - `tests/docs_links_check.py` and `tests/bidi_controls_check.py` pass. ## Evidence and follow-up The fixture is synthetic. Four constant words hold +inf, a quiet NaN, -0 and the smallest positive denormal, and each channel selects 1.0 or 0: +inf against the +inf bit (true), the quiet NaN against both NaN bits (true), -0 against the +0 bit (false) and the denormal against the +denormal bit (true). Each channel isolates one property, so an implementation that ignores the sign of zero or flushes the denormal fails. The +0 mask comes from a register, the others from an inline constant and literals, and the last comparison writes its wave32 lane mask to `s0` instead of VCC. Negative controls: a reference with any single channel flipped must report `pixel_mismatch`, and all four do. The controls also check the four `class32` calls and the literal and register masks, and refuse a negated mask and a missing operand. The translator on d311159 rejects the program at its first `v_cmp_class_f32`. Not measured here: signaling NaN inputs, which are not drawn, and whether Scarlett classifies a denormal input without flushing it first. Both are recorded in `docs/experiments.md`. ## 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: yes. Written with Claude; verified on the hardware listed above.
Classify the raw binary32 encoding into the ten LLVM ClassFlags classes and test it against an inline, literal or register mask, producing a tracked lane condition for v_cndmask_b32. The draw separates +inf, a quiet NaN, the sign of zero and an unflushed denormal, with one flipped reference per channel; the program joins the gfx1013 binary fixtures. A control that used v_cmp_class_f32 as an unsupported comparison now uses v_cmp_eq_f64.

AI-assisted: yes
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:40:44 +00:00
github manually merged commit bf446a224b into gh-pr/293/base 2026-11-26 21:40:46 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-21 21:28 UTC · original

At 3fdbe00, the merge conflicts are in tests/pixel_aot_check.py. Please keep the class-mask controls alongside main's ceiling case when reconciling the shared test runner.

**@⁠R0Y00** on GitHub · 2026-11-21 21:28 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/293#issuecomment-7069499002) At `3fdbe00`, the merge conflicts are in `tests/pixel_aot_check.py`. Please keep the class-mask controls alongside main's ceiling case when reconciling the shared test runner.
Author
Owner

@⁠Its3rr0rsWRLD on GitHub · 2026-11-21 21:42 UTC · original

Rebased onto b53bfb0 after #270 and #299. The only conflict was the check_binary fixture list: it keeps ceiling() from #270 and adds the class program. Nothing else changed.

ctest --preset dev --no-tests=error -R '^pixel_aot_' -V

At a0c078c (b53bfb0 plus this change), Windows 10 Enterprise 26H2 build 26300.9974, MSVC 14.51.36231, Windows SDK 10.0.26100.0 DXC:

  • pixel_aot_hardware: Passed, NVIDIA GeForce RTX 4070 Ti (10de:2782), driver 32.0.16.1088.
  • pixel_aot_warp: Passed, WARP 10.0.26100.9818.
  • 51 draws on each adapter against 50 on b53bfb0, every one debug_errors=0 and max_absolute_error=0.
  • tests/pixel_aot_check.py binary, the controls, docs_links_check.py and bidi_controls_check.py pass on Linux with LLVM 15.0.6 tools and libLLVM 17 and 18.

This branch merges cleanly with each of my other open pixel_aot pull requests.

**@⁠Its3rr0rsWRLD** on GitHub · 2026-11-21 21:42 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/293#issuecomment-7069657414) Rebased onto b53bfb0 after #270 and #299. The only conflict was the `check_binary` fixture list: it keeps `ceiling()` from #270 and adds the class program. Nothing else changed. ```powershell ctest --preset dev --no-tests=error -R '^pixel_aot_' -V ``` At a0c078c (b53bfb0 plus this change), Windows 10 Enterprise 26H2 build 26300.9974, MSVC 14.51.36231, Windows SDK 10.0.26100.0 DXC: - `pixel_aot_hardware`: Passed, NVIDIA GeForce RTX 4070 Ti (10de:2782), driver 32.0.16.1088. - `pixel_aot_warp`: Passed, WARP 10.0.26100.9818. - 51 draws on each adapter against 50 on b53bfb0, every one `debug_errors=0` and `max_absolute_error=0`. - `tests/pixel_aot_check.py binary`, the controls, `docs_links_check.py` and `bidi_controls_check.py` pass on Linux with LLVM 15.0.6 tools and libLLVM 17 and 18. This branch merges cleanly with each of my other open pixel_aot pull requests.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-21 21:58 UTC · original

At a0c078c the merge conflicts are in tests/pixel_aot_check.py. Retain the half-widening and literal arithmetic draws alongside the class-mask controls.

**@⁠R0Y00** on GitHub · 2026-11-21 21:58 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/293#issuecomment-7069849144) At `a0c078c` the merge conflicts are in `tests/pixel_aot_check.py`. Retain the half-widening and literal arithmetic draws alongside the class-mask controls.
Author
Owner

@⁠Its3rr0rsWRLD on GitHub · 2026-11-21 21:59 UTC · original

Rebased onto 1292d15 after #279. The only conflict was the check_binary fixture list: it keeps scalar64() from #279 and adds the class program. Nothing else changed.

ctest --preset dev --no-tests=error -R '^pixel_aot_' -V

At dc4496c (1292d15 plus this change), same machine as before: pixel_aot_hardware (RTX 4070 Ti, driver 32.0.16.1088) and pixel_aot_warp (WARP 10.0.26100.9818) pass with 55 draws each against 54 on 1292d15, every one debug_errors=0 and max_absolute_error=0. tests/pixel_aot_check.py binary, the controls and docs_links_check.py pass on Linux with LLVM 15.0.6 tools and libLLVM 17 and 18.

**@⁠Its3rr0rsWRLD** on GitHub · 2026-11-21 21:59 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/293#issuecomment-7069865058) Rebased onto 1292d15 after #279. The only conflict was the `check_binary` fixture list: it keeps `scalar64()` from #279 and adds the class program. Nothing else changed. ```powershell ctest --preset dev --no-tests=error -R '^pixel_aot_' -V ``` At dc4496c (1292d15 plus this change), same machine as before: `pixel_aot_hardware` (RTX 4070 Ti, driver 32.0.16.1088) and `pixel_aot_warp` (WARP 10.0.26100.9818) pass with 55 draws each against 54 on 1292d15, every one `debug_errors=0` and `max_absolute_error=0`. `tests/pixel_aot_check.py binary`, the controls and `docs_links_check.py` pass on Linux with LLVM 15.0.6 tools and libLLVM 17 and 18.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-22 02:56 UTC · original

A test merge of dc4496c against main conflicts in docs/experiments.md and tests/pixel_aot_check.py. Keep the class-mask cases alongside the landed whole-quad coordinates and unfused MAD/MAC draws. Please refresh the branch and rerun the relevant fixture and Windows CI.

**@⁠R0Y00** on GitHub · 2026-11-22 02:56 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/293#issuecomment-7073225815) A test merge of `dc4496c` against main conflicts in `docs/experiments.md` and `tests/pixel_aot_check.py`. Keep the class-mask cases alongside the landed whole-quad coordinates and unfused MAD/MAC draws. Please refresh the branch and rerun the relevant fixture and Windows CI.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-22 03:08 UTC · original

Of your open pixel branches, please update only #293 for now. The earlier file-level feedback here still applies. Once it lands we’ll select the next branch from #324 and the SDWA changes against that main.

**@⁠R0Y00** on GitHub · 2026-11-22 03:08 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/293#issuecomment-7073346824) Of your open pixel branches, please update only #293 for now. The earlier file-level feedback here still applies. Once it lands we’ll select the next branch from #324 and the SDWA changes against that main.
Author
Owner

@⁠Its3rr0rsWRLD on GitHub · 2026-11-22 03:20 UTC · original

I'm Claude Opus 5.5, replying from Its3rr0rsWRLD's account.

Rebased onto fb4fb85. The conflicts were in docs/experiments.md and tests/pixel_aot_check.py. Both keep main's additions and add the class-mask cases next to them:

  • the integer comparison draws and the whole-quad affine coordinates paragraph stay in place, with the v_cmp_class_f32 helpers and paragraph after them;
  • the check_binary fixture list keeps affine_coordinates(), ceiling() and scalar64() and appends the class program.

The unfused MAD/MAC draws from #288 are untouched. Nothing else changed.

ctest --preset dev --no-tests=error -R '^pixel_aot_' -V

At bf446a2 (fb4fb85 plus this change), Windows 10 Enterprise 26H2 build 26300.9974, MSVC 14.51.36231, Windows SDK 10.0.26100.0 DXC:

  • pixel_aot_hardware: passed in 43.1 s, NVIDIA GeForce RTX 4070 Ti (10de:2782), driver 32.0.16.1088.
  • pixel_aot_warp: passed in 8.6 s, WARP 10.0.26100.9818.
  • 92 draws on each adapter, every one debug_errors=0 and max_absolute_error=0.
  • tests/pixel_aot_check.py binary, the controls and docs_links_check.py pass on Linux with LLVM 15.0.6 tools and libLLVM 17 and 18.
**@⁠Its3rr0rsWRLD** on GitHub · 2026-11-22 03:20 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/293#issuecomment-7073471883) *I'm Claude Opus 5.5, replying from Its3rr0rsWRLD's account.* Rebased onto fb4fb85. The conflicts were in `docs/experiments.md` and `tests/pixel_aot_check.py`. Both keep main's additions and add the class-mask cases next to them: - the integer comparison draws and the whole-quad affine coordinates paragraph stay in place, with the `v_cmp_class_f32` helpers and paragraph after them; - the `check_binary` fixture list keeps `affine_coordinates()`, `ceiling()` and `scalar64()` and appends the class program. The unfused MAD/MAC draws from #288 are untouched. Nothing else changed. ```powershell ctest --preset dev --no-tests=error -R '^pixel_aot_' -V ``` At bf446a2 (fb4fb85 plus this change), Windows 10 Enterprise 26H2 build 26300.9974, MSVC 14.51.36231, Windows SDK 10.0.26100.0 DXC: - `pixel_aot_hardware`: passed in 43.1 s, NVIDIA GeForce RTX 4070 Ti (10de:2782), driver 32.0.16.1088. - `pixel_aot_warp`: passed in 8.6 s, WARP 10.0.26100.9818. - 92 draws on each adapter, every one `debug_errors=0` and `max_absolute_error=0`. - `tests/pixel_aot_check.py binary`, the controls and `docs_links_check.py` pass on Linux with LLVM 15.0.6 tools and libLLVM 17 and 18.
This discussion has been locked. Commenting is limited to contributors.
No description provided.