shader: open wave32 v_cmpx masked regions in pixel_aot #2207

Merged
legacy-code-archaeologist merged 1 commit from upstream-pr/2215 into main 2026-11-25 05:37:48 +00:00
legacy-code-archaeologist commented 2026-11-25 05:32:52 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-25T05:32:52Z.


Refs #2137 (follow-up to #2163, which left this opener out).

Under the declared wave32 guest profile, lower(..., wave_size=32), a v_cmpx now opens a wave32 masked region when s_mov_b32 sN, exec_lo of the entry mask directly precedes it. The save is that one SGPR. The region closes and switches with the wave32 spellings from #2163 (s_mov_b32/s_or_b32 exec_lo, s_andn2_b32 exec_lo, skips), and the compare keeps VCC and SCC as the wave64 v_cmpx region does. #1315's author counted 4,681 such regions in their local input; that count is not checked here, and no corpus run is part of this PR.

Behaviour

  • b64 path unchanged: the opener only learns the second save spelling and writes the saved registers in a loop.
  • Refused with Unsupported v_cmpx execution mask save:
    • a save spelled exec instead of exec_lo;
    • a save that does not directly precede the compare;
    • a save taken after a whole-quad mask (s_wqm_b32 first).
  • Other refusals:
    • a pending save register: Write overlaps an outstanding scalar load;
    • a compare that reads the save register: Expected a numeric register;
    • a close on another SGPR, or the other width's close, else or skip spellings: as in #2163.
  • Inside the region: the saved SGPR may not be rewritten by a scalar load or ALU instruction; sN+1 is an ordinary register.
  • Without the profile: the s_mov_b32 save is still refused first, so check_cmpx_controls is unchanged.
  • Comments: two comments that claimed SCC is always untracked after the MOV close now say that it stays tracked after a v_cmpx opener.

Evidence

Commit 98e5d6ba on a8a7b1d6. The draws ran on the same code on ab9a020c; upstream has not changed any pixel_aot file since. Windows 11 build 26100, debug layer unavailable.

Check Result
python -B tests/pixel_aot_check.py pass
HLSL equality check_wave32_region_controls derives wave32 twins of every v_cmpx fixture and requires them to lower to identical HLSL. The fixtures are cmpx_region with both closes, cmpx_skip, cmpx_observables, the class regions, all CMPX_PREDICATE_GROUPS in e32 and e64, the f32/f16 class groups in e32 and e64, cmpx64_group i64/u64 × 2 × 2 (translate_int), cmpxf64_group over CMPF64_GROUPS (translate_f64), and the v_cmpx else, wait, scalar-ALU, scalar-load and body families. Each twin is also refused without the profile.
check_wave32_cmpx_refusals every refusal above, with its message
Scratch mutation run, not committed 4/4 fail the controls: the wave32 save not recognised, width 64 for it, the entry-mask check skipped for it, the exec spelling accepted
pixel_aot_cmpx_regions_warp (WARP 10.0.26100.8972) 44 batches, 7 of them wave32 twins (5 regions, 2 compare mutants). 251/251 pass cases match, 67/67 mismatch cases mismatch. 12 s against the 60 s limit.
pixel_aot_cmpx_regions_hardware, XBOX2WINDOWS_ADAPTER=Quadro (NVIDIA Quadro M1000M, 32.0.15.7371) same counts, 24 s
same, XBOX2WINDOWS_ADAPTER=Intel (Intel HD Graphics 530, 31.0.101.2111) same counts, 19 s
pixel_aot_check.py binary, LLVM 15.0.7, wave32 twins of cmpx_region (both closes) and cmpx_skip_asm with +wavefrontsize32,-wavefrontsize64 pass
ctest -R '^pixel_aot_' -E '_hardware$' -j 3 91/91
form_coverage_check, docs_links_check pass

