tooling: list the masked-region exec forms as supported in scan_unsupported_shaders #2223

Merged
legacy-code-archaeologist merged 1 commit from upstream-pr/2231 into main 2026-11-25 06:38:41 +00:00
legacy-code-archaeologist commented 2026-11-25 06:34:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-25T06:34:02Z.


pixel_aot lowers the structured masked region in its wave64 spellings (#651, #1315) and, under the wave32 profile, in its wave32 spellings (#2163, #2215). tools/scan_unsupported_shaders.py still reported every exec line of such a region as unsupported, except the MOV close. On main, is_instruction_supported returns False for s_and_saveexec_b64 s[60:61], vcc, s_or_b64 exec, exec, s[60:61], s_andn2_b64 exec, s[60:61], exec, s_cbranch_execz 2 and their wave32 counterparts, even in programs the translator accepts.

Change

SUPPORTED_INSTRUCTIONS_REGEX now lists the forms pixel_aot lowers:

Role Wave64 Wave32
Opener s_and_saveexec_b64 s[a:b], vcc|s[c:d] s_and_saveexec_b32 sN, vcc_lo|sM
OR close s_or_b64 exec, exec, s[a:b] s_or_b32 exec_lo, exec_lo, sN
Else s_andn2_b64 exec, s[a:b], exec s_andn2_b32 exec_lo, sN, exec_lo
Empty-mask skip s_cbranch_execz <offset> same

As in pixel_aot (sgpr_name, sgpr_pair, the skip check), the exec forms take only an aligned SGPR pair or an SGPR up to s105. The skip takes a 16-bit signed displacement without leading zeros (int(..., 0) would raise on 010). The check applies only to these exec forms, so ordinary scalar s_or_*/s_andn2_* lines keep their current verdict. Whether a line sits in a well-formed region is still decided by the translator. The v_cmpx openers are not listed here.

Tests

Base a7ecaaa5.

Check Result
tests/rdna2_tools_check.py with LLVM 15.0.7 (LLVM_LIB, LLVM_MC, LLVM_OBJCOPY) 156 tests OK, 1 skip
New test_masked_region_forms_are_supported, the accepted forms all accepted, including the displacement and register limits (32767, -32768, 0x7fff, -0x8000, s105, s[104:105])
same, the refused forms all refused: neighbouring saveexec and exec forms, vcc in the wave32 opener, odd or out-of-range pairs, s106, displacements outside 16 bits and 010
same, ordinary scalar s_or/s_andn2 lines unchanged verdict
same, an if/else region in both widths through analyze_shader_instructions (wave_size=None and 32) accepted, no unsupported line, is_fully_supported, category accepted
The same test with the scanner change reverted fails
shader_census_check, shader_probe_check, shader_corpus_report_check, startup_triage_run_check pass

Census supported_instructions counts and percentages for shaders with masked regions rise accordingly. is_fully_supported was already decided by the translator and does not change.

AI-assisted.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6598729244 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2231). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-25T06:34:02Z. --- `pixel_aot` lowers the structured masked region in its wave64 spellings (#651, #1315) and, under the wave32 profile, in its wave32 spellings (#2163, #2215). `tools/scan_unsupported_shaders.py` still reported every exec line of such a region as unsupported, except the MOV close. On `main`, `is_instruction_supported` returns `False` for `s_and_saveexec_b64 s[60:61], vcc`, `s_or_b64 exec, exec, s[60:61]`, `s_andn2_b64 exec, s[60:61], exec`, `s_cbranch_execz 2` and their wave32 counterparts, even in programs the translator accepts. ## Change `SUPPORTED_INSTRUCTIONS_REGEX` now lists the forms `pixel_aot` lowers: | Role | Wave64 | Wave32 | |---|---|---| | Opener | `s_and_saveexec_b64 s[a:b], vcc\|s[c:d]` | `s_and_saveexec_b32 sN, vcc_lo\|sM` | | OR close | `s_or_b64 exec, exec, s[a:b]` | `s_or_b32 exec_lo, exec_lo, sN` | | Else | `s_andn2_b64 exec, s[a:b], exec` | `s_andn2_b32 exec_lo, sN, exec_lo` | | Empty-mask skip | `s_cbranch_execz <offset>` | same | As in `pixel_aot` (`sgpr_name`, `sgpr_pair`, the skip check), the exec forms take only an aligned SGPR pair or an SGPR up to `s105`. The skip takes a 16-bit signed displacement without leading zeros (`int(..., 0)` would raise on `010`). The check applies only to these exec forms, so ordinary scalar `s_or_*`/`s_andn2_*` lines keep their current verdict. Whether a line sits in a well-formed region is still decided by the translator. The `v_cmpx` openers are not listed here. ## Tests Base `a7ecaaa5`. | Check | Result | |---|---| | `tests/rdna2_tools_check.py` with LLVM 15.0.7 (`LLVM_LIB`, `LLVM_MC`, `LLVM_OBJCOPY`) | 156 tests OK, 1 skip | | New `test_masked_region_forms_are_supported`, the accepted forms | all accepted, including the displacement and register limits (`32767`, `-32768`, `0x7fff`, `-0x8000`, `s105`, `s[104:105]`) | | same, the refused forms | all refused: neighbouring saveexec and exec forms, `vcc` in the wave32 opener, odd or out-of-range pairs, `s106`, displacements outside 16 bits and `010` | | same, ordinary scalar `s_or`/`s_andn2` lines | unchanged verdict | | same, an if/else region in both widths through `analyze_shader_instructions` (`wave_size=None` and `32`) | accepted, no unsupported line, `is_fully_supported`, category `accepted` | | The same test with the scanner change reverted | fails | | `shader_census_check`, `shader_probe_check`, `shader_corpus_report_check`, `startup_triage_run_check` | pass | Census `supported_instructions` counts and percentages for shaders with masked regions rise accordingly. `is_fully_supported` was already decided by the translator and does not change. _AI-assisted._ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-25 07:01:08 +00:00
tedin7 commented 2026-11-25 07:01:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T06:37:16Z.

Review: COMMENTED


Review of head 4aff062965 (tools/scan_unsupported_shaders.py, tests/rdna2_tools_check.py).

Findings: 0 P1, 0 P2.

  • The new supported patterns (s_and_saveexec_b64/b32, s_or and s_andn2 exec forms, s_cbranch_execz) match the spellings pixel_aot lowers (sgpr_pair/sgpr_name, the execz displacement regex in the region lowering).
  • The extra checks in is_instruction_supported (aligned SGPR pair, SGPR <= s105, 16-bit signed execz displacement) mirror pixel_aot's refusals. Leading-zero decimals such as 010 are refused; that is conservative and safe.
  • The new test covers both wave widths, the neighbouring forms that must stay refused (saveexec or/andn2, execnz, xor exec, wrong operand order), and an end-to-end if/else region accepted by the translator.
  • No other open or merged PR covers the same patterns.

Commands run locally (Linux):

  • python3 -B -m unittest tests.rdna2_tools_check.TestRdna2Scanner.test_masked_region_forms_are_supported -> OK
  • python3 tests/docs_links_check.py -> pass (18 files, 417 links)
  • python3 tests/bidi_controls_check.py -> pass
  • git diff --check origin/main...HEAD -> clean
  • Mutations, each makes the new test FAIL (then git checkout -- .):
    1. execz upper bound 0x7fff -> 0xffff
    2. drop the even-pair alignment in _sgpr_pair_ok
    3. delete the s_or_b32 exec_lo supported pattern
  • Full tests.rdna2_tools_check: 5 errors, identical on origin/main (not caused by this PR).
  • CI: Build and test on Windows = pass, Run platform-independent Python checks on Linux = pass. The PR touches only .py files, so the Python-only fast path applies.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6052947405 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2231#pullrequestreview-6052947405). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T06:37:16Z. **Review:** COMMENTED --- Review of head 4aff0629651439af4fc6df15ec4fe68fccf59366 (tools/scan_unsupported_shaders.py, tests/rdna2_tools_check.py). Findings: 0 P1, 0 P2. - The new supported patterns (s_and_saveexec_b64/b32, s_or and s_andn2 exec forms, s_cbranch_execz) match the spellings pixel_aot lowers (sgpr_pair/sgpr_name, the execz displacement regex in the region lowering). - The extra checks in `is_instruction_supported` (aligned SGPR pair, SGPR <= s105, 16-bit signed execz displacement) mirror pixel_aot's refusals. Leading-zero decimals such as `010` are refused; that is conservative and safe. - The new test covers both wave widths, the neighbouring forms that must stay refused (saveexec or/andn2, execnz, xor exec, wrong operand order), and an end-to-end if/else region accepted by the translator. - No other open or merged PR covers the same patterns. Commands run locally (Linux): - `python3 -B -m unittest tests.rdna2_tools_check.TestRdna2Scanner.test_masked_region_forms_are_supported` -> OK - `python3 tests/docs_links_check.py` -> pass (18 files, 417 links) - `python3 tests/bidi_controls_check.py` -> pass - `git diff --check origin/main...HEAD` -> clean - Mutations, each makes the new test FAIL (then `git checkout -- .`): 1. execz upper bound `0x7fff` -> `0xffff` 2. drop the even-pair alignment in `_sgpr_pair_ok` 3. delete the `s_or_b32 exec_lo` supported pattern - Full `tests.rdna2_tools_check`: 5 errors, identical on origin/main (not caused by this PR). - CI: `Build and test on Windows` = pass, `Run platform-independent Python checks on Linux` = pass. The PR touches only .py files, so the Python-only fast path applies. 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!2223
No description provided.