shader: a branch on a lane mask whose arms keep EXEC is taken by the whole wave (#66) #72
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/DoubleGhosty--cool_fox!72
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-72"
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?
@Hasusmogus on GitHub · 2026-11-27 08:13 UTC · original
Hasusmogus:fix-66-scc-branch→main· +411 −1 · 4 files · 2 commits · closed without mergingFixes #66.
The bug
s_and_b64 s, vcc, execsets SCC when some lane of the wave has its bit, ands_cbranch_scc0on it sends the whole wave one way. The structure (structure.rs) split such a branch per lane, each lane by its own bit. That is exact only where the arm narrows EXEC to the lanes that went its way (s_and_saveexec+s_cbranch_execz). Where the arms keep EXEC, the lanes whose own bit was clear ran the other arm.The fix
Lanes::lane_split_loses: a branch on a lane mask (SCC of a mask operation, or VCC; not EXEC branches, not conditions over uniform atoms only) whose arms run vector instructions under an EXEC that is not inside the lanes that went that way is kept as the console has it. It goes intoStructured::wide, the same thingstructure_widedoes for the branches the lowering asks for: one decision for the wave, exchanged between the two host halves.emitfalls back to the old per-lane split (structure::structure_per_lane), so nothing that translated before is dropped.VICTORY_LANE_SPLIT=exactrefuses it instead, andVICTORY_WAVE_WHY=1logs when the fallback is used.the_mask_scc_in_a_lane_branch_lowers_without_its_exec_skip, and thes_cbranch_scc0case ofa_wave_or_inside_a_lane_branch_needs_the_branch_wave_wide, whose body is whole-wave code (s_or_saveexec_b64 -1) that every lane runs on the console.The issue author's test commit is kept as is (thanks @steven-seagull27 for the precise repro).
Tested
On an NVIDIA RTX A3000 Laptop GPU (Ampere, waves of 32) through vkd3d-proton (Proton Experimental):
(
both_halves_observe_the_same_mask_scc_on_a_wave32_device, the same 188 as on the RTX 5080.)victory-shadersuite on that GPU: 301 passed both before and after; the one failure (emit::tests::stub_pipeline_is_created) fails on both.cargo clippy --workspace --all-targets [--all-features] -- -D warnings: clean.VICTORY_WAVE_WHY=1shows which, andVICTORY_LANE_SPLIT=exactshows what would be refused without the fallback.🤖 Generated with Claude Code
`s_and_b64 s, vcc, exec` sets SCC when some lane of the wave has its bit, and `s_cbranch_scc0` on it sends the whole wave one way. The structure split such a branch per lane, each lane by its own bit: exact only where the arm narrows EXEC to the lanes that went its way (`s_and_saveexec` and `execz`). Where the arms keep EXEC, the lanes whose own bit was clear ran the other arm (188 of 576 words wrong on an RTX 5080 and on WARP). Such branches (SCC of a mask operation, VCC; not EXEC, not over uniform atoms only) are now kept as the console has them, as `structure_wide` does for the ones the lowering asks for: one decision for the wave, the two host halves exchanging it. A program that then needs every lane where one stands is retried in its other forms ("without skips" for the issue's three); if none translates, it is taken split per lane as before (`structure_per_lane`; `VICTORY_LANE_SPLIT=exact` refuses it instead). The issue's test and the wave-OR test expected the old split. Co-Authored-By: Claude Opus 5.5 <[email protected]>@DoubleGhosty on GitHub · 2026-11-27 08:53 UTC · original
Issue #66 was already fixed in main (
9a4aa8d3, verified 0/64 mismatches on Wave32 hardware).Pull request closed