shader: lower the VOP3 (e64) v_cmpx region openers #1545

Merged
archielcqp-a11y merged 1 commit from upstream-pr/1552 into main 2026-11-24 14:25:29 +00:00
archielcqp-a11y commented 2026-11-24 13:51:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by archielcqp-a11y on 2026-11-24T13:51:44Z.


Refs #932

Summary

Every VOPC (e32) v_cmpx form already opens a masked region. This PR adds the same 95 comparisons in the VOP3 (_e64) encoding. On gfx10, VOP3 v_cmpx writes only EXEC and has no SGPR destination; LLVM 15 rejects v_cmpx_lt_f32_e64 s[0:1], v1, v2 for gfx1013.

Each _e64 opener lowers like the _e64 v_cmp of the same type on the same sources:

  • src1 may be an SGPR, an SGPR pair or a constant;
  • the binary16, binary32 and binary64 forms take neg and abs;
  • the binary64 forms still need the declared denormal state;
  • the v_cmpx_class_f32 mask is a constant or a register with no modifiers.

The region rules (entry-mask save, restores, skip branch, body) are unchanged.

An SGPR destination, clamp, output modifiers, modifiers on integer sources or on a class mask, and SDWA are rejected.

Fixture

pixel_aot_cmpx_e64_{warp,hardware} draws the predicate, class, 64-bit integer and binary64 groups of pixel_aot_cmpx_regions, with each comparison in its _e64 spelling.

Group _e64 spelling Reference Must mismatch
binary16 / binary32 predicates (8 programs) -v18, -s44, which has the same relation as s44, v18 the _e32 truth rows less and greater swapped, the result of a dropped modifier
integer predicates (8 programs) s44, s45 (SGPR src1) the _e32 truth rows operands reversed
class f32 / f16 constant mask, -0 read as |s46| +0 class the unmodified -0, and every channel flipped
i64 / u64 (4 programs) _e64 shapes of the v_cmp draw cmp64_expected(..., "e64", ...) signed shader against the unsigned reference
binary64 (5 programs) _e64 shapes, including -v[18:19] and |v[20:21]| cmpf64_expected("e64", ...) flipped channels

Translation controls:

  • Each _e64 opener must emit the same predicate as the _e64 v_cmp on the same sources, across all six integer, float and class kinds and four binary64 shapes.
  • The rejections above.
  • The _e64 groups are part of the LLVM 15 binary round trip.

Negative control on the translator itself: a mutant that strips the _e64 modifiers fails the WARP draw on the first binary32 group. Both reversed references matched, and two correct rows did not.

Results

Run on 309cfed with this change, Windows 10 build 19045, debug layer enabled on both adapters.

Test WARP 1.0.22 (app-local) NVIDIA GeForce RTX 3080, driver 32.0.15.9174
pixel_aot_cmpx_e64 pass pass
pixel_aot_cmpx_regions pass pass

Other checks:

  • pixel_aot, comparison and depth-mask tests (ctest -R 'pixel_aot|cmp|form_coverage|depth_mask'): 162 of 162 passed.
  • Translator controls (tests/pixel_aot_check.py with no arguments): pass.
  • LLVM 15 binary mode (tests/pixel_aot_check.py binary): pass.
  • Python checks: form_coverage_check, docs_links_check and bidi_controls_check pass.

No capability skips.

Coverage: the new test records all 95 VOP3 v_cmpx_*_e64 forms in both gfx1013.tsv and rdna2.tsv. Before this change, form_coverage_check asserted that these forms were uncovered. I did not rerun every record-writing test for a whole-suite total.

Not checked: the ISA intersection rule for EXEC is the same assumption as for the _e32 openers. No gfx1013 hardware run checks it.

