Repository navigation
Conversation
…cl-dev#3440) lane_masks follows each lane on its own: a lane that leaves a loop through a per-lane branch stops running it. On the console the wave runs on until every lane has left, and every later round writes the loop's masks again (a VALU compare writes 0 for lanes no longer in EXEC). After the loop such a mask holds the last round's bits, not each lane's own last value, so taking it as the lane's bit dropped needed guards. On an edge that leaves loops through a per-lane branch, every SGPR mask and the SCC whose function depends on an atom born inside those loops becomes a new atom (Atom::Exit); the SCC's kind becomes Unknown. EXEC is kept: the wave leaves when it is empty, which is each lane's own bit as it leaves. Masks set before the loop keep their value. Tests: the issue's program (failed with `left: []`, now [28]) and a control where a mask saved before the loop needs no guard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I tested a terminating wave32 version of the #3440 loop on RTX 5070 12 GB (616.92). I changed the add to increment the compared register so lanes could exit on four different iterations. The saved EXEC, loop-carried VCC and post-loop
|
|
Review (head e1273c2, diff read, not a merge-check; draft,
Fine: exits come from the existing dominator-checked loop bodies, so breaks and nested loops are handled. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
No open or merged PR makes the same change for #3440. #1912 and #2117 also edit AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
Fixes #3440.
lane_masksfollows each lane on its own: a lane that leaves a loop through a per-lane branch stops running the loop. On the console the wave runs on until every lane has left, and every later round writes the loop's masks again (a VALU compare writes 0 for the lanes no longer in EXEC). After the loop such a mask holds the last round's bits, not each lane's own last value, so taking it as the lane's bit dropped guards that were needed (the issue's program:exec = vccafter the loop, thev_movat pc 28 left unguarded).What is in it
Lanes::exit_state: on an edge that leaves one or more loops through a per-lane branch (condkind notUniform), every SGPR mask and the SCC whose function depends on an atom born inside those loops becomes a new atom,Atom::Exit(block, successor, slot). The SCC's kind becomesSccKind::Unknown, so a later read of it is refused as elsewhere.wave_branchesare untouched (their branches areUniform).Bdd::depends: whether a function depends on an atom a predicate names.lane_masks.rs:a_mask_from_a_per_lane_loop_still_guards_what_follows(the issue's program, unchanged; failed onmain0fe06eb0withleft: [], now[28]) anda_mask_saved_before_a_per_lane_loop_is_still_known_after_it(a control:exec = s[0:1] & execafter the same loop adds no guard).Tested
cargo test -p xcl --lib -- lane_masks: 15 passed, 0 failed (13 before + 2 new).cargo test -p xcl --lib -- gpu::recomp: 501 passed, 0 failed, 21 ignored.cargo clippy -p xcl --lib --tests: no finding inlane_masks.rs(the crate's existing clippy errors elsewhere are unchanged).cargo test --workspace.Regression run
Not run: I have no title to run
scripts/smoke.ps1on. The change only affects the per-lane analysis, which is used withXCL_PER_LANE=1(off by default), so the default path should not move; a smoke run from someone with a title is still needed before merge, which is why this is a draft.main: not run
PR: not run
Not tested
ifand read after the join) is not covered by this change.AI use
🤖 Generated with Claude Code