shader: support Wave32 exec_lo execution mask operations in pixel_aot #678

Merged
Holastor merged 2 commits from upstream-pr/684 into main 2026-11-23 11:13:03 +00:00
Holastor commented 2026-11-22 19:56:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-22T19:56:48Z.


Summary

In RDNA 2 / GFX1013 Wave32 mode, execution masks operate on 32-bit exec_lo and are commonly saved to and restored from single SGPRs (sN), as well as restored directly via s_mov. Previously, pixel_aot only recognized Wave64 SGPR pairs (s[N:N+1]) and 64-bit exec, causing Wave32 shaders to fail with unsupported instruction errors on s_mov_b64 and s_and_b64.

This change:

  • Supports saving exec_lo to a single SGPR via s_mov_b64 or s_mov_b32.
  • Supports whole-quad mode on exec_lo via s_wqm_b64 or s_wqm_b32.
  • Supports restoring exec_lo from a single SGPR via s_and_b64 / s_and_b32 or direct s_mov_b64 / s_mov_b32.
  • Keeps full backward compatibility with Wave64 exec and SGPR pairs.
  • Aligns tools/scan_unsupported_shaders.py and tools/pixel_cb_read.py with the recognized Wave32 forms.
  • Adds test coverage and negative controls in tests/pixel_aot_check.py and tests/rdna2_tools_check.py.

Verification

python -B tests/pixel_aot_check.py
python -B tests/rdna2_tools_check.py
python -B tests/pso_readiness_check.py
python -B tests/form_coverage_check.py
python -B tests/docs_links_check.py
python -B tests/bidi_controls_check.py

All 6 test suites passed:

  • tests/pixel_aot_check.py: Wave32 execution mask lifecycle, direct restore, and negative controls passed.
  • tests/rdna2_tools_check.py: Ran 54 tests (including test_accepted_full_shader_wave32 and test_accepted_full_shader_wave32_direct_restore), all passed.
  • tests/pso_readiness_check.py: Passed.
  • tests/form_coverage_check.py: Passed.
  • tests/docs_links_check.py: Checked 10 Markdown files and 127 links, all passed.
  • tests/bidi_controls_check.py: Checked 580 tracked files, all passed.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6547034782 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/684). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-22T19:56:48Z. --- ## Summary In RDNA 2 / GFX1013 Wave32 mode, execution masks operate on 32-bit `exec_lo` and are commonly saved to and restored from single SGPRs (`sN`), as well as restored directly via `s_mov`. Previously, `pixel_aot` only recognized Wave64 SGPR pairs (`s[N:N+1]`) and 64-bit `exec`, causing Wave32 shaders to fail with unsupported instruction errors on `s_mov_b64` and `s_and_b64`. This change: - Supports saving `exec_lo` to a single SGPR via `s_mov_b64` or `s_mov_b32`. - Supports whole-quad mode on `exec_lo` via `s_wqm_b64` or `s_wqm_b32`. - Supports restoring `exec_lo` from a single SGPR via `s_and_b64` / `s_and_b32` or direct `s_mov_b64` / `s_mov_b32`. - Keeps full backward compatibility with Wave64 `exec` and SGPR pairs. - Aligns `tools/scan_unsupported_shaders.py` and `tools/pixel_cb_read.py` with the recognized Wave32 forms. - Adds test coverage and negative controls in `tests/pixel_aot_check.py` and `tests/rdna2_tools_check.py`. ## Verification ```powershell python -B tests/pixel_aot_check.py python -B tests/rdna2_tools_check.py python -B tests/pso_readiness_check.py python -B tests/form_coverage_check.py python -B tests/docs_links_check.py python -B tests/bidi_controls_check.py ``` All 6 test suites passed: - `tests/pixel_aot_check.py`: Wave32 execution mask lifecycle, direct restore, and negative controls passed. - `tests/rdna2_tools_check.py`: Ran 54 tests (including `test_accepted_full_shader_wave32` and `test_accepted_full_shader_wave32_direct_restore`), all passed. - `tests/pso_readiness_check.py`: Passed. - `tests/form_coverage_check.py`: Passed. - `tests/docs_links_check.py`: Checked 10 Markdown files and 127 links, all passed. - `tests/bidi_controls_check.py`: Checked 580 tracked files, all passed.
upstream-sync closed this pull request 2026-11-24 06:44:18 +00:00
R0Y00 commented 2026-11-24 06:44:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T07:20:26Z.

Review: DISMISSED


The pair-range fixes and RX 9070 XT retest look good. I found one remaining restore boundary: the lowerer currently accepts a 32-bit restore after s_wqm_b64 exec, exec with no established wave32 input, and the shorthand s_mov_b64 exec, s50 checks only s50 even when the saved pair’s s51 was overwritten. Please keep the full-width restore tied to both saved halves. Require an explicit wave32 precondition for low-only restores, or reject mixed-width streams whose upper half is unknown. Add controls for a clobbered high SGPR and a b64 expansion followed by a low-only restore without that precondition.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6017778747 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/684#pullrequestreview-6017778747). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T07:20:26Z. **Review:** DISMISSED --- The pair-range fixes and RX 9070 XT retest look good. I found one remaining restore boundary: the lowerer currently accepts a 32-bit restore after `s_wqm_b64 exec, exec` with no established wave32 input, and the shorthand `s_mov_b64 exec, s50` checks only `s50` even when the saved pair’s `s51` was overwritten. Please keep the full-width restore tied to both saved halves. Require an explicit wave32 precondition for low-only restores, or reject mixed-width streams whose upper half is unknown. Add controls for a clobbered high SGPR and a b64 expansion followed by a low-only restore without that precondition.
Holastor commented 2026-11-24 06:48:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-22T21:53:19Z.


Thank you for the thorough review and hardware verification @thepatrickworld!

I have addressed all three points in the updated commit:

  1. 64-bit pair tracking for single-SGPR s_mov_b64: In ools/pixel_aot.py, when s_mov_b64 saves an execution mask to a single SGPR sN, we now validate that N % 2 == 0 and N + 1 <= 105, ensure s{N+1} has no pending load, and track both halves: scalar[sN] = (mask, 0) and scalar[s{N+1}] = (mask, 1). Added fixtures in ests/pixel_aot_check.py verifying that:
    • ['s_mov_b64 s50, exec_lo', 's_wqm_b64 exec_lo, exec_lo', 's_and_b64 exec, exec, s[50:51]']
    • ['s_mov_b64 s50, exec_lo', 's_wqm_b64 exec_lo, exec_lo', 's_mov_b64 exec, s[50:51]']
      translate byte-identically to ase_wave32. Added negative controls rejecting unaligned single registers (e.g. s51) and ensuring s_mov_b32 cannot satisfy a 64-bit pair restore.
  2. Width-aware scanner patterns: In ools/scan_unsupported_shaders.py, separated s_mov_b64 / s_mov_b32 and s_and_b64 / s_and_b32 so _b32 instructions strictly reject register pairs, and s_and_b64 exec, exec requires a pair operand.
  3. Scanner-translator agreement table: Added est_exec_mask_scanner_translator_agreement in ests/rdna2_tools_check.py asserting is_instruction_supported(line) == translator_accepts(line) across all valid and invalid save and restore spellings.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7086389559 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/684#issuecomment-7086389559). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-22T21:53:19Z. --- Thank you for the thorough review and hardware verification @thepatrickworld! I have addressed all three points in the updated commit: 1. **64-bit pair tracking for single-SGPR s_mov_b64**: In ools/pixel_aot.py, when s_mov_b64 saves an execution mask to a single SGPR sN, we now validate that N % 2 == 0 and N + 1 <= 105, ensure s{N+1} has no pending load, and track both halves: scalar[sN] = (mask, 0) and scalar[s{N+1}] = (mask, 1). Added fixtures in ests/pixel_aot_check.py verifying that: - ['s_mov_b64 s50, exec_lo', 's_wqm_b64 exec_lo, exec_lo', 's_and_b64 exec, exec, s[50:51]'] - ['s_mov_b64 s50, exec_lo', 's_wqm_b64 exec_lo, exec_lo', 's_mov_b64 exec, s[50:51]'] translate byte-identically to ase_wave32. Added negative controls rejecting unaligned single registers (e.g. s51) and ensuring s_mov_b32 cannot satisfy a 64-bit pair restore. 2. **Width-aware scanner patterns**: In ools/scan_unsupported_shaders.py, separated s_mov_b64 / s_mov_b32 and s_and_b64 / s_and_b32 so _b32 instructions strictly reject register pairs, and s_and_b64 exec, exec requires a pair operand. 3. **Scanner-translator agreement table**: Added est_exec_mask_scanner_translator_agreement in ests/rdna2_tools_check.py asserting is_instruction_supported(line) == translator_accepts(line) across all valid and invalid save and restore spellings.
