Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following up on the review finding noted on #376: lowering turns an unconditional back edge (
LaneExit::Jumpto a loop header) into a conditional branch to a generated earlyreturnwhen the loop iteration limit is hit (crates/victory-shader/src/emit/lower.rs). Previously,in_step,branch_regionspostdominator analysis, and explicits_barrierlowering only considered the console CFG, allowing one wave/half to return early at the cap while another reached a half-wave exchange ors_barrier(GroupMemoryBarrierWithGroupSync) with missing participants.This change:
in_step(step_and_capincrates/victory-shader/src/emit/lower/barriers.rs) to treat a capped unconditional back edge(latch, header)as uniform only whenheader,latch, and every back edge sharingheader's loop counter run in step (with uniform branch conditions on conditional back edges). Otherwise marks blocks reachable fromheaderand divergent sibling arms (bounded at reconvergence points wherestep[p]holds) as not-in-step andcap_escaped.branch_regions(crates/victory-shader/src/emit/lower/halves.rs) for capped unconditional back edges so a closed self-loop does not make a sibling path a false postdominator/reconvergence point.s_barrierincap_escapedblocks (crates/victory-shader/src/emit/lower.rs), while preserving safe barriers before divergent cap branches, behind uniform branches, and after uniform capped loops.crates/victory-shader/src/emit/lower/tests.rscovering all hazard shapes (divergent inner capped loop, shared loop counter with a divergent conditional back edge, closed self-loop sibling exchange ands_barrier) and positive controls (uniform capped loops, conditional back edges, earlier joins, and+1emitted barrier verification againsts_nop).Tested locally on macOS ARM64 (no game files):
cargo test -p victory-shader(220 passed, 0 failed, 3 ignored)cargo clippy -p victory-shader --all-targetscargo xtask policy(262 files ok)Created with Mistral Large 4, GPT-6.2 Sol, and Gemini 4 Neon in T3 Code.