shader: lower two-armed CMPX if/else regions in wave64 pixel stages #3815
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3815"
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 lukaslw-lab on 2026-12-02T02:35:27Z.
Change
Wave64 pixel stages can now lower a two-armed if/else on a compare that writes EXEC:
pixel_readonly_arms(src/gfx1013_direct_graphics.inl) took only the one-armed skip whose target is the restore. Itnow also takes a skip that lands on the ELSE mask, if that mask complements the saved pair and is followed by an
EXECZ skip to the matching restore. Each arm follows the same rules as the one-armed body: lane-local ALU, scalar
loads, image loads, waits. Each lane takes one arm. The ELSE skip branches per lane on the same compare bit (a lane
that ran THEN goes to the join), and VGPRs merge per lane at both masks. A scalar written in THEN is dropped at the
ELSE mask, and anything written in either arm is dropped at the restore. An inner SAVEEXEC is not accepted in the
two-armed form.
Two smaller parts, both needed by the real shapes:
v_readfirstlane_b32is allowed inside an arm. The lowering still refuses it unless its source is wave-uniform.for pixel stages, and only readfirstlane reads that set.
Refs #3814 (census), #3640, #3641.
Verification
Commit
c8096e0eon mainb7d61632, release build, Windows 10 19045.ctest --preset release -R '^native_pixel_cmpx_if_else_controls$'native_pixel_cmpx_if_else_check.py ... warpwith anoffscreen_checkbuilt against Agility 1.620.2 + WARP 1.0.22ctest --preset release -R '^native_'(the same change at3cad3f73on main3ecfbad7; RTX 3080 Ti, driver 32.0.16.1047, debug layer)_warpare SM 6.6 draws on the Windows 10 in-box runtime; the same 73 fail with upstreamgfx1013_direct_graphics.inlon this build.The in-box WARP of Windows 10 19041 rejects
ps_6_6/vs_6_6, so_warpfails there in the same way asnative_pixel_cmpx_discard_warp. It needs the Agility runtime or a newer WARP.The Linux Python job is also red on main
b7d61632:tests/startup_stubs_ci_check.py(#3656) fails after theworkflow change in #3690. This change does not touch either.
Mutations (local, then reverted):
both-armsdraw fails.then-scalar-read-in-elsetranslates and the control fails.readfirstlane-uniformis refused and the control fails.Evidence and follow-up
The fixtures are source-built gfx1013 words in a synthetic pixel container, written for this test.
_warpdraws an8x2 target with v0 = SV_Position.x, so each pixel shows the value its own arm wrote. A swapped reference, an all-THEN
reference and an all-ELSE reference must all fail. Cases:
Refusals:
Offline census of the captured slot 86 pixel stages (#3814): 322 of the 3,370 distinct stages at "graphics branch on
a wave mask" move on (574 requests). The pixel stages of the 24 Mesh86 draws selected in one local run pass every CMPX
region. Their next walls are not touched here: 18 stop at an interpolation after a branch in a looping shader, 6 at a
readfirstlane before any region. Nested CMPX inside an arm and uniform branches inside an arm stay refused.
Checklist
AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T02:41:34Z.
Confirmed the Linux job fails
tests/startup_stubs_ci_check.pyon the current base. #3817 fixes the coverage-only false positive and preserves the full-suite guards. Once it lands, please refresh this PR against main to get a clean Linux run.