thepatrickworld commented 2026-11-24 06:48:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-22T21:22:04Z.


Verification: #684 shader: accept the Wave32 execution mask lifecycle

Head 8e85a052, merged with main. Five files, +144/−8. Unlike the coverage PRs, this one changes
three tools: tools/pixel_aot.py, tools/pixel_cb_read.py and tools/scan_unsupported_shaders.py.

What it changes

The execution-mask lifecycle was only understood in its Wave64 spelling, where exec is an SGPR
pair. On RDNA4 a wave32 shader names the same register as a single 32-bit exec_lo. The PR teaches
the three parsers to accept both spellings:

  • save: s_mov_b64|s_mov_b32 sN, exec|exec_lo, or s_mov_b64 s[N:N+1], exec|exec_lo;
  • WQM: s_wqm_b64|s_wqm_b32 exec|exec_lo, exec|exec_lo while the mask is still entry;
  • restore: s_and_b64|s_and_b32 exec|exec_lo, exec|exec_lo, sN, or s_mov_b64 exec|exec_lo, sN.

The mask bookkeeping is untouched: the same quad → entry transition fires either way.

Environment

Windows 11 25H2 (build 26200.9711), MSVC 19.44.35230, DXC 1.9.2602.17, AMD RX 9070 XT
(vendor 1002, device 7550), driver 32.0.32029.2010, native wave64.

Commands and output

cmake --preset dev -DINTAKE_PYTHON=<venv>
cmake --build --preset dev --parallel 12
set XBOX2WINDOWS_ADAPTER=AMD Radeon RX 9070 XT
ctest --preset dev --no-tests=error -R "^pixel_aot_|rdna2_tools"
100% tests passed out of 23

Twenty-two pixel_aot_* plus rdna2_tools_check, which is the one that covers the other two tools
this PR edits. Nothing pre-existing changed behaviour.

Negative control: I removed exec_lo from the save pattern
((?:s_mov_b64|s_mov_b32) sN, (?:exec|exec_lo) → (?:exec)), which makes s_mov_b64 s14, exec_lo
unrecognised, and re-ran ^pixel_aot_hardware$:

0% tests passed, 1 tests failed out of 1

The Wave32 cases do catch a parser that stops accepting exec_lo.

The reserve: two real bugs the suite cannot see

The central assertion is translate(w32) == translate(base_wave32): four Wave32 spellings must
produce byte-identical HLSL to the Wave64 original. That is the right property for a translator whose
output is wave-agnostic — but it also means nothing here observes a wave32 shader executing on
hardware
, and there is more than that wrong underneath.

(a) The save loses the high half of a pair. This is not a hypothetical dialect. The repository's own
disassembler emits the single-register spelling for every SOP1/SOP2 _b64: tools/disasm_rdna2.py
formats those with decode_s_reg, and only SOPC/VOPC reach decode_s_reg64. So a real encoding
s_mov_b64 s[50:51], exec (word 0xBE32807E) comes out as s_mov_b64 s50, exec_lo, and the matching
restore as s_and_b64 exec_lo, exec_lo, s50. That is the normal output of this project's toolchain
on a wave64 shader, not a fiction.

The parser then records only scalar["s50"] = ("entry", 0). The high half is dropped, so a following
s_and_b64 exec, exec, s[50:51] is rejected even though the shader is legal. The fixture cannot see
it: its four variants are width-consistent, and the one s15 read it builds is an expected rejection.

(b) The scanner and the translator disagree, and the scanner drives the instruction-level accounting.
scan_unsupported_shaders.py l. 72 accepts s_mov_b64 with a single destination and s_mov_b32
with a pair destination, with no cross-constraint between mnemonic and width. The translator is strict.
Measured on the two real functions:

line                                     scanner  translator
s_mov_b32 s[50:51], exec                 True     REJECT (unsupported instruction)
s_mov_b32 exec_lo, s[50:51]              True     REJECT (unsupported instruction)
s_mov_b64 s50, exec_lo (disasm form)     True     ACCEPT
s_and_b64 exec, exec, s14                False    REJECT (semantics)