I counted the draw statuses with a temporary print in run_pixel_batch, which is not part of this PR. The integer, binary64 and _e64 twins are covered by the equality control only and are not drawn. Like the #2163 draws, the wave32 draws lower to identical HLSL, so they add no pixel evidence beyond the equality control, and nothing here runs on gfx1013.

Not in this PR

  • A width for the condition tracker.
  • The scanner support list.
  • A command-line wave-size option.
  • The other translators.

AI-assisted.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6597938957 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2215). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-25T05:32:52Z. --- Refs #2137 (follow-up to #2163, which left this opener out). Under the declared wave32 guest profile, `lower(..., wave_size=32)`, a `v_cmpx` now opens a wave32 masked region when `s_mov_b32 sN, exec_lo` of the entry mask directly precedes it. The save is that one SGPR. The region closes and switches with the wave32 spellings from #2163 (`s_mov_b32`/`s_or_b32 exec_lo`, `s_andn2_b32 exec_lo`, skips), and the compare keeps VCC and SCC as the wave64 `v_cmpx` region does. #1315's author counted 4,681 such regions in their local input; that count is not checked here, and no corpus run is part of this PR. ## Behaviour - **b64 path unchanged:** the opener only learns the second save spelling and writes the saved registers in a loop. - **Refused** with `Unsupported v_cmpx execution mask save`: - a save spelled `exec` instead of `exec_lo`; - a save that does not directly precede the compare; - a save taken after a whole-quad mask (`s_wqm_b32` first). - **Other refusals:** - a pending save register: `Write overlaps an outstanding scalar load`; - a compare that reads the save register: `Expected a numeric register`; - a close on another SGPR, or the other width's close, else or skip spellings: as in #2163. - **Inside the region:** the saved SGPR may not be rewritten by a scalar load or ALU instruction; `sN+1` is an ordinary register. - **Without the profile:** the `s_mov_b32` save is still refused first, so `check_cmpx_controls` is unchanged. - **Comments:** two comments that claimed SCC is always untracked after the MOV close now say that it stays tracked after a `v_cmpx` opener. ## Evidence Commit 98e5d6ba on `a8a7b1d6`. The draws ran on the same code on `ab9a020c`; upstream has not changed any `pixel_aot` file since. Windows 11 build 26100, debug layer unavailable. | Check | Result | |---|---| | `python -B tests/pixel_aot_check.py` | pass | | HLSL equality | `check_wave32_region_controls` derives wave32 twins of every `v_cmpx` fixture and requires them to lower to identical HLSL. The fixtures are `cmpx_region` with both closes, `cmpx_skip`, `cmpx_observables`, the class regions, all `CMPX_PREDICATE_GROUPS` in e32 and e64, the f32/f16 class groups in e32 and e64, `cmpx64_group` i64/u64 × 2 × 2 (`translate_int`), `cmpxf64_group` over `CMPF64_GROUPS` (`translate_f64`), and the `v_cmpx` else, wait, scalar-ALU, scalar-load and body families. Each twin is also refused without the profile. | | `check_wave32_cmpx_refusals` | every refusal above, with its message | | Scratch mutation run, not committed | 4/4 fail the controls: the wave32 save not recognised, width 64 for it, the entry-mask check skipped for it, the `exec` spelling accepted | | `pixel_aot_cmpx_regions_warp` (WARP 10.0.26100.8972) | 44 batches, 7 of them wave32 twins (5 regions, 2 compare mutants). 251/251 pass cases match, 67/67 mismatch cases mismatch. 12 s against the 60 s limit. | | `pixel_aot_cmpx_regions_hardware`, `XBOX2WINDOWS_ADAPTER=Quadro` (NVIDIA Quadro M1000M, 32.0.15.7371) | same counts, 24 s | | same, `XBOX2WINDOWS_ADAPTER=Intel` (Intel HD Graphics 530, 31.0.101.2111) | same counts, 19 s | | `pixel_aot_check.py binary`, LLVM 15.0.7, wave32 twins of `cmpx_region` (both closes) and `cmpx_skip_asm` with `+wavefrontsize32,-wavefrontsize64` | pass | | `ctest -R '^pixel_aot_' -E '_hardware$' -j 3` | 91/91 | | `form_coverage_check`, `docs_links_check` | pass | I counted the draw statuses with a temporary print in `run_pixel_batch`, which is not part of this PR. The integer, binary64 and `_e64` twins are covered by the equality control only and are not drawn. Like the #2163 draws, the wave32 draws lower to identical HLSL, so they add no pixel evidence beyond the equality control, and nothing here runs on gfx1013. ## Not in this PR - A width for the condition tracker. - The scanner support list. - A command-line wave-size option. - The other translators. _AI-assisted._ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-25 06:01:31 +00:00
tedin7 commented 2026-11-25 06:01:31 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T05:36:04Z.

