shader: lower gfx1013 v_cmp_class_f32 in pixel_aot #289

Merged
Its3rr0rsWRLD merged 1 commit from upstream-pr/293 into main 2026-11-22 03:25:29 +00:00
Its3rr0rsWRLD commented 2026-11-21 21:08:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Its3rr0rsWRLD on 2026-11-21T21:08:20Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6534415547 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/293). Originally posted by [Its3rr0rsWRLD](https://github.com/Its3rr0rsWRLD) on 2026-11-21T21:08:20Z. --- ## 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.
upstream-sync closed this pull request 2026-11-24 06:42:16 +00:00
R0Y00 commented 2026-11-24 06:48:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T21:28:29Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069499002 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/293#issuecomment-7069499002). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-21T21:28:29Z. --- 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.
Its3rr0rsWRLD commented 2026-11-24 06:48:04 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Its3rr0rsWRLD on 2026-11-21T21:42:00Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069657414 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/293#issuecomment-7069657414). Originally posted by [Its3rr0rsWRLD](https://github.com/Its3rr0rsWRLD) on 2026-11-21T21:42:00Z. --- 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.
R0Y00 commented 2026-11-24 06:48:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T21:58:25Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069849144 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/293#issuecomment-7069849144). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-21T21:58:25Z. --- 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.
Its3rr0rsWRLD commented 2026-11-24 06:48:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Its3rr0rsWRLD on 2026-11-21T21:59:48Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069865058 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/293#issuecomment-7069865058). Originally posted by [Its3rr0rsWRLD](https://github.com/Its3rr0rsWRLD) on 2026-11-21T21:59:48Z. --- 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.
R0Y00 commented 2026-11-24 06:48:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T02:56:19Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7073225815 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/293#issuecomment-7073225815). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T02:56:19Z. --- 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 commented 2026-11-24 06:48:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T03:08:03Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7073346824 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/293#issuecomment-7073346824). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T03:08:03Z. --- 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.
Its3rr0rsWRLD commented 2026-11-24 06:48:22 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Its3rr0rsWRLD on 2026-11-22T03:20:15Z.


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.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7073471883 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/293#issuecomment-7073471883). Originally posted by [Its3rr0rsWRLD](https://github.com/Its3rr0rsWRLD) on 2026-11-22T03:20:15Z. --- *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.
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!289
No description provided.