Correction, after re-reading the scanner: the impact is narrower than I first wrote. is_fully_supported is
opcodes_recognized and translator_accepted (l. 457), and translator_accepted comes from a real
lower() call (l. 423-433) — so a shader pixel_aot refuses was never counted as fully supported,
and docs/coverage/*.tsv is generated by form_reference.py from the LLVM .rst, not by this
scanner.

What is actually wrong is the per-instruction accounting: out/shader-scan/PROGRESS.md and
progress.json report "Supported Instruction Instances", the coverage percentage, the
partially supported category, and the per-line ranking of blocking opcodes. These two spellings are
counted as supported there while the translator rejects them, so the denominator and the blocking-opcode
ranking are both off. Still a bug shipped by this PR, still invisible to my runs because both fixtures
are width-consistent — but not a claim about is_fully_supported.

(c) The three parsers have already diverged. Not a risk for later: in this very PR the scanner and
the translator no longer agree on those two spellings. rdna2_tools_check passes because it only
checks that the scanner returns True on a list of accepted forms, never that the translator agrees.

What I would add

  1. In pixel_aot.py around l. 1517: if the mnemonic is b64 with a single destination, record the
    high half too (scalar[reg] = (mask, 0) and scalar[reg+1] = (mask, 1)), or reject explicitly.
    Then a case that must now be accepted:

    ["s_mov_b64 s50, exec_lo", "s_wqm_b64 exec_lo, exec_lo", "s_and_b64 exec, exec, s[50:51]"]
    

    Today it is rejected; it should translate identically to the wave64 original.

  2. Make the scanner patterns width-aware, one line each:

    r"s_mov_b64\s+(?:s\[\d+:\d+\],\s+(?:exec|exec_lo)|(?:exec|exec_lo),\s+s\[\d+:\d+\])"
    r"s_mov_b32\s+(?:s\d+,\s+(?:exec|exec_lo)|(?:exec|exec_lo),\s+s\d+)"
    
  3. An agreement table in rdna2_tools_check.py (~10 lines): for each spelling, assert
    is_instruction_supported(line) == (translate(...) accepts). That kills the class of bug (b), not
    just this instance.

What this does not prove

  • Nothing about wave32 execution: this card reports native wave64 and no test forces wave32.
  • Nothing about s_wqm_b32 with a partial mask, or exec_lo inside a branch.
  • Nothing about the two other tools beyond rdna2_tools_check's own assertions, which — per (b) — do
    not compare them against the translator.

AI-assisted; runs executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7085996528 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/684#issuecomment-7085996528). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-22T21:22:04Z. --- **Verification: #684 `shader: accept the Wave32 execution mask lifecycle`** Head `8e85a052`, merged with `main`. Five files, +144/−8. Unlike the coverage PRs, this one changes three tools: `tools/pixel_aot.py`, `tools/pixel_cb_read.py` and `tools/scan_unsupported_shaders.py`. ### What it changes The execution-mask lifecycle was only understood in its Wave64 spelling, where `exec` is an SGPR pair. On RDNA4 a wave32 shader names the same register as a single 32-bit `exec_lo`. The PR teaches the three parsers to accept both spellings: - save: `s_mov_b64|s_mov_b32 sN, exec|exec_lo`, or `s_mov_b64 s[N:N+1], exec|exec_lo`; - WQM: `s_wqm_b64|s_wqm_b32 exec|exec_lo, exec|exec_lo` while the mask is still `entry`; - restore: `s_and_b64|s_and_b32 exec|exec_lo, exec|exec_lo, sN`, or `s_mov_b64 exec|exec_lo, sN`. The mask bookkeeping is untouched: the same `quad` → `entry` transition fires either way. ### Environment Windows 11 25H2 (build 26200.9711), MSVC 19.44.35230, DXC 1.9.2602.17, AMD RX 9070 XT (vendor `1002`, device `7550`), driver 32.0.32029.2010, native wave64. ### Commands and output ``` cmake --preset dev -DINTAKE_PYTHON=<venv> cmake --build --preset dev --parallel 12 set XBOX2WINDOWS_ADAPTER=AMD Radeon RX 9070 XT ctest --preset dev --no-tests=error -R "^pixel_aot_|rdna2_tools" ``` ``` 100% tests passed out of 23 ``` Twenty-two `pixel_aot_*` plus `rdna2_tools_check`, which is the one that covers the other two tools this PR edits. Nothing pre-existing changed behaviour. Negative control: I removed `exec_lo` from the save pattern (`(?:s_mov_b64|s_mov_b32) sN, (?:exec|exec_lo)` → `(?:exec)`), which makes `s_mov_b64 s14, exec_lo` unrecognised, and re-ran `^pixel_aot_hardware$`: ``` 0% tests passed, 1 tests failed out of 1 ``` The Wave32 cases do catch a parser that stops accepting `exec_lo`. ### The reserve: two real bugs the suite cannot see The central assertion is `translate(w32) == translate(base_wave32)`: four Wave32 spellings must produce byte-identical HLSL to the Wave64 original. That is the right property for a translator whose output is wave-agnostic — but it also means **nothing here observes a wave32 shader executing on hardware**, and there is more than that wrong underneath. `(a) The save loses the high half of a pair.` This is not a hypothetical dialect. The repository's own disassembler emits the single-register spelling for every SOP1/SOP2 `_b64`: `tools/disasm_rdna2.py` formats those with `decode_s_reg`, and only SOPC/VOPC reach `decode_s_reg64`. So a real encoding `s_mov_b64 s[50:51], exec` (word `0xBE32807E`) comes out as `s_mov_b64 s50, exec_lo`, and the matching restore as `s_and_b64 exec_lo, exec_lo, s50`. That is the *normal* output of this project's toolchain on a wave64 shader, not a fiction. The parser then records only `scalar["s50"] = ("entry", 0)`. The high half is dropped, so a following `s_and_b64 exec, exec, s[50:51]` is rejected even though the shader is legal. The fixture cannot see it: its four variants are width-consistent, and the one `s15` read it builds is an expected rejection. `(b) The scanner and the translator disagree, and the scanner drives the instruction-level accounting.` `scan_unsupported_shaders.py` l. 72 accepts `s_mov_b64` with a single destination *and* `s_mov_b32` with a pair destination, with no cross-constraint between mnemonic and width. The translator is strict. Measured on the two real functions: ``` line scanner translator s_mov_b32 s[50:51], exec True REJECT (unsupported instruction) s_mov_b32 exec_lo, s[50:51] True REJECT (unsupported instruction) s_mov_b64 s50, exec_lo (disasm form) True ACCEPT s_and_b64 exec, exec, s14 False REJECT (semantics) ``` **Correction, after re-reading the scanner: the impact is narrower than I first wrote.** `is_fully_supported` is `opcodes_recognized and translator_accepted` (l. 457), and `translator_accepted` comes from a real `lower()` call (l. 423-433) — so a shader `pixel_aot` refuses was never counted as fully supported, and `docs/coverage/*.tsv` is generated by `form_reference.py` from the LLVM `.rst`, not by this scanner. What is actually wrong is the per-instruction accounting: `out/shader-scan/PROGRESS.md` and `progress.json` report "Supported Instruction Instances", the coverage percentage, the `partially supported` category, and the per-line ranking of blocking opcodes. These two spellings are counted as supported there while the translator rejects them, so the denominator and the blocking-opcode ranking are both off. Still a bug shipped by this PR, still invisible to my runs because both fixtures are width-consistent — but not a claim about `is_fully_supported`. `(c) The three parsers have already diverged.` Not a risk for later: in this very PR the scanner and the translator no longer agree on those two spellings. `rdna2_tools_check` passes because it only checks that the scanner returns True on a list of accepted forms, never that the translator agrees. ### What I would add 1. In `pixel_aot.py` around l. 1517: if the mnemonic is `b64` with a single destination, record the high half too (`scalar[reg] = (mask, 0)` and `scalar[reg+1] = (mask, 1)`), or reject explicitly. Then a case that must now be accepted: ``` ["s_mov_b64 s50, exec_lo", "s_wqm_b64 exec_lo, exec_lo", "s_and_b64 exec, exec, s[50:51]"] ``` Today it is rejected; it should translate identically to the wave64 original. 2. Make the scanner patterns width-aware, one line each: ``` r"s_mov_b64\s+(?:s\[\d+:\d+\],\s+(?:exec|exec_lo)|(?:exec|exec_lo),\s+s\[\d+:\d+\])" r"s_mov_b32\s+(?:s\d+,\s+(?:exec|exec_lo)|(?:exec|exec_lo),\s+s\d+)" ``` 3. An agreement table in `rdna2_tools_check.py` (~10 lines): for each spelling, assert `is_instruction_supported(line) == (translate(...) accepts)`. That kills the class of bug (b), not just this instance. ### What this does not prove - Nothing about wave32 execution: this card reports native wave64 and no test forces wave32. - Nothing about `s_wqm_b32` with a partial mask, or `exec_lo` inside a branch. - Nothing about the two other tools beyond `rdna2_tools_check`'s own assertions, which — per (b) — do not compare them against the translator. _AI-assisted; runs executed locally._
thepatrickworld commented 2026-11-24 06:48:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-22T22:20:24Z.


Follow-up on f05ead9 — two fixes hold, three paths are still open

Re-ran on f05ead9: ctest --preset dev --no-tests=error -R "^pixel_aot_|^rdna2_" gives 23/23, including rdna2_tools_check. Note the head needed git reset --hard FETCH_HEAD, since the rewrite makes --ff-only fail — easy way to re-test the old commit by accident.

First, a correction to my own report

I wrote that is_fully_supported feeds docs/coverage/*.tsv and that a shader pixel_aot refuses was counted as supported. That is wrong, and I should have read the scanner before saying it. is_fully_supported = opcodes_recognized and translator_accepted (l. 457), and translator_accepted comes from a real lower() call (l. 423-433) — so a refused shader was never counted. docs/coverage/*.tsv is generated by form_reference.py from the LLVM .rst, not by this scanner.

The impact is narrower and still real: out/shader-scan/PROGRESS.md and progress.json report "Supported Instruction Instances", the coverage percentage, the partially supported category, and the per-line ranking of blocking opcodes. Those spellings are counted as supported there while the translator rejects them. I have edited my original comment accordingly.

What now holds

  • Pair tracking. s_mov_b64 s50, exec_lo followed by s_and_b64 exec, exec, s[50:51] is ACCEPT, and the output is byte-identical to the b32 baseline. Same with s_mov_b64 exec, s[50:51] as the restore.
  • Negative controls bite. s_mov_b64 s51, exec_lo → Invalid 64-bit scalar register pair: s51. s_mov_b32 cannot satisfy a pair restore.
  • The new code is load-bearing. Deleting scalar[f"s{n+1}"] = (mask, 1) fails 7 of 23 tests, rdna2_tools_check included.

Still open

1. The pair validation is applied on one path only. N % 2 == 0 and N + 1 <= 105 exist only for the mono-register spelling. The explicit pair path bypasses them:

s_mov_b64 s[49:50], exec    + pair restore  -> ACCEPT   (start odd)
s_mov_b64 s[105:106], exec  + pair restore  -> ACCEPT   (s106 is vcc_lo)
s_mov_b64 s[104:105], exec  + pair restore  -> ACCEPT   (legitimate upper bound)

sgpr_pair(), in the same file, refuses s[49:50] and s[105:106]. So the same instruction is invalid by one path and valid by another. Routing the pair token through sgpr_pair() closes it.

2. The mono-register spelling is accepted on save and rejected on restore. If it exists for a disassembler that prints s50 after s_mov_b64, it exists in both directions:

save s_mov_b64 s50, exec_lo + restore s_mov_b64 exec, s50   -> scanner True,  translator REJECT
save s_mov_b64 s[50:51], exec + restore s_mov_b32 exec, s50 -> scanner True,  translator REJECT
restore s_and_b64 exec, exec, s50                           -> scanner False, translator REJECT

Either the restore accepts it too, or the spelling is dropped on both sides — scanner included.

3. pixel_cb_read was not extended. My point (c) was about the three parsers; two were fixed.

pixel_cb_read.scalar_writes("s_mov_b64 s50, exec_lo")   -> {50}      <- high half lost
pixel_cb_read.scalar_writes("s_mov_b64 s[50:51], exec") -> {50, 51}

pixel_cb_read computes descriptor bases from scalar writes. A traced case where s51 holds a descriptor origin, then s_mov_b64 s50, exec_lo (which clobbers 50 and 51), then a copy of s51, makes first_descriptor return a live-looking base built from a dead register. Before this PR that path was unreachable because the translator rejected the spelling; this PR makes it reachable without fixing the third parser. The agreement table does not test pixel_cb_read.

4. The b32 patterns are still a wildcard. The pre-existing line 89, (?:s_mov_b32|s_movk_i32)\s+(?:s\d+|m0),\s+.*, accepts anything:

s_mov_b32 s50, exec_hi    -> scanner True, translator REJECT
s_mov_b32 s50, anything   -> scanner True

So "width-sensitive" holds for b64 only, and the scanner/translator mismatch survives through this door.

On the agreement table

It is not a tautology — the scanner regex and a real lower() call are two independent implementations, and the expected value is written out by hand for each case. That is the right shape, and it does close the class of bug I reported.

But it is 19 hand-written cases. The six lines above pass through it, it does not touch pixel_cb_read, and translator_accepts_* catches Exception blind, so a rejection for the wrong reason is indistinguishable from a semantic one. Enumerating mnemonic × dst × src and asserting zero disagreements in both directions would make it a real guard.

What I would ask

  1. Route the explicit pair token through sgpr_pair() instead of accepting it as-is.
  2. Symmetrise the mono-register restore, or drop that spelling everywhere including the scanner.
  3. Extend pixel_cb_read to cover both registers of a b64 destination.
  4. Frame the scanner impact as out/shader-scan/PROGRESS.md / progress.json, not is_fully_supported.

The core of (b) is genuinely fixed and the controls are good work. It is the "all three addressed" claim that does not hold yet.

AI-assisted; runs executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7086740380 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/684#issuecomment-7086740380). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-22T22:20:24Z. --- **Follow-up on `f05ead9` — two fixes hold, three paths are still open** Re-ran on `f05ead9`: `ctest --preset dev --no-tests=error -R "^pixel_aot_|^rdna2_"` gives **23/23**, including `rdna2_tools_check`. Note the head needed `git reset --hard FETCH_HEAD`, since the rewrite makes `--ff-only` fail — easy way to re-test the old commit by accident. ### First, a correction to my own report I wrote that `is_fully_supported` feeds `docs/coverage/*.tsv` and that a shader `pixel_aot` refuses was counted as supported. That is wrong, and I should have read the scanner before saying it. `is_fully_supported = opcodes_recognized and translator_accepted` (l. 457), and `translator_accepted` comes from a real `lower()` call (l. 423-433) — so a refused shader was never counted. `docs/coverage/*.tsv` is generated by `form_reference.py` from the LLVM `.rst`, not by this scanner. The impact is narrower and still real: `out/shader-scan/PROGRESS.md` and `progress.json` report "Supported Instruction Instances", the coverage percentage, the `partially supported` category, and the per-line ranking of blocking opcodes. Those spellings are counted as supported there while the translator rejects them. I have edited my original comment accordingly. ### What now holds - **Pair tracking.** `s_mov_b64 s50, exec_lo` followed by `s_and_b64 exec, exec, s[50:51]` is **ACCEPT**, and the output is **byte-identical to the `b32` baseline**. Same with `s_mov_b64 exec, s[50:51]` as the restore. - **Negative controls bite.** `s_mov_b64 s51, exec_lo` → `Invalid 64-bit scalar register pair: s51`. `s_mov_b32` cannot satisfy a pair restore. - **The new code is load-bearing.** Deleting `scalar[f"s{n+1}"] = (mask, 1)` fails **7 of 23** tests, `rdna2_tools_check` included. ### Still open **1. The pair validation is applied on one path only.** `N % 2 == 0` and `N + 1 <= 105` exist only for the mono-register spelling. The explicit pair path bypasses them: ``` s_mov_b64 s[49:50], exec + pair restore -> ACCEPT (start odd) s_mov_b64 s[105:106], exec + pair restore -> ACCEPT (s106 is vcc_lo) s_mov_b64 s[104:105], exec + pair restore -> ACCEPT (legitimate upper bound) ``` `sgpr_pair()`, in the same file, refuses `s[49:50]` and `s[105:106]`. So the same instruction is invalid by one path and valid by another. Routing the pair token through `sgpr_pair()` closes it. **2. The mono-register spelling is accepted on save and rejected on restore.** If it exists for a disassembler that prints `s50` after `s_mov_b64`, it exists in both directions: ``` save s_mov_b64 s50, exec_lo + restore s_mov_b64 exec, s50 -> scanner True, translator REJECT save s_mov_b64 s[50:51], exec + restore s_mov_b32 exec, s50 -> scanner True, translator REJECT restore s_and_b64 exec, exec, s50 -> scanner False, translator REJECT ``` Either the restore accepts it too, or the spelling is dropped on both sides — scanner included. **3. `pixel_cb_read` was not extended.** My point (c) was about the three parsers; two were fixed. ``` pixel_cb_read.scalar_writes("s_mov_b64 s50, exec_lo") -> {50} <- high half lost pixel_cb_read.scalar_writes("s_mov_b64 s[50:51], exec") -> {50, 51} ``` `pixel_cb_read` computes descriptor bases from scalar writes. A traced case where `s51` holds a descriptor origin, then `s_mov_b64 s50, exec_lo` (which clobbers 50 **and** 51), then a copy of `s51`, makes `first_descriptor` return a live-looking base built from a dead register. Before this PR that path was unreachable because the translator rejected the spelling; this PR makes it reachable without fixing the third parser. The agreement table does not test `pixel_cb_read`. **4. The `b32` patterns are still a wildcard.** The pre-existing line 89, `(?:s_mov_b32|s_movk_i32)\s+(?:s\d+|m0),\s+.*`, accepts anything: ``` s_mov_b32 s50, exec_hi -> scanner True, translator REJECT s_mov_b32 s50, anything -> scanner True ``` So "width-sensitive" holds for `b64` only, and the scanner/translator mismatch survives through this door. ### On the agreement table It is not a tautology — the scanner regex and a real `lower()` call are two independent implementations, and the expected value is written out by hand for each case. That is the right shape, and it does close the class of bug I reported. But it is 19 hand-written cases. The six lines above pass through it, it does not touch `pixel_cb_read`, and `translator_accepts_*` catches `Exception` blind, so a rejection for the wrong reason is indistinguishable from a semantic one. Enumerating mnemonic × dst × src and asserting zero disagreements in both directions would make it a real guard. ### What I would ask 1. Route the explicit pair token through `sgpr_pair()` instead of accepting it as-is. 2. Symmetrise the mono-register restore, or drop that spelling everywhere including the scanner. 3. Extend `pixel_cb_read` to cover both registers of a `b64` destination. 4. Frame the scanner impact as `out/shader-scan/PROGRESS.md` / `progress.json`, not `is_fully_supported`. The core of (b) is genuinely fixed and the controls are good work. It is the "all three addressed" claim that does not hold yet. _AI-assisted; runs executed locally._
Holastor commented 2026-11-24 06:48:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-22T22:47:17Z.


Thanks again @thepatrickworld for the razor-sharp review and for verifying all the edge cases!

All four points have been addressed in the latest push:

  1. Explicit pair validation routed through sgpr_pair():
    • Save (s_mov_b64 s[N:N+1], ...) and restore (s_and_b64 ..., s[N:N+1] and s_mov_b64 ..., s[N:N+1]) now route explicit register pairs through sgpr_pair().
    • Odd-aligned start (s[49:50]) and out-of-range bounds (s[105:106], clobbering vcc_lo) are now rejected on both save and restore paths, with negative controls added in tests/pixel_aot_check.py.
  2. Symmetrical mono-register restore:
    • Restores for mono-register sN now symmetrically accept both exec and exec_lo across s_and_b64, s_and_b32, s_mov_b64, and s_mov_b32 in both pixel_aot.py and scan_unsupported_shaders.py.
    • Verified in tests/pixel_aot_check.py and in test_exec_mask_scanner_translator_agreement in tests/rdna2_tools_check.py.
  3. pixel_cb_read.py covers both registers of 64-bit destination:
    • scalar_writes("s_mov_b64 s50, exec_lo") now returns range(50, 52) ({50, 51}), matching s[50:51].
    • Verified with assertions in tests/rdna2_tools_check.py.
  4. Tightened s_mov_b32 pattern in scanner:
    • Constrained (?:s_mov_b32|s_movk_i32) source from .* wildcard to (?:{SCALAR32_SOURCE}|exec|exec_lo), eliminating the hole where s_mov_b32 s50, exec_hi was accepted by the scanner.
    • Accurately framing the scanner accounting impact as per-instruction statistics (out/shader-scan/PROGRESS.md and progress.json).

All test suites pass locally (tests/rdna2_tools_check.py, tests/pixel_aot_check.py, tests/docs_links_check.py, tests/bidi_controls_check.py, tests/pso_readiness_check.py, tests/dxil_retarget_check.py).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7087079271 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/684#issuecomment-7087079271). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-22T22:47:17Z. --- Thanks again @thepatrickworld for the razor-sharp review and for verifying all the edge cases! All four points have been addressed in the latest push: 1. **Explicit pair validation routed through `sgpr_pair()`**: - Save (`s_mov_b64 s[N:N+1], ...`) and restore (`s_and_b64 ..., s[N:N+1]` and `s_mov_b64 ..., s[N:N+1]`) now route explicit register pairs through `sgpr_pair()`. - Odd-aligned start (`s[49:50]`) and out-of-range bounds (`s[105:106]`, clobbering `vcc_lo`) are now rejected on both save and restore paths, with negative controls added in `tests/pixel_aot_check.py`. 2. **Symmetrical mono-register restore**: - Restores for mono-register `sN` now symmetrically accept both `exec` and `exec_lo` across `s_and_b64`, `s_and_b32`, `s_mov_b64`, and `s_mov_b32` in both `pixel_aot.py` and `scan_unsupported_shaders.py`. - Verified in `tests/pixel_aot_check.py` and in `test_exec_mask_scanner_translator_agreement` in `tests/rdna2_tools_check.py`. 3. **`pixel_cb_read.py` covers both registers of 64-bit destination**: - `scalar_writes("s_mov_b64 s50, exec_lo")` now returns `range(50, 52)` (`{50, 51}`), matching `s[50:51]`. - Verified with assertions in `tests/rdna2_tools_check.py`. 4. **Tightened `s_mov_b32` pattern in scanner**: - Constrained `(?:s_mov_b32|s_movk_i32)` source from `.*` wildcard to `(?:{SCALAR32_SOURCE}|exec|exec_lo)`, eliminating the hole where `s_mov_b32 s50, exec_hi` was accepted by the scanner. - Accurately framing the scanner accounting impact as per-instruction statistics (`out/shader-scan/PROGRESS.md` and `progress.json`). All test suites pass locally (`tests/rdna2_tools_check.py`, `tests/pixel_aot_check.py`, `tests/docs_links_check.py`, `tests/bidi_controls_check.py`, `tests/pso_readiness_check.py`, `tests/dxil_retarget_check.py`).
thepatrickworld commented 2026-11-24 06:48:50 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-22T23:23:09Z.


Validated on c5a6503 — all four points hold

ctest --preset dev --no-tests=error -R "^pixel_aot_|^rdna2_" gives 23/23 on RDNA4 (RX 9070 XT, driver 32.0.32029.2010, MSVC 19.44.35230, DXC 1.9.2602.17). Each of the four points, re-measured on this head:

s_mov_b64 s[49:50], exec    + pair restore  -> REJECT  Invalid 64-bit scalar register pair: s[49:50]
s_mov_b64 s[105:106], exec  + pair restore  -> REJECT  Invalid 64-bit scalar register pair: s[105:106]
s_mov_b64 s[104:105], exec  + pair restore  -> ACCEPT

The legitimate upper bound still passes, so the fix is not over-broad — that was the thing I most expected to break.

save mono-reg s50 + restore s_mov_b64 exec, s50   -> ACCEPT
save pair       + restore s_mov_b32 exec, s50     -> ACCEPT
restore s_and_b64 exec, exec, s50                 -> ACCEPT

The mono-register spelling is now symmetric, and the scanner agrees on all three.

pixel_cb_read.scalar_writes("s_mov_b64 s50, exec_lo") -> {50, 51}
s_mov_b32 s50, exec_hi -> scanner False
s_mov_b32 s50, anything -> scanner False

Load-bearing, not cosmetic

With the sgpr_pair validation neutralised (if False: on the bounds check), 6 of 23 tests fail — pixel_aot_hardware, pixel_aot_buffer_color_hardware, pixel_aot_three_way_hardware and their _warp counterparts. So the negative controls you added actually pin the behaviour rather than merely existing.

One residual, non-blocking

s_mov_b64 s[49:50], exec still reports scanner=True while the translator rejects it, because the scanner checks the mnemonic and not operand alignment. That is a different class from the original bug — one instruction in the counter, not a shader wrongly counted as supported — but it is the same family, and a sentence in the scanner's docstring saying alignment is out of scope would close it honestly.

Nothing blocking left from my side.

AI-assisted; runs executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7087533840 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/684#issuecomment-7087533840). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-22T23:23:09Z. --- **Validated on `c5a6503` — all four points hold** `ctest --preset dev --no-tests=error -R "^pixel_aot_|^rdna2_"` gives **23/23** on RDNA4 (RX 9070 XT, driver 32.0.32029.2010, MSVC 19.44.35230, DXC 1.9.2602.17). Each of the four points, re-measured on this head: ``` s_mov_b64 s[49:50], exec + pair restore -> REJECT Invalid 64-bit scalar register pair: s[49:50] s_mov_b64 s[105:106], exec + pair restore -> REJECT Invalid 64-bit scalar register pair: s[105:106] s_mov_b64 s[104:105], exec + pair restore -> ACCEPT ``` The legitimate upper bound still passes, so the fix is not over-broad — that was the thing I most expected to break. ``` save mono-reg s50 + restore s_mov_b64 exec, s50 -> ACCEPT save pair + restore s_mov_b32 exec, s50 -> ACCEPT restore s_and_b64 exec, exec, s50 -> ACCEPT ``` The mono-register spelling is now symmetric, and the scanner agrees on all three. ``` pixel_cb_read.scalar_writes("s_mov_b64 s50, exec_lo") -> {50, 51} s_mov_b32 s50, exec_hi -> scanner False s_mov_b32 s50, anything -> scanner False ``` ### Load-bearing, not cosmetic With the `sgpr_pair` validation neutralised (`if False:` on the bounds check), **6 of 23** tests fail — `pixel_aot_hardware`, `pixel_aot_buffer_color_hardware`, `pixel_aot_three_way_hardware` and their `_warp` counterparts. So the negative controls you added actually pin the behaviour rather than merely existing. ### One residual, non-blocking `s_mov_b64 s[49:50], exec` still reports `scanner=True` while the translator rejects it, because the scanner checks the mnemonic and not operand alignment. That is a different class from the original bug — one instruction in the counter, not a shader wrongly counted as supported — but it is the same family, and a sentence in the scanner's docstring saying alignment is out of scope would close it honestly. Nothing blocking left from my side. _AI-assisted; runs executed locally._
Holastor commented 2026-11-24 06:49:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-23T09:20:33Z.


Updated against main (325fe1e) addressing both review points:

  1. Full-width restore tied to both saved halves:

    • In tools/pixel_aot.py, 64-bit restores (s_and_b64 and s_mov_b64) using mono-register shorthand sN now validate even register alignment (n % 2 == 0 and n + 1 <= 105) and check that both saved halves remain intact: [scalar.get(sN), scalar.get(s{N+1})] == [("entry", 0), ("entry", 1)].
    • Added controls in tests/pixel_aot_check.py and tests/rdna2_tools_check.py asserting rejection when the high SGPR (s51) has been clobbered prior to restore across s_mov_b64 exec, s50, s_and_b64 exec, exec, s50, and s_and_b64 exec, exec, s[50:51].
  2. Rejection of mixed-width restore streams:

    • tools/pixel_aot.py tracks the WQM expansion width (wqm_width of 64 vs 32).
    • Low-only restores (s_and_b32 and s_mov_b32) now require an established wave32 precondition (wqm_width == 32 and scalar.get(reg) == ("entry", "w32")).
    • A 64-bit WQM expansion (s_wqm_b64) followed by a 32-bit low-only restore without this precondition is rejected. A 32-bit WQM expansion followed by a 64-bit restore is likewise rejected.
    • Added negative controls covering these mixed-width combinations in tests/pixel_aot_check.py and tests/rdna2_tools_check.py.
  3. Native Wave32 canonical shader test:

    • Added test_accepted_full_shader_wave32_b32_lifecycle in tests/rdna2_tools_check.py covering an end-to-end pixel shader with native 32-bit save, WQM, and restore (s_mov_b32, s_wqm_b32, s_and_b32).

Verification

python -B tests/rdna2_tools_check.py
# Ran 70 tests in 1.324s, OK (skipped=1)

python -B tests/pixel_aot_check.py
# Return code: 0

python -B tests/docs_links_check.py
# Checked 13 Markdown files and 158 links: Self-test passed.

python -B tests/bidi_controls_check.py
# Checked 675 tracked source, script and build/CI files: no bidirectional controls.

python -B tests/pso_readiness_check.py
# PSO census, evidence states, and native hash control passed

python -B tests/form_coverage_check.py
# form coverage checks passed
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7096523650 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/684#issuecomment-7096523650). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-23T09:20:33Z. --- Updated against `main` (`325fe1e`) addressing both review points: 1. **Full-width restore tied to both saved halves**: - In `tools/pixel_aot.py`, 64-bit restores (`s_and_b64` and `s_mov_b64`) using mono-register shorthand `sN` now validate even register alignment (`n % 2 == 0 and n + 1 <= 105`) and check that both saved halves remain intact: `[scalar.get(sN), scalar.get(s{N+1})] == [("entry", 0), ("entry", 1)]`. - Added controls in `tests/pixel_aot_check.py` and `tests/rdna2_tools_check.py` asserting rejection when the high SGPR (`s51`) has been clobbered prior to restore across `s_mov_b64 exec, s50`, `s_and_b64 exec, exec, s50`, and `s_and_b64 exec, exec, s[50:51]`. 2. **Rejection of mixed-width restore streams**: - `tools/pixel_aot.py` tracks the WQM expansion width (`wqm_width` of 64 vs 32). - Low-only restores (`s_and_b32` and `s_mov_b32`) now require an established wave32 precondition (`wqm_width == 32` and `scalar.get(reg) == ("entry", "w32")`). - A 64-bit WQM expansion (`s_wqm_b64`) followed by a 32-bit low-only restore without this precondition is rejected. A 32-bit WQM expansion followed by a 64-bit restore is likewise rejected. - Added negative controls covering these mixed-width combinations in `tests/pixel_aot_check.py` and `tests/rdna2_tools_check.py`. 3. **Native Wave32 canonical shader test**: - Added `test_accepted_full_shader_wave32_b32_lifecycle` in `tests/rdna2_tools_check.py` covering an end-to-end pixel shader with native 32-bit save, WQM, and restore (`s_mov_b32`, `s_wqm_b32`, `s_and_b32`). ### Verification ```powershell python -B tests/rdna2_tools_check.py # Ran 70 tests in 1.324s, OK (skipped=1) python -B tests/pixel_aot_check.py # Return code: 0 python -B tests/docs_links_check.py # Checked 13 Markdown files and 158 links: Self-test passed. python -B tests/bidi_controls_check.py # Checked 675 tracked source, script and build/CI files: no bidirectional controls. python -B tests/pso_readiness_check.py # PSO census, evidence states, and native hash control passed python -B tests/form_coverage_check.py # form coverage checks passed ```
R0Y00 commented 2026-11-24 06:49:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T09:30:12Z.


The new controls at 30fd925 cover the clobbered high half and the mixed-width pairs. One point remains: wqm_width records which instruction was parsed. s_wqm_b32 sets it to 32 unconditionally, and s_mov_b32 records ("entry", "w32") from operand width alone. Neither value checks a guest wave-size declaration. On the current API the same b32 sequence lowers with no profile or metadata establishing wave32. Please tie the low-only path to a validated guest wave32 profile, with a control that the same instruction sequence is rejected when the profile is absent or wave64. The full-width save/restore checks can stay independent.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7096732581 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/684#issuecomment-7096732581). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T09:30:12Z. --- The new controls at `30fd925` cover the clobbered high half and the mixed-width pairs. One point remains: `wqm_width` records which instruction was parsed. `s_wqm_b32` sets it to 32 unconditionally, and `s_mov_b32` records `("entry", "w32")` from operand width alone. Neither value checks a guest wave-size declaration. On the current API the same b32 sequence lowers with no profile or metadata establishing wave32. Please tie the low-only path to a validated guest wave32 profile, with a control that the same instruction sequence is rejected when the profile is absent or wave64. The full-width save/restore checks can stay independent.
Holastor commented 2026-11-24 06:49:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-23T09:43:19Z.


Updated the low-only execution mask path to require a validated guest wave32 profile, and added negative controls for absent and wave64 profiles:

  1. Guest Wave Profile Requirement:

    • Added wave_size and wave_profile keyword arguments to pixel_aot.lower() (and forwarded through scan_unsupported_shaders.analyze_shader_instructions).
    • Profile values are validated (32, 64, "wave32", "wave64", or None); invalid values raise ValueError.
    • The low-only operations (s_mov_b32 save of exec_lo, s_wqm_b32 exec_lo, exec_lo, and s_and_b32 / s_mov_b32 restore) now require a validated guest wave32 profile (wave_size=32 or wave_profile="wave32"), raising ValueError when absent or set to wave64.
    • The full-width save/restore paths (s_mov_b64, s_wqm_b64, s_and_b64) remain independent of the profile declaration.
  2. Negative Controls and Parity Verification:

    • In tests/pixel_aot_check.py:
      • Verified that the low-only s_mov_b32 + s_wqm_b32 + s_and_b32 / s_mov_b32 sequences lower to bit-exact HLSL parity against the canonical wave64 lowering when wave_size=32 or wave_profile="wave32".
      • Verified that the same instruction sequences are rejected via must_reject when the profile is absent (None), wave64 (wave_size=64, wave_profile="wave64"), or invalid (wave_size=16, wave_profile="wave16").
    • In tests/rdna2_tools_check.py:
      • Updated test_accepted_full_shader_wave32_b32_lifecycle and test_exec_mask_scanner_translator_agreement to verify translator acceptance with wave_size=32 and assert rejection when the profile is absent or wave64.
  3. Test Results:

    • python -B tests/rdna2_tools_check.py: Ran 70 tests in 1.369s, OK (skipped=1)
    • python -B tests/pixel_aot_check.py: Self-test passed.
    • python -B tests/bidi_controls_check.py: Checked 675 tracked source, script and build/CI files: no bidirectional controls.
    • python -B tests/docs_links_check.py: Checked 13 Markdown files and 158 links.
    • python -B tests/pso_readiness_check.py: PSO census, evidence states, and native hash control passed
    • python -B tests/form_coverage_check.py: form coverage checks passed
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7097013518 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/684#issuecomment-7097013518). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-23T09:43:19Z. --- Updated the low-only execution mask path to require a validated guest wave32 profile, and added negative controls for absent and wave64 profiles: 1. **Guest Wave Profile Requirement**: - Added `wave_size` and `wave_profile` keyword arguments to `pixel_aot.lower()` (and forwarded through `scan_unsupported_shaders.analyze_shader_instructions`). - Profile values are validated (`32`, `64`, `"wave32"`, `"wave64"`, or `None`); invalid values raise `ValueError`. - The low-only operations (`s_mov_b32` save of `exec_lo`, `s_wqm_b32 exec_lo, exec_lo`, and `s_and_b32` / `s_mov_b32` restore) now require a validated guest wave32 profile (`wave_size=32` or `wave_profile="wave32"`), raising `ValueError` when absent or set to wave64. - The full-width save/restore paths (`s_mov_b64`, `s_wqm_b64`, `s_and_b64`) remain independent of the profile declaration. 2. **Negative Controls and Parity Verification**: - In `tests/pixel_aot_check.py`: - Verified that the low-only `s_mov_b32` + `s_wqm_b32` + `s_and_b32` / `s_mov_b32` sequences lower to bit-exact HLSL parity against the canonical wave64 lowering when `wave_size=32` or `wave_profile="wave32"`. - Verified that the same instruction sequences are rejected via `must_reject` when the profile is absent (`None`), wave64 (`wave_size=64`, `wave_profile="wave64"`), or invalid (`wave_size=16`, `wave_profile="wave16"`). - In `tests/rdna2_tools_check.py`: - Updated `test_accepted_full_shader_wave32_b32_lifecycle` and `test_exec_mask_scanner_translator_agreement` to verify translator acceptance with `wave_size=32` and assert rejection when the profile is absent or wave64. 3. **Test Results**: - `python -B tests/rdna2_tools_check.py`: `Ran 70 tests in 1.369s, OK (skipped=1)` - `python -B tests/pixel_aot_check.py`: `Self-test passed.` - `python -B tests/bidi_controls_check.py`: `Checked 675 tracked source, script and build/CI files: no bidirectional controls.` - `python -B tests/docs_links_check.py`: `Checked 13 Markdown files and 158 links.` - `python -B tests/pso_readiness_check.py`: `PSO census, evidence states, and native hash control passed` - `python -B tests/form_coverage_check.py`: `form coverage checks passed`
R0Y00 commented 2026-11-24 06:49:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T09:50:14Z.


ebea4ef now rejects the low-only stream with an absent or wave64 profile, and keeps the full-width checks. I found one API ambiguity to fix before merging: passing wave_size=64, wave_profile="wave32" silently selects wave32, although the caller also supplied contradictory metadata. Please keep one explicit guest-wave-size argument and document its provenance requirement at the entry point, or reject contradictory arguments with a control. Keep scanner and lowerer on the same rule.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7097154969 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/684#issuecomment-7097154969). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T09:50:14Z. --- `ebea4ef` now rejects the low-only stream with an absent or wave64 profile, and keeps the full-width checks. I found one API ambiguity to fix before merging: passing `wave_size=64, wave_profile="wave32"` silently selects wave32, although the caller also supplied contradictory metadata. Please keep one explicit guest-wave-size argument and document its provenance requirement at the entry point, or reject contradictory arguments with a control. Keep scanner and lowerer on the same rule.
Holastor commented 2026-11-24 06:49:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-23T09:56:32Z.


Updated in 1956565:

  1. Single Explicit wave_size Argument:

    • Removed the secondary wave_profile argument completely, leaving a single explicit wave_size: int | None = None parameter across both pixel_aot.lower() and scan_unsupported_shaders.analyze_shader_instructions.
    • Validates that wave_size in (32, 64) when provided, raising ValueError on any other value or type (e.g. 16 or "wave32"), and disallows any conflicting keyword arguments.
  2. Entry-Point Provenance Documentation:

    • Documented the provenance requirement at the entry point of both lower() and analyze_shader_instructions():
      """
      wave_size names the guest execution width (32 or 64). Low-only execution mask operations
      (s_mov_b32 save of exec_lo, s_wqm_b32, and s_and_b32/s_mov_b32 restore) require a validated
      guest wave32 profile (wave_size=32); native Scarlett/GFX10 wave64 operations remain independent
      of guest profile declarations.
      """
      
  3. Updated Controls & Consistency:

    • In tests/pixel_aot_check.py:
      • Asserted must_reject on invalid wave sizes (wave_size=16, wave_size="wave32").
    • In tests/rdna2_tools_check.py:
      • Asserted ValueError on invalid wave sizes (wave_size=16, wave_size="wave32") and TypeError on unexpected wave_profile keyword arguments.
      • Verified scanner/lowerer agreement on invalid wave size rejection (res_invalid["lower_error"] == "Invalid guest wave size: 16").

Verification

python -B tests/rdna2_tools_check.py
# Ran 70 tests in 1.321s, OK (skipped=1)

python -B tests/pixel_aot_check.py
# Return code: 0

python -B tests/docs_links_check.py
# Checked 13 Markdown files and 158 links: Self-test passed.

python -B tests/bidi_controls_check.py
# Checked 675 tracked source, script and build/CI files: no bidirectional controls.

python -B tests/pso_readiness_check.py
# PSO census, evidence states, and native hash control passed

python -B tests/form_coverage_check.py
# form coverage checks passed
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7097289641 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/684#issuecomment-7097289641). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-23T09:56:32Z. --- Updated in `1956565`: 1. **Single Explicit `wave_size` Argument**: - Removed the secondary `wave_profile` argument completely, leaving a single explicit `wave_size: int | None = None` parameter across both `pixel_aot.lower()` and `scan_unsupported_shaders.analyze_shader_instructions`. - Validates that `wave_size in (32, 64)` when provided, raising `ValueError` on any other value or type (e.g. `16` or `"wave32"`), and disallows any conflicting keyword arguments. 2. **Entry-Point Provenance Documentation**: - Documented the provenance requirement at the entry point of both `lower()` and `analyze_shader_instructions()`: ```python """ wave_size names the guest execution width (32 or 64). Low-only execution mask operations (s_mov_b32 save of exec_lo, s_wqm_b32, and s_and_b32/s_mov_b32 restore) require a validated guest wave32 profile (wave_size=32); native Scarlett/GFX10 wave64 operations remain independent of guest profile declarations. """ ``` 3. **Updated Controls & Consistency**: - In `tests/pixel_aot_check.py`: - Asserted `must_reject` on invalid wave sizes (`wave_size=16`, `wave_size="wave32"`). - In `tests/rdna2_tools_check.py`: - Asserted `ValueError` on invalid wave sizes (`wave_size=16`, `wave_size="wave32"`) and `TypeError` on unexpected `wave_profile` keyword arguments. - Verified scanner/lowerer agreement on invalid wave size rejection (`res_invalid["lower_error"] == "Invalid guest wave size: 16"`). ### Verification ```powershell python -B tests/rdna2_tools_check.py # Ran 70 tests in 1.321s, OK (skipped=1) python -B tests/pixel_aot_check.py # Return code: 0 python -B tests/docs_links_check.py # Checked 13 Markdown files and 158 links: Self-test passed. python -B tests/bidi_controls_check.py # Checked 675 tracked source, script and build/CI files: no bidirectional controls. python -B tests/pso_readiness_check.py # PSO census, evidence states, and native hash control passed python -B tests/form_coverage_check.py # form coverage checks passed ```
R0Y00 commented 2026-11-24 06:49:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T10:30:46Z.


Thanks for making wave_size the only profile argument. I resolved the conflict with the texture-offset change and pushed efd5461. The short-width save now checks the SGPR range, and the width argument must be an integer. The new LLVM 15 test assembles both low-half restore forms for gfx1013 wave32, decodes them, checks that they produce the reference HLSL, and rejects the same instructions under the wave64 profile. The full pixel binary checks and Python controls passed locally. The result covers encoding and lowering; we have no new native console capture.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7098083129 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/684#issuecomment-7098083129). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T10:30:46Z. --- Thanks for making `wave_size` the only profile argument. I resolved the conflict with the texture-offset change and pushed `efd5461`. The short-width save now checks the SGPR range, and the width argument must be an integer. The new LLVM 15 test assembles both low-half restore forms for gfx1013 wave32, decodes them, checks that they produce the reference HLSL, and rejects the same instructions under the wave64 profile. The full pixel binary checks and Python controls passed locally. The result covers encoding and lowering; we have no new native console capture.
thepatrickworld commented 2026-11-24 06:49:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T15:34:58Z.


Post-merge check of 87dd090: the mask tracking holds, and one SCC path stays stale. Translation probes, plus what I could and could not run.

What ran, and what did not

  • 87dd090 checked out on this host: python3 -B tests/rdna2_tools_check.py → 71 tests OK, 1 skipped (test_llvm_comparison, no libLLVM here), the four new wave32 acceptance tests included. check_controls also passes.
  • check_wave32_mask_binary needs llvm-mc-15 / llvm-objcopy-15 / libLLVM-15.so.1; this host has neither, so I did not re-run the binary comparison — CI runs it on Ubuntu.
  • This PR adds no draw, so there is no hardware pixel measurement to make here; everything below comes from lower() / translate() on hand-built programs.

The mask tracking behaves

Probed at 87dd090: s_mov_b32 s14, exec_lo is refused without a declared profile (32-bit execution mask save requires a validated wave32 guest profile) and accepted with wave_size=32; the b64 forms on exec_lo work with or without one; restore without save, double restore, a save taken inside the quad region, and mismatched save/restore widths all raise Unsupported execution mask; odd pairs raise Invalid 64-bit scalar register pair. The s_wqm_b32 gate is covered by the tests themselves (tests/rdna2_tools_check.py:2044, with wave_size absent, 64 and 16 cases beside it).

One silent-wrong-code path

The three save branches (tools/pixel_aot.py:1987, :1993, :2005) do not reset scc, while every other mask branch does (:2013, :2020, :2027, :2037, :2046, :2053, :2063, :2072). On hardware s_mov_b64 writes SCC. So this

s_and_b64 s[92:93], s[92:93], s[92:93]
s_mov_b64 s14, exec_lo
s_cselect_b64 s[90:91], s[92:93], s[94:95]

is accepted and lowers to

uint2 salu4 = uint2(1u & 1u, 0u & 0u);
uint2 salu6 = ((salu4.x | salu4.y) != 0u) ? uint2(salu4.x, salu4.y) : uint2(0u, 0u);

i.e. the s_cselect_b64 runs on the SCC left by the earlier s_and_b64, not on the exec mask the s_mov_b64 would have written. Wrong code, no diagnostic. The gap predates this PR for the bracketed form (s_mov_b64 s[a:b], exec had the same omission), but the two new save shapes replicate it, and the scc is None rejection for s_cselect (:2094) already exists to catch an untracked condition.

Smaller notes

  • A b64 save from exec_lo (:1987) is accepted without a declared wave size, while the b32 save is gated on wave_size=32 (:2006). One of the two orders is wrong; which one is a design call.
  • Under wave_size=32, a b64 save followed by a b32 restore is refused (Unsupported execution mask) because the half is labelled ("entry", 0) rather than ("entry", "w32"). That refuses a legal wave32 sequence rather than miscompiling it.

AI-assisted; probes executed locally. The SCC path and the line references come from a separate review pass and were reproduced here at 87dd090.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7105791239 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/684#issuecomment-7105791239). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-23T15:34:58Z. --- **Post-merge check of `87dd090`: the mask tracking holds, and one SCC path stays stale.** Translation probes, plus what I could and could not run. ### What ran, and what did not - `87dd090` checked out on this host: `python3 -B tests/rdna2_tools_check.py` → **71 tests OK, 1 skipped** (`test_llvm_comparison`, no `libLLVM` here), the four new wave32 acceptance tests included. `check_controls` also passes. - `check_wave32_mask_binary` needs `llvm-mc-15` / `llvm-objcopy-15` / `libLLVM-15.so.1`; this host has neither, so I did **not** re-run the binary comparison — CI runs it on Ubuntu. - This PR adds no draw, so there is no hardware pixel measurement to make here; everything below comes from `lower()` / `translate()` on hand-built programs. ### The mask tracking behaves Probed at `87dd090`: `s_mov_b32 s14, exec_lo` is refused without a declared profile (`32-bit execution mask save requires a validated wave32 guest profile`) and accepted with `wave_size=32`; the b64 forms on `exec_lo` work with or without one; restore without save, double restore, a save taken inside the quad region, and mismatched save/restore widths all raise `Unsupported execution mask`; odd pairs raise `Invalid 64-bit scalar register pair`. The `s_wqm_b32` gate is covered by the tests themselves (`tests/rdna2_tools_check.py:2044`, with `wave_size` absent, `64` and `16` cases beside it). ### One silent-wrong-code path The three save branches (`tools/pixel_aot.py:1987`, `:1993`, `:2005`) do not reset `scc`, while every other mask branch does (`:2013`, `:2020`, `:2027`, `:2037`, `:2046`, `:2053`, `:2063`, `:2072`). On hardware `s_mov_b64` writes SCC. So this ``` s_and_b64 s[92:93], s[92:93], s[92:93] s_mov_b64 s14, exec_lo s_cselect_b64 s[90:91], s[92:93], s[94:95] ``` is accepted and lowers to ```hlsl uint2 salu4 = uint2(1u & 1u, 0u & 0u); uint2 salu6 = ((salu4.x | salu4.y) != 0u) ? uint2(salu4.x, salu4.y) : uint2(0u, 0u); ``` i.e. the `s_cselect_b64` runs on the SCC left by the earlier `s_and_b64`, not on the exec mask the `s_mov_b64` would have written. Wrong code, no diagnostic. The gap predates this PR for the bracketed form (`s_mov_b64 s[a:b], exec` had the same omission), but the two new save shapes replicate it, and the `scc is None` rejection for `s_cselect` (`:2094`) already exists to catch an untracked condition. ### Smaller notes - A b64 save from `exec_lo` (`:1987`) is accepted without a declared wave size, while the b32 save is gated on `wave_size=32` (`:2006`). One of the two orders is wrong; which one is a design call. - Under `wave_size=32`, a b64 save followed by a b32 restore is refused (`Unsupported execution mask`) because the half is labelled `("entry", 0)` rather than `("entry", "w32")`. That refuses a legal wave32 sequence rather than miscompiling it. _AI-assisted; probes executed locally. The SCC path and the line references come from a separate review pass and were reproduced here at `87dd090`._
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!678
No description provided.