cmake --build --preset dev --target offscreen_check
ctest --preset dev --no-tests=error -R '^pixel_aot_cmpx_(e64|regions)_(warp|hardware)$' -V

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6583313673 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1552). Originally posted by [archielcqp-a11y](https://github.com/archielcqp-a11y) on 2026-11-24T13:51:44Z. --- Refs #932 ## Summary Every VOPC (e32) `v_cmpx` form already opens a masked region. This PR adds the same 95 comparisons in the VOP3 (`_e64`) encoding. On gfx10, VOP3 `v_cmpx` writes only EXEC and has no SGPR destination; LLVM 15 rejects `v_cmpx_lt_f32_e64 s[0:1], v1, v2` for gfx1013. Each `_e64` opener lowers like the `_e64` `v_cmp` of the same type on the same sources: - src1 may be an SGPR, an SGPR pair or a constant; - the binary16, binary32 and binary64 forms take `neg` and `abs`; - the binary64 forms still need the declared denormal state; - the `v_cmpx_class_f32` mask is a constant or a register with no modifiers. The region rules (entry-mask save, restores, skip branch, body) are unchanged. An SGPR destination, `clamp`, output modifiers, modifiers on integer sources or on a class mask, and SDWA are rejected. ## Fixture `pixel_aot_cmpx_e64_{warp,hardware}` draws the predicate, class, 64-bit integer and binary64 groups of `pixel_aot_cmpx_regions`, with each comparison in its `_e64` spelling. | Group | `_e64` spelling | Reference | Must mismatch | |---|---|---|---| | binary16 / binary32 predicates (8 programs) | `-v18, -s44`, which has the same relation as `s44, v18` | the `_e32` truth rows | less and greater swapped, the result of a dropped modifier | | integer predicates (8 programs) | `s44, s45` (SGPR src1) | the `_e32` truth rows | operands reversed | | class f32 / f16 | constant mask, -0 read as `\|s46\|` | +0 class | the unmodified -0, and every channel flipped | | i64 / u64 (4 programs) | `_e64` shapes of the `v_cmp` draw | `cmp64_expected(..., "e64", ...)` | signed shader against the unsigned reference | | binary64 (5 programs) | `_e64` shapes, including `-v[18:19]` and `\|v[20:21]\|` | `cmpf64_expected("e64", ...)` | flipped channels | **Translation controls:** - Each `_e64` opener must emit the same predicate as the `_e64` `v_cmp` on the same sources, across all six integer, float and class kinds and four binary64 shapes. - The rejections above. - The `_e64` groups are part of the LLVM 15 binary round trip. **Negative control on the translator itself:** a mutant that strips the `_e64` modifiers fails the WARP draw on the first binary32 group. Both reversed references matched, and two correct rows did not. ## Results Run on `309cfed` with this change, Windows 10 build 19045, debug layer enabled on both adapters. | Test | WARP 1.0.22 (app-local) | NVIDIA GeForce RTX 3080, driver 32.0.15.9174 | |---|---|---| | `pixel_aot_cmpx_e64` | pass | pass | | `pixel_aot_cmpx_regions` | pass | pass | Other checks: - **pixel_aot, comparison and depth-mask tests** (`ctest -R 'pixel_aot|cmp|form_coverage|depth_mask'`): 162 of 162 passed. - **Translator controls** (`tests/pixel_aot_check.py` with no arguments): pass. - **LLVM 15 binary mode** (`tests/pixel_aot_check.py binary`): pass. - **Python checks:** `form_coverage_check`, `docs_links_check` and `bidi_controls_check` pass. No capability skips. **Coverage:** the new test records all 95 VOP3 `v_cmpx_*_e64` forms in both `gfx1013.tsv` and `rdna2.tsv`. Before this change, `form_coverage_check` asserted that these forms were uncovered. I did not rerun every record-writing test for a whole-suite total. **Not checked:** the ISA intersection rule for EXEC is the same assumption as for the `_e32` openers. No gfx1013 hardware run checks it. ```powershell cmake --build --preset dev --target offscreen_check ctest --preset dev --no-tests=error -R '^pixel_aot_cmpx_(e64|regions)_(warp|hardware)$' -V ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 15:01:58 +00:00
thepatrickworld commented 2026-11-24 15:02:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-24T14:07:00Z.


Independent GPU validation

Measured ca82d82e merged onto 8f438025 (my merge f57676c6, tree fbc3889d, working tree clean). Nothing below is a code change.

Environment

  • Windows 11 25H2, build 26200.9974
  • DXC 1.9.2602.17 (10.0.26100.0 user-mode)
  • hardware: AMD Radeon RX 9070 XT vendor=1002 device=7550, driver 32.0.32029.2010
  • warp: Microsoft Basic Render Driver vendor=1414 device=008c, driver 10.0.26100.9818
  • preset dev (Debug), debug_layer=unavailable — see the limitation below

Commands

ctest --preset dev --no-tests=error -R "^pixel_aot_cmpx_e64_(hardware|warp)$" -V
ctest --preset dev --no-tests=error -R "^pixel_aot_cmpx" -V

Observed

Two entries, three runs each: 6 passed, 0 failed, 0 skipped.

pixel_aot_cmpx_e64_hardware   Passed  12.37 / 11.01 / 10.90 s
pixel_aot_cmpx_e64_warp       Passed   7.28 /  7.23 /  7.21 s

Counting the fixture statically — from its own group tables, not off the log — the 16 predicate groups define 132 cases, 48 of which are -reversed cases whose expected outcome is a mismatch. The run is green on both backends, so each of those 48 expectations held: the drawn pixels discriminate the relation instead of passing on any answer. The class groups (f32 and f16, including -0 read as +0) and the 64-bit integer and binary64 groups are green too.

Regression

^pixel_aot_cmpx: 4 passed, 0 failed, 0 skipped — the existing e32 v_cmpx region entries still pass with this lowering in the tree.

Limits

  • One physical adapter, one driver. The debug layer is not installed here (0x887a002d, SDK component missing; the Graphics Tools optional feature is absent and its install is refused from a remote session with 0x80070005), so the run says nothing about D3D12 API validation — only that the drawn pixels match.
  • The fixture draws the SGPR, pair and constant src1 forms it generates. The rejected forms (SGPR destination, clamp, output modifiers, modifiers on integer sources or on a class mask, SDWA) are not exercised by these draws, and I did not look for a test that asserts those rejections.

AI-assisted; runs executed locally on the adapter above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7133864477 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1552#issuecomment-7133864477). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-24T14:07:00Z. --- ### Independent GPU validation Measured `ca82d82e` merged onto `8f438025` (my merge `f57676c6`, tree `fbc3889d`, working tree clean). Nothing below is a code change. **Environment** - Windows 11 25H2, build 26200.9974 - DXC 1.9.2602.17 (`10.0.26100.0` user-mode) - hardware: `AMD Radeon RX 9070 XT vendor=1002 device=7550`, driver `32.0.32029.2010` - warp: `Microsoft Basic Render Driver vendor=1414 device=008c`, driver `10.0.26100.9818` - preset `dev` (Debug), `debug_layer=unavailable` — see the limitation below **Commands** ```powershell ctest --preset dev --no-tests=error -R "^pixel_aot_cmpx_e64_(hardware|warp)$" -V ctest --preset dev --no-tests=error -R "^pixel_aot_cmpx" -V ``` **Observed** Two entries, three runs each: 6 passed, 0 failed, 0 skipped. ``` pixel_aot_cmpx_e64_hardware Passed 12.37 / 11.01 / 10.90 s pixel_aot_cmpx_e64_warp Passed 7.28 / 7.23 / 7.21 s ``` Counting the fixture statically — from its own group tables, not off the log — the 16 predicate groups define 132 cases, 48 of which are `-reversed` cases whose expected outcome is a mismatch. The run is green on both backends, so each of those 48 expectations held: the drawn pixels discriminate the relation instead of passing on any answer. The class groups (`f32` and `f16`, including `-0` read as `+0`) and the 64-bit integer and binary64 groups are green too. **Regression** `^pixel_aot_cmpx`: **4 passed, 0 failed, 0 skipped** — the existing e32 `v_cmpx` region entries still pass with this lowering in the tree. **Limits** - One physical adapter, one driver. The debug layer is not installed here (`0x887a002d`, SDK component missing; the Graphics Tools optional feature is absent and its install is refused from a remote session with `0x80070005`), so the run says nothing about D3D12 API validation — only that the drawn pixels match. - The fixture draws the SGPR, pair and constant src1 forms it generates. The rejected forms (SGPR destination, `clamp`, output modifiers, modifiers on integer sources or on a class mask, SDWA) are not exercised by these draws, and I did not look for a test that asserts those rejections. _AI-assisted; runs executed locally on the adapter above._
archielcqp-a11y commented 2026-11-24 15:02:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by archielcqp-a11y on 2026-11-24T14:16:36Z.


Whole-suite coverage measurement

The PR body said I had not measured a whole-suite total. I have now.

I ran the full suite (ctest -j 8 --output-junit) on ca82d82, Windows 10 build 19045, with the RTX 3080 and app-local WARP 1.0.22, then ran tools/form_coverage.py. To isolate this change, I compared the union of all form records with and without the v_cmpx_*_e64 mnemonics. On main the translator refused every one of them, so the second count matches main.

Reference Without this change With this change Added
gfx1013.tsv 1,130 of 1,968 1,225 of 1,968 95 (all VOP3 v_cmpx_*_e64)
rdna2.tsv 1,120 of 1,863 1,215 of 1,863 95

No other form changed. That run had 949 passes, 17 capability skips and 12 failures, none in a test this PR touches:

  • gpu_alias_window_hardware;
  • bvh_wave64_warp and wave_shuffle_warp (the WARP 1.0.22 issue #145);
  • startup_sampler_x_hardware and startup_sampler_x_swapped_hardware;
  • seven cpu_* archive, placed-draw and xmem tests.

I have not checked whether those 12 also fail on main under -j 8.

@thepatrickworld, thanks for the RX 9070 XT run. The rejected _e64 forms are asserted in the translator controls, not in the draws. check_cmpx_controls covers the SGPR destination, clamp, mul:2, modifiers on integer sources and on class masks, and literals wider than 16 bits; check_cmpf64_controls covers the binary64 rejections. Both run in pixel_aot_check.py with no arguments, and in the pixel_aot_{warp,hardware} entries.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7134114774 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1552#issuecomment-7134114774). Originally posted by [archielcqp-a11y](https://github.com/archielcqp-a11y) on 2026-11-24T14:16:36Z. --- ## Whole-suite coverage measurement The PR body said I had not measured a whole-suite total. I have now. I ran the full suite (`ctest -j 8 --output-junit`) on `ca82d82`, Windows 10 build 19045, with the RTX 3080 and app-local WARP 1.0.22, then ran `tools/form_coverage.py`. To isolate this change, I compared the union of all form records with and without the `v_cmpx_*_e64` mnemonics. On `main` the translator refused every one of them, so the second count matches `main`. | Reference | Without this change | With this change | Added | |---|---|---|---| | `gfx1013.tsv` | 1,130 of 1,968 | 1,225 of 1,968 | 95 (all VOP3 `v_cmpx_*_e64`) | | `rdna2.tsv` | 1,120 of 1,863 | 1,215 of 1,863 | 95 | No other form changed. That run had 949 passes, 17 capability skips and 12 failures, none in a test this PR touches: - `gpu_alias_window_hardware`; - `bvh_wave64_warp` and `wave_shuffle_warp` (the WARP 1.0.22 issue #145); - `startup_sampler_x_hardware` and `startup_sampler_x_swapped_hardware`; - seven `cpu_*` archive, placed-draw and xmem tests. I have not checked whether those 12 also fail on `main` under `-j 8`. @thepatrickworld, thanks for the RX 9070 XT run. The rejected `_e64` forms are asserted in the translator controls, not in the draws. `check_cmpx_controls` covers the SGPR destination, `clamp`, `mul:2`, modifiers on integer sources and on class masks, and literals wider than 16 bits; `check_cmpf64_controls` covers the binary64 rejections. Both run in `pixel_aot_check.py` with no arguments, and in the `pixel_aot_{warp,hardware}` entries. 🤖 Generated with [Claude Code](https://claude.com/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!1545
No description provided.