shader: lower wave32 masked regions (s_and_saveexec_b32) in pixel_aot #2155
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2163"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-25T02:03:47Z.
Fixes #2137.
Under the declared wave32 guest profile,
lower(..., wave_size=32),s_and_saveexec_b32 sN, vcc_lo|sMopens the same structured masked region ass_and_saveexec_b64. A wave32 guest's EXEC isexec_lo, so the following forms work on the one saved SGPR:s_mov_b32 exec_lo, sNands_or_b32 exec_lo, exec_lo, sNclose the region.s_andn2_b32 exec_lo, sN, exec_loswitches it once to its else arm.s_cbranch_execztargets those spellings.The arm, join, skip, wait, scalar-load and scalar-ALU rules of the wave64 region apply unchanged.
Behaviour
Width: a region accepts only the close and else spellings of its own width. A wave32 form inside a wave64 region therefore keeps its existing
Instruction cannot run in a masked regionrefusal, and no existing pixel_aot assertion changes.Opener refusals (
Unsupported execution mask save):vcc, an SGPR pair, a constant, orexec_lo,m0,vcc_loor a pair as destination;Without the profile it is refused as
32-bit execution mask save requires a validated wave32 guest profile, and an out-of-range register keepsScalar register out of range.Other refusals: a close, else or skip onto another SGPR, a second transition and nesting. An SCC reader after either close is also refused, because the opener already leaves SCC unknown, as after the b64 MOV close.
Only
sNis saved: a write tosN+1inside a wave32 region is an ordinary scalar write.Condition tracking: the compare that writes the condition is tracked the same way in both profiles; no width is recorded for it.
Evidence
Base
be3c6c0e, Windows 11 build 26100, debug layer unavailable.python -B tests/pixel_aot_check.py, newcheck_wave32_region_controlswave_size=64andNone.scc = Noneafter thes_or_b32close, which no reader can observe.XBOX2WINDOWS_ADAPTER=Quadro(NVIDIA Quadro M1000M, 32.0.15.7371)XBOX2WINDOWS_ADAPTER=Intel(Intel HD Graphics 530, 31.0.101.2111)pixel_aot_check.py binary, LLVM 15.0.7, wave32 twins assembled and disassembled with+wavefrontsize32,-wavefrontsize64ctest -R '^pixel_aot_' -E '_hardware$' -j 3(before the final rebase)tests/form_coverage_check.py,tests/rdna2_tools_check.py(LLVM, 154 tests, 1 skip),docs_links_check,shader_census_check,shader_probe_checkThe wave32 draws lower to the same HLSL as their wave64 fixtures. They add form coverage records for
s_and_saveexec_b32, not new pixel evidence, and nothing here runs on gfx1013.Changed assertion (intended):
tests/form_coverage_check.pyno longer listss_and_saveexec_b32inrejected_forms. It now asserts that the form is accepted and covered asSOP1 s_and_saveexec_b32ingfx1013.tsv.Not in this PR
wave_size=32today, and there is no command-line option for it.tools/scan_unsupported_shaders.pyforwards awave_sizeargument, but itsSUPPORTED_INSTRUCTIONS_REGEXlist is unchanged.v_cmpxopener afters_mov_b32 sN, exec_lo, the compute translator's owns_and_saveexec_b32guard, and the other translators.AI-assisted.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:10:06Z.
Review: COMMENTED
Review of head
396367e776(comment only).Result: 0 P1, 0 P2.
Logic: s_and_saveexec_b32 on exec_lo is admitted only under a validated wave32 profile. It needs a tracked single-register condition, and a save into the condition register is refused. The region records width 32. Close and else spellings are accepted per width only (b32 forms in a 32-wide region, b64 forms in a 64-wide one). The skip target is matched against the single saved SGPR. Wave32 lowers to the same HLSL as its wave64 twin, and the tests assert exactly that across the plain, else, scalar-alu, wait, scalar-load and body families. The wrong-width, wrong-register and double-else controls are covered.
Commands run locally (worktree at this SHA):
Mutations (each reverted with git checkout -- .):
CI: Linux checks pass, fixtures pass, Build and test on Windows pass. The change touches only .py and .md files.
AI-assisted; commands listed were executed locally.