shader: admit modeled scalar ALU in pixel_aot masked regions #1057

Merged
romn4rch merged 2 commits from upstream-pr/1064 into main 2026-11-24 00:37:24 +00:00
romn4rch commented 2026-11-24 00:01:38 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by romn4rch on 2026-11-24T00:01:38Z.


Change

Implements the narrow scalar-ALU follow-up for #987 (Refs #987). Masked pixel_aot regions now accept only the existing lowerings for s_mov_b32, s_movk_i32, s_add_i32, s_mul_i32, signed s_cmp_*_i32, and s_cselect_b32, with inputs the scalar tracker can prove. Region-written SGPRs and SCC remain usable within that region but are treated as conditional after restore; reads reject until an unconditional rewrite. Scalar loads and other scalar operations remain refused. Both openers, save-pair checks, and existing empty-wave-skip rules are preserved.

Added translation controls, fixture binary round-trip inputs, WARP and hardware CTest entries, and experiment documentation. The draw fixture checks mixed, full, and empty masks and expects the unmasked reference to mismatch.

Verification

  • & .\out\pe-env\Scripts\python.exe -B tests\pixel_aot_check.py — passed.
  • cmake --build --preset dev --target offscreen_check — passed with the Visual Studio 2022 x64 developer environment loaded by tools/dev.ps1.
  • ctest --preset dev --no-tests=error -R '^pixel_aot_region_scalar_alu_warp$' -V — passed (1/1), Windows 11 build 26300, WARP backend. The deliberate unmasked-reference negative control was detected as a mismatch; no unexpected mismatch occurred.
  • ctest --preset dev --no-tests=error -R '^pixel_aot_region_waits_warp$' -V — passed (1/1), preserving the existing masked-wait stage.
  • & .\out\pe-env\Scripts\python.exe -B tests\docs_links_check.py — passed (15 Markdown files, 237 links).
  • & .\out\pe-env\Scripts\python.exe -B tests\bidi_controls_check.py — passed (889 tracked files checked).
  • git diff --check — passed.
  • LLVM 15 gfx1013 round-trip was not run because llvm-mc, llvm-objcopy, and LLVM-C.dll are unavailable in this environment.
  • The physical-GPU CTest was intentionally not run. No physical GPU result is claimed.

Evidence and follow-up

Fixtures are synthetic, source-built instruction sequences in tests/pixel_aot_check.py; no game files or proprietary binaries are used. WARP readback verifies only these fixtures and does not establish behavior for arbitrary shaders. The LLVM round-trip remains to be run in an environment with LLVM 15 gfx1013 support.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6571441138 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1064). Originally posted by [romn4rch](https://github.com/romn4rch) on 2026-11-24T00:01:38Z. --- ## Change Implements the narrow scalar-ALU follow-up for #987 (Refs #987). Masked pixel_aot regions now accept only the existing lowerings for `s_mov_b32`, `s_movk_i32`, `s_add_i32`, `s_mul_i32`, signed `s_cmp_*_i32`, and `s_cselect_b32`, with inputs the scalar tracker can prove. Region-written SGPRs and SCC remain usable within that region but are treated as conditional after restore; reads reject until an unconditional rewrite. Scalar loads and other scalar operations remain refused. Both openers, save-pair checks, and existing empty-wave-skip rules are preserved. Added translation controls, fixture binary round-trip inputs, WARP and hardware CTest entries, and experiment documentation. The draw fixture checks mixed, full, and empty masks and expects the unmasked reference to mismatch. ## Verification - `& .\out\pe-env\Scripts\python.exe -B tests\pixel_aot_check.py` — passed. - `cmake --build --preset dev --target offscreen_check` — passed with the Visual Studio 2022 x64 developer environment loaded by `tools/dev.ps1`. - `ctest --preset dev --no-tests=error -R '^pixel_aot_region_scalar_alu_warp$' -V` — passed (1/1), Windows 11 build 26300, WARP backend. The deliberate unmasked-reference negative control was detected as a mismatch; no unexpected mismatch occurred. - `ctest --preset dev --no-tests=error -R '^pixel_aot_region_waits_warp$' -V` — passed (1/1), preserving the existing masked-wait stage. - `& .\out\pe-env\Scripts\python.exe -B tests\docs_links_check.py` — passed (15 Markdown files, 237 links). - `& .\out\pe-env\Scripts\python.exe -B tests\bidi_controls_check.py` — passed (889 tracked files checked). - `git diff --check` — passed. - LLVM 15 gfx1013 round-trip was not run because `llvm-mc`, `llvm-objcopy`, and `LLVM-C.dll` are unavailable in this environment. - The physical-GPU CTest was intentionally not run. No physical GPU result is claimed. ## Evidence and follow-up Fixtures are synthetic, source-built instruction sequences in `tests/pixel_aot_check.py`; no game files or proprietary binaries are used. WARP readback verifies only these fixtures and does not establish behavior for arbitrary shaders. The LLVM round-trip remains to be run in an environment with LLVM 15 gfx1013 support. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted.
upstream-sync closed this pull request 2026-11-24 06:46:05 +00:00
R0Y00 commented 2026-11-24 06:49:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T00:18:46Z.


I resolved the shared scalar-tracker conflict and kept both mask invalidation and masked-region definedness. I also corrected the round-trip fixture: LLVM 15 rejects two distinct literal operands on the same scalar select, so the fixture materializes the same constants before the region. The full LLVM 15 binary suite and all six Windows Release masked-region tests passed on the integrated candidate (RTX 4060 Laptop and WARP).
Candidate: 8e45488a08

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7117934803 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1064#issuecomment-7117934803). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T00:18:46Z. --- I resolved the shared scalar-tracker conflict and kept both mask invalidation and masked-region definedness. I also corrected the round-trip fixture: LLVM 15 rejects two distinct literal operands on the same scalar select, so the fixture materializes the same constants before the region. The full LLVM 15 binary suite and all six Windows Release masked-region tests passed on the integrated candidate (RTX 4060 Laptop and WARP). Candidate: 8e45488a0886f3d40313af417588c4d22cacb270
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!1057
No description provided.