shader: open pixel_aot masked regions with s_mov_b64 exec save and VOPC e32 v_cmpx #950
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/957"
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 MasterDomino on 2026-11-23T18:45:59Z.
Change
The first stage scoped in #932:
tools/pixel_aot.pynow also opens the #651 masked region withs_mov_b64 s[a:b], execimmediately followed by a VOPC_e32v_cmpx.v_cmpx_class_f32is left out of this stage by choice; it can follow on the same opener.v_cmpx. EXEC becomes the entry mask intersected with the comparison, the same lane condition asv_cmppluss_and_saveexec_b64, so the existing region body rules and restore-time per-lane selects apply unchanged.s_mov_b64 exec, s[a:b]and the existings_or_b64 exec, exec, s[a:b], both on the saved pair. They stay distinct for SCC:v_cmpxands_mov_b64leave SCC tracked, ands_or_b64makes it unknown, so a later SCC reader rejects.v_cmpxdoes not write VCC; VCC keeps its tracked value. Thes_and_saveexec_b64region still closes only withs_or_b64.s_cbranch_execzmust sit right after thev_cmpxand land exactly on the matching restore (either spelling)._e64, SDWA, binary16, binary64, 16- and 64-bit integer and class forms, a VSRC1 that is not a VGPR, source modifiers, chained or nestedv_cmpx, wave32 saves, partial entry masks and else/kill shapes.The change refactors the restore merge into
close_region(), shared by both restores; the generated HLSL for #651 regions is unchanged.tools/scan_unsupported_shaders.pyis unchanged. It already reports the #651 region instructions (s_and_saveexec_b64, thes_or_b64restore,s_cbranch_execz) as unsupported line by line, because onlylower()can check the region structure. I followed that precedent rather than marking context-dependent lines as supported.One existing coverage assertion changed.
tests/form_coverage_check.pylistedv_cmpx_lt_i32andv_cmpx_lt_f32among the compare neighbours that must stay uncovered. This PR covers them, so they leave that set. The replacement checks are stricter:v_cmpxforms must equal exactly the 32 VOPC forms above, in bothgfx1013.tsvandrdna2.tsv;_e64spellings may be covered;v_cmpx_lt_i16,v_cmpx_lt_f16,v_cmpx_class_f32,v_cmpx_lt_i64andv_cmpx_lt_u64are asserted uncovered.Refs #932
Verification
Upstream
mainat0f0c3eb, Fedora 45 x86_64, Python 3.15.2, LLVM 15.0.7, DXC 1.9.2609.5 (Linux release, for the compile dry run only).All exit 0, and so do the 26 platform-independent checks,
tests/ffx_dispatch_aot_check.pywith LLVM 15 andtests/rdna2_tools_check.py.check_cmpx_controls):v_cmp(f32 with an SGPR, i32 with VGPRs, u32 with a literal,nlgwith-1.0).s_mov_b64close, VCC and SCC readers use the comparisons made before the region; after ans_or_b64close an SCC reader rejects withSelect condition is not a tracked scalar result.exec_losave, a save under the whole-quad mask, and a save overlapping a pending load;s_mov_b64close of ans_and_saveexec_b64region;v_cmpx, a nesteds_and_saveexec_b64, an elses_andn2_b64 exec, waits, loads, samples, exports and lane reads;check_cmpx_drawran with the real Linux DXC and only the D3D12 batch call replaced by a recorder: all 14 shaders compile, and 53 well-formed cases are written (48pass, 5mismatch).Not run here:
pixel_aot_cmpx_regions_warp. It needs Windows; this PR's CI run will be the first WARP result. Its checks, all compared bit for bit (tests/pixel_aot_render.cppcompares the expected and actual words, with a tolerance only when one is set):s_mov_b64restore, thes_or_b64restore and the skip, each on mixed (0.5), full (10) and empty (-1) masks;v_cmpxcomparison or invert SCC, and the signed shader against the unsigned truth table.No
_hardwarerun is reported.Evidence and follow-up
All fixtures are source-built in
tests/pixel_aot_check.py.The
EXEC_old & conddefinition comes from the RDNA 2 ISA guide (§6.2.2, §12.9) and from LLVM's gfx10.3 rewrite ofv_cmppluss_and_saveexecinto this pattern. WARP establishes the translated behaviour of the source-built fixtures, not gfx1013 execution.Impact on one local input (the 12,101 PS records from #932; aggregates only, decoded with
tools/disasm_rdna2.py). This re-measures the "4,379 structural candidates" from #932 with this PR's actual rules:_e32v_cmpx+ restore of the same pairREGION_ALUand whose skip, if any, targets the restoreMost regions are blocked by the existing #651 body rule. The first blocking body instruction is most often
s_load_dwordx4,s_nop,v_cvt_f32_ubyte2_e32,s_mov_b32orv_rcp_f32_e32. A record also needs everything outside its regions to translate, so this doesn't count translatable shaders.Follow-ups, separately validated as you suggested:
s_nop, more VALU ops);v_cmpx_class_f32;_e64;s_andn2_b64 exec, saved, exec;v_cmpx, wave32 saves, partial entry masks and kill.Checklist
docs/experiments.md, "Exec-masked pixel regions".)AI-assisted.
🤖 Generated with Claude Code
https://claude.ai/code/session_01B48PpcRN2Er51keRf2DsS5
Imported from R0Y00/Xbox2Windows. Originally posted by lantiumBot on 2026-11-23T20:07:18Z.
First
_hardwareresult for this draw, on RDNA 4. Data only.pixel_aot_cmpx_regions_hardwarepassed on an AMD Radeon RX 9060 XT at mergedmain, in the full hardware run below.f8e80e5663097c3ccc6fd35adbe4fba65e0fbf2e, clean tree,devpreset (Debug)One run, CTest verdict only. The run covered 137 tests: 133 passed, 1 capability skip (
bc7_mode6_multiblock_hardware), 3 failed. The three failures are the rows already recorded for RDNA 4 (dxr_opacity_hardware,gpu_alias_lookup_writes_hardware,pixel_aot_comparisons_hardware, #958).AI-assisted (Claude Code - Fable 5.2); runs executed locally on the adapter above.