gfx2hlsl: support v_cmpx_* with prior exec_lo save in wave-level if/else blocks #3802
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3802
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3800"
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?
@Holastor on GitHub · 2026-12-01 23:44 UTC · original
Holastor:dxil/execz-vcmpx-else-branch→main· +90 −19 · 2 files · 4 commits · merged 2026-12-02 15:57 UTCDepends on #3800
Summary
Extends
Stage.execz_else_branchintools/startup/gfx2hlsl.pyto support wave-levelif / elseblocks opened byv_cmpx_*(guard - 1) whenexec_lo/execwas saved earlier in the same basic block (s_mov_b32 sN, exec_loors_mov_b64 s[N:N+1], exec) without intervening branches, branch targets, orEXECmodifications.thenarm, no clobber ofsNinthen, validelseentries, andEXECrestoration).v_cmpx_lt_u32if/elseregions in large.c67compute shaders (advancing past thev_cmpx_*gate at instruction 265 inreq_00840c5921f4d486.c67).EXECrestore atjoin_idx(79cb4e6b): allows pure scalar instructions atjoin_idx(e.g.s_nand_b32) befores_mov_b32 exec_lo, sN/s_mov_b64 exec, ...when validating scalar-onlyelsearms.Verification
python -B tests/startup_gfx2hlsl_compute_check.py(pass; addshlsl_cmpx_elseandhlsl_join_prologuepositive tests plus negative control forv_cmpx_*without a priorexec_losave)python -B tests/docs_links_check.py(147 Markdown files, 671 links — pass)python -B tests/bidi_controls_check.py(2502 tracked files — pass)79cb4e6bdbto0d156d3c89@R0Y00 on GitHub · 2026-12-02 08:59 UTC · original · requested changes
The standard compute and nearby control-flow checks pass. Two one-instruction variants of the PR's new synthetic fixtures still take the widened structured path outside its stated proof. Replacing the NOP between
s_mov_b32 s21, exec_loand CMPX withs_mov_b32 s21, 0is accepted even though the matching restore no longer reads the entering mask. The forward join scan likewise accepts replacing the join NOP withv_mov_b32 v5, 1before the EXEC restore, despite the scalar-prologue rule. Please invalidate a save when its SGPRs are overwritten before CMPX, restrict the join scan to the supported prologue, and add both refusal controls.@Holastor on GitHub · 2026-12-02 10:20 UTC · original
Addressed both review comments in
f5f0b476:v_cmpx_*save clobber check (tools/startup/gfx2hlsl.py): Track scalar registers written viaeffects[k][2]between thes_mov_b32/s_mov_b64save andv_cmpx_*, rejecting the save ifsN(or either half ofs[N:N+1]) is overwritten.join_idx(tools/startup/gfx2hlsl.py): Restrict the forward scan atjoin_idxbefore restoringEXECto pure scalar instructions (op.startswith('s_'), excludingEXECZ_REFUSED, branches/calls, vector writeseffects[k][1], andEXECwrites).tests/startup_gfx2hlsl_compute_check.py): Added refusal tests for boths_mov_b32 s21, 0clobberings21beforev_cmpx_*andv_mov_b32 v5, 1atjoin_idxbefores_mov_b32 exec_lo, s21.Verified with:
tests/startup_gfx2hlsl_compute_check.pytests/docs_links_check.pytests/bidi_controls_check.pyf5f0b47624tof59d0681de@R0Y00 on GitHub · 2026-12-02 12:00 UTC · original · approved these changes
Both previous findings are addressed on
f59d0681. The compute, join-symbol, mask-overwrite and readfirstlane-recompute Python checks passed. Removing either guard independently makes the matching new refusal control fail, and the source was restored. The required Windows job is still red in the inheritednative_direct_meshfixture (+0x34: unmapped graphics export); please sync after #3853 lands and let Windows CI rerun.@Holastor on GitHub · 2026-12-02 15:54 UTC · original
@R0Y00 All CI green