Review: COMMENTED


Review of head 98e5d6ba116d8a361055fdfc501035c9cb09a57e. P1: 0. P2: 0.

Logic: under the wave32 profile, s_mov_b32 sN, exec_lo directly before a v_cmpx now opens a width-32 region. The save must hold the entry mask (("entry", "w32")), not a whole-quad mask. Close and else use the wave32 spellings, and the compare keeps VCC and SCC as the wave64 opener does. Without the profile the save is refused. The region builder, the comments and the docs/experiments.md paragraph are consistent. No other open PR covers this opener.

Commands executed locally:

  • python3 tests/pixel_aot_check.py: rc 0 (the wave32 equality control now covers the v_cmpx fixtures, with refusals pinned in check_wave32_cmpx_refusals)
  • python3 tests/docs_links_check.py: pass (18 files, 408 links)
  • python3 tests/bidi_controls_check.py: pass
  • git diff --check origin/main...HEAD: clean
  • Mutation 1: region width set to 64 for the wave32 save. pixel_aot_check.py fails in check_wave32_region_controls. Killed.
  • Mutation 2: exec spelling accepted for the save. The same check fails. Killed. Both reverted.
  • Win2025 (WARP, MSVC 14.44, build 26100), x2w_pipe.py win2025 2215 --scope direct --targets offscreen_check --regex '^pixel_aot_(cmpx|exec)_regions_warp$': Debug 2/2 passed, Release 2/2 passed. This includes the new wave32 twin draws and mutants.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6052366128 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2215#pullrequestreview-6052366128). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T05:36:04Z. **Review:** COMMENTED --- Review of head `98e5d6ba116d8a361055fdfc501035c9cb09a57e`. P1: 0. P2: 0. Logic: under the wave32 profile, `s_mov_b32 sN, exec_lo` directly before a `v_cmpx` now opens a width-32 region. The save must hold the entry mask (`("entry", "w32")`), not a whole-quad mask. Close and else use the wave32 spellings, and the compare keeps VCC and SCC as the wave64 opener does. Without the profile the save is refused. The region builder, the comments and the docs/experiments.md paragraph are consistent. No other open PR covers this opener. Commands executed locally: - `python3 tests/pixel_aot_check.py`: rc 0 (the wave32 equality control now covers the v_cmpx fixtures, with refusals pinned in `check_wave32_cmpx_refusals`) - `python3 tests/docs_links_check.py`: pass (18 files, 408 links) - `python3 tests/bidi_controls_check.py`: pass - `git diff --check origin/main...HEAD`: clean - Mutation 1: region width set to 64 for the wave32 save. `pixel_aot_check.py` fails in `check_wave32_region_controls`. Killed. - Mutation 2: `exec` spelling accepted for the save. The same check fails. Killed. Both reverted. - Win2025 (WARP, MSVC 14.44, build 26100), `x2w_pipe.py win2025 2215 --scope direct --targets offscreen_check --regex '^pixel_aot_(cmpx|exec)_regions_warp$'`: Debug 2/2 passed, Release 2/2 passed. This includes the new wave32 twin draws and mutants. AI-assisted; commands listed were executed locally.
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!2207
No description provided.