shader: lower VCC-mask and if-only mesh SAVEEXEC shapes in a lane skip (Part of #2413) #3670
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!3670
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3668"
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?
@mumba17 on GitHub · 2026-11-30 22:51 UTC · original
mumba17:shader/mesh-saveexec-vcc→main· +216 −4 · 2 files · 5 commits · merged 2026-12-01 03:11 UTCPart of #2413. Stacked on #3647. Only the last three commits are new:
70103884,9cccc933,319ec35e. The rest is #3647.With #3637/#3645/#3646/#3655 applied,
unsupported mesh SAVEEXEC operandswas the first refusal for 19 of the 454 cached slot 57 requests. All 19 have the forms_and_saveexec_b64 sD, vcc. Once the operand was accepted, two more shapes showed up behind it.70103884). The compiler often saves EXEC against a compare's VCC directly.graphics_lane_maskalready returns this lane's VCC bit, so source 106 is now accepted next to an even SGPR pair.vcc_histays refused.9cccc933). Here the EXECZ target restores the saved mask (s_mov_b64 exec, sD) instead of starting an else arm withs_andn2_b64 exec, sD, exec. This is lowered as a then-only diamond that joins at the EXECZ target. Between the target and the restore, only scalar loads,s_waitcnt,s_clauseands_nopmay sit; the existing diamond-join gap from #3635 lowers them once for the wave. Anything else still refuses with "else arm lacks the saved-mask inverse".319ec35e). Most of these then arms compare into VCC. #3647's review follow-up refused that. Following @lukaslw-lab's other option, VCC is now clobbered at the join instead, along with its wave words throughafter_graphics_write. The arm still reads its own lane's bit, and any VCC read after the join refuses.v_div_scalestays refused.Census, the 19 requests:
unsupported mesh SAVEEXEC operands.then arm depends on EXEC), which needs a stack of diamonds and is left for a follow-up. 1 stops atthen arm lacks an EXECZ skip.Tests (
tests/native_direct_mesh_check.py):saveexec-vcc;saveexec-ifandsaveexec-if-gap, where the then edge selects 2 and the else edge keeps the old v1;saveexec-if-then-vcc;saveexec-then-vopc,saveexec-then-vop3-vccandsaveexec-then-carry, which were refusals in #3647 and now lower.saveexec-vcc-hi;saveexec-if-salu-gap;saveexec-if-wrong-restore;saveexec-then-vcc-read-after(if/else form) andsaveexec-if-vcc-read-after(if-only form). Both refuse withgraphics register undefined on an incoming path: 106.native_direct_mesh:vcc_hi(107) is already refused by the range check, and the odd SGPR pairs are covered by #3647's controls.ctest -R "mesh|compile_dxil": 204/204.🤖 Generated with Claude Code
@lukaslw-lab on GitHub · 2026-12-01 01:22 UTC · original · reviewed
Reviewed
319ec35e(the three commits over #3647) by reading the diff; not built or run.Verdict: comment. VCC as the mask, the if-only diamond and the join clobber are right. But allowing then-arm compares into VCC exposes a wave-level VCC word the arm does not narrow. No MUST. I'd approve once it is closed.
vcc_wordscarry the else lanes' bits. The in-skip SAVEEXEC never narrowsexec_value. A then-arm VOPC with uniform operands therefore writesvcc_words = select(pred, exec_value, 0)from the parent EXEC (thei.dst==106branch of thev_cmp_lowering). Hardware writes only then-lane bits.vcc_nonemptyhappens to agree, because the arm runs only when a then lane exists. But a scalar mask read ofvccin the arm sees the else lanes:s_and_b64 s[30:31], vcc, s[x:y]with its SCC, thens_cbranch_scc*(allowed in the if-only arm, wherelane_elseis 0), ors_bcnt1. #3647 refused all then-arm VCC writes, so this is new. Refusing scalar reads of 106/107 in the then-arm scan, or clearingvcc_wordsinside the arm, would close it. The existing controls compares21withv0, which is not uniform, so they never set the words.s_waitcnt,s_clauseands_nopbetween the EXECZ target and the restore. Since #3648, the join gap also lowerss_cmp*and 32-bit SALU there. After a rebase, the scan could use the same list. It fails closed as it is (saveexec-if-salu-gap).graphics_lane_maskreturns the lane bit.vcc_hiand odd pairs refuse.alternate == join, so the else edge is the entry state.restoresroutes thes_mov_b64 exec, sDrestore through the existing gap logic.alu.write(106/107, {})callsafter_graphics_write, which clears both words andvcc_nonempty. The else arm still refuses VCC-reading sources throughthen_writes.a3bfd019.Tests: the new positives and the two read-after controls reach the new code. CI at this head (22:51 UTC) ran before #3646 put
native_direct_meshinto theprfilter, so only your local run covers them.@R0Y00 on GitHub · 2026-12-01 03:10 UTC · original · approved these changes
Reviewed the in-skip SAVEEXEC extension. The lowering supports a VCC condition and the if-only restore form, and invalidates the then arm's VCC values at the join.
ctest --test-dir <build> --no-tests=error -j1 -R '^native_direct_mesh$' --output-on-failurepassed in the integration, including the accepted if/else and if-only shapes and the downstream VCC refusal controls.s_bitset1_b32, then stop at a scalar loop #3705s_bitset1_b32, then stop at a scalar loop #3705