native: accept execz-skipped SGPR pair masked by EXEC at the join #3522
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!3522
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3520"
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?
@Leyukaka on GitHub · 2026-11-29 21:32 UTC · original
Leyukaka:native-compute-execz-join-mask→main· +240 −2 · 4 files · 1 commits · merged 2026-11-30 08:44 UTCRefs #3226 (part 2 of our claim). Draft, under our open-PR cap (#3516).
Shape
An SGPR pair is defined only inside a block that
s_cbranch_execzskips, and the first instruction at the join reads it ass_and_b64 pair, EXEC. Native direct compute refused this asunbound numeric SGPR, because the pair is unbound on the skip edge. This is the native counterpart of the gfx2hlsl join refusal released in #2645.Acceptance rule
execz_join_mask_source(src/gfx1013_direct_compute.inl:5132) accepts the instruction at a join only if all of the following hold:s_and_b64with an even destination (at most s106, or EXEC), and its sources are EXEC and an even SGPR pair at most s104, in either order.branch_predecessors(:5227) drops any target reached by more than one branch, the join is not the entry, and the previous instruction is a non-branch, non-s_endpgmthat falls through to it.s_cbranch_execzon which both pair words are unbound and both EXEC words are proven zero. In wave64 the branch tests both words. Otherwise it tests EXEC_LO only and the analysis must already know EXEC_HI is zero (:5152).:5156).On the skip edge EXEC is 0:0, so the AND and SCC are 0 whatever the pair holds.
lower_execz_join_mask(:5160, called at:5314) loads the pair only when EXEC is nonzero, writes 0 to both result words otherwise, and derives SCC from both result words.EXEC_HI tracking is
State::exec_hi_zeroinsrc/gfx1013_compute_native.cpp::530the flag;:696recomputed on every write to s127;:838set by a narrow wave64V_CMPXto EXEC, where the ballot write clears the upper half;:996merged as an AND at joins;:1880seeded true for direct DXIL when not wave64.Still refused
The proof applies to that one instruction. The merged pair stays unbound for every other reader, so these keep the existing diagnostic:
s_or_b64, or an AND whose other source is not EXEC;s_cbranch_scc1ors_cbranch_execnz;Tests
native_execz_join_mask_controls: passed. 12 refusal controls, each at the expected pc and register.native_execz_join_mask_hardware: passed. Both groups matched on four profiles: wave64/64, wave64/64 with only high EXEC bits active, wave32/32, and narrow wave64/32. The readback checks active lanes, both mask words, SCC and buffer guards.native_execz_join_mask_warp: skipped on this host (exit 77, requires shader model 6.6 with wave32).ctest -R '^(native_compute_|native_global_|native_execz|native_s_not_b64_exec_|native_wave64_exec_salu_)' -j 4: 20 tests, 17 passed, 0 failed, 3 skipped. The skips arenative_compute_implicit_lod_warp,native_execz_join_mask_warpandnative_global_srv_heap_replay_warp.V_CMPXflag. The other 2 fail only the hardware readback:hireplaced byloin the high-word AND, and the skip-edge phi changed from 0 to 1.Host: NVIDIA GeForce RTX 5080, driver 32.0.16.2101, Windows 10.0.26300, Debug build,
X2W_WITH_OPUS=OFF. These tests do not enable the debug layer.Not covered
@lukaslw-lab on GitHub · 2026-11-30 07:46 UTC · original · approved these changes
Reviewed
da410f2eby reading the diff; not built or run.Verdict: approve. The proof is sound for this one instruction. With exactly two incoming edges, the taken EXECZ edge proven to have both EXEC words zero, and the pair numeric on fallthrough, runtime
EXEC != 0at the join implies the fallthrough edge. Solower_execz_join_maskloads the pair only where it is defined, and the zero arm is exactly whats_and_b64gives on the skip edge. No MUST.lower_execz_join_masknames its blocks afteri.pc(execzMask<pc>,src/gfx1013_direct_compute.inl:5163). The rest of the file useslabel_number++. If a later change ever lowers the same pc twice, this would emit duplicate labels; DXC would refuse that, so it cannot produce wrong output.exec_hi_zeroonly goes from true to false at merges (src/gfx1013_compute_native.cpp:996), so loops converge.set()of s127 recomputes it, and the 64-bitset(i.dst + 1, {})clears it.direct_dxil && !wave64matchesinitialize().transferwith the same flags as the analysis (src/gfx1013_direct_compute.inl:5155).branch_predecessorsclears a target that two branches reach, and the fallthrough clauses rule out a second non-branch edge.Tests:
native_execz_join_mask_controlsreaches each acceptance clause through its 12 refusals._hardwarechecks active lanes, both mask words, SCC and guards on wave64, high-only EXEC, wave32 and narrow wave64. Together with the 16 mutations, that covers the rule and the two lowering details (hi word, skip-edge zero). CI ran none of them (native_execz_join_mask_*is not in the Windowsprfilter, not even_controls), so the results are the author's RTX 5080 run only. WARP readback is still open, as stated.