shader: refuse EXEC widening inside an open mesh lane-skip block #3443
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3443"
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 Leyukaka on 2026-11-29T09:16:08Z.
Part of #3416
Branch
shader-mesh-exec-widen, head958d341e, based on main1a0120ba. One commit:958d341emesh: refuse EXEC widening inside an open lane-skip blockFiles:
src/gfx1013_direct_mesh.inl,tests/native_direct_mesh_check.py.What changes
Inside an open
s_cbranch_execzskip, the frontend emits the remaining instructions under the skip's narrowed lane predicate. Ans_or_b64 exec, exec, s[x:y]widened the guest EXEC there, and so did ans_mov_b64 execrestore before the skip closed. The following instructions still ran only on the narrowed lanes, so the DXIL was wrong and nothing refused it.Inside an open skip, EXEC writes are now accepted only when they cannot widen past the skip's guard. Everything else is refused with
mesh EXEC write inside a lane-skip block, at two sites insrc/gfx1013_direct_mesh.inl(line numbers at the branch head):execorexec_hi, except:s_and_b64with EXEC as a source;s_andn2_b64with EXEC as source 0;s_or_b64 exec, exec, exec;s_mov_b64 exec, s[even<=104], which then goes to the second site.s_mov_b64 exec, s[x:y]restore, accepted only in two places:restores_exec, :148, :606-607, :846, read at :347).closed_nested_skip, :308/:331), when it restores the enclosing skip's guard. That guard isSkip::wave_guard(:216, stored at :626).The
inside-movcase reads a VGPR withv_readfirstlane_b32after such a widening; the readfirstlane condition isfull_exec || exec_skip(:1046). It is now refused at thes_or_b64.Evidence
On this head (base
1a0120ba): configure, buildcompile_dxil, thenResult:
native_direct_meshPassed.Refused cases:
widen-onlyat +0x28inside-movat +0x2cearly-exec-restoreat +0x28Accepted cases:
gather-exec-restoreandsigned-cmpx-exec-restore, which assertphi i32and-execandandn2-exec, which assertselect i1nested-exec-restoreMutation on this head, reverted afterwards:
false &&tests/native_direct_mesh_check.py:211:widen-onlycompiles instead of being refused (AssertionError)Mutations on the previous revision (b1b7548c on main
212d4b5f, same added and removed lines), not repeated on this head:false &&early-exec-restore: compiled, no refusals_or_b64exception loosened tosrc0==126 || src1==126widen-only: compiled, no refusal!diamond_exec_restore &&dropped at the second sitegather-exec-restore: refused at +0x50Not covered
s_and_b64/s_andn2_b64exceptionsrestores_execflags_or_b64 exec, exec, execexception has no case.s_mov_b64 exec, -1ands_mov_b64 exec, 1inside a skip are still refused earlier, by the existingmesh scalar branch crosses allocation, EXEC or exportcheck (:461-463, by reading).CI
On main
1a0120batheprtest preset filter inCMakePresets.jsondoes not matchnative_direct_mesh, and theprbuild preset does not listcompile_dxil.Build and test on Windowsdoes not exercise this change.Interactions with our other open mesh branches
This branch touches the same two files as #3439 (
f74eacc8) and the same test file as #3438 (0feac9c2). Bygit merge-tree --write-treeat these heads:shader-mesh-exchange-nosave(08cf44c8): cleanshader-mesh-udiv-ops(0f84c3ac): cleanThe combinations were not built.