You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Track divergent re-entry into shader loop exits - #832
Treat a divergent branch's own block as part of its divergent region when a loop can reach it again before lanes reconverge. This lets split-wave lowering account for the later dynamic instances of a group barrier in that block.
Verification
Added a CPU regression that fails when a per-lane loop branch is classified as an all-lane block. It also checks the same loop with a wave-wide decision.
Offline disassembly of a captured 64-lane tiling shader showed a per-lane loop exit after group barriers before this change. With the opt-in wave-wide retry and this change, the exit combines both wave halves through LDS. The resulting Wave32 DXIL passes the Windows SDK validator. The capture and emitted shader stay local.
Independent review and targeted CPU checks passed. The wave-wide retry remains opt-in. Runtime behavior and the cause of the earlier system restart are unverified.
I independently checked fd6ac9eceaddae60b5d26fe60c69abba0a6ea1ca against its parent 9376fd60c0ba0e76a74c39b49b1407dbac0a64c7 with four original synthetic GFX10 control-flow fixtures.
The multi-block loop used the words be880380 7d880000 bf870001 bf810000 be890381 bf82fffb. On the parent, the VCC branch at byte 4 was classified as all-lane even though its taken arm loops back through a separate block. The PR classifies the revisited branch as divergent. It also identifies that branch for wave-wide retry, and classifies it as all-lane when explicitly widened. Three controls passed on both revisions: an acyclic lane split, a lane split that reconverges before a uniform loop backedge, and a uniform split with a separate loop body.
The untouched PR head passed the Linux shader library suite (172 passed, 2 ignored) and cargo check --offline --locked -p victory-shader --tests --target x86_64-pc-windows-msvc with Rust 1.98.1. The advertised main had identical shader and Cargo build inputs to the parent for these checks. Scope was CPU classification and Windows-target compilation. I used no game files and did not run Windows, a GPU, or a DXIL validator.
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head fd6ac9e into mainf85101b in a throwaway tree (no conflict). cargo clippy --workspace --all-targets --locked -- -D warnings fails with the errors main itself has on this machine (placed_filler_twins, depth_written, a sort, and manual implementation of .is_multiple_of() at victory-gpu/src/shadow.rs:2675; PR #841 fixes the first three), also with --all-features; this PR adds none. (Correction: my first version of this report said that the is_multiple_of one was extra here. It is in main too: my first baseline run of main did not list it, and a run with --keep-going on a clean main does.) cargo test --workspace --locked: run 1: 566 passed, 0 failed, 12 ignored; run 2: stopped at indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields (the one that fails on main itself most runs here (PR #849 and #847 fix its assertion)) and the victory-gpu test binary died with an access violation (it does that on main about 2 runs in 100, issue #850) (main alone: 555 passed, 0 failed, 11 ignored). The title was not run, so this says nothing about in-game effect. No game data.
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
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.
Change
Treat a divergent branch's own block as part of its divergent region when a loop can reach it again before lanes reconverge. This lets split-wave lowering account for the later dynamic instances of a group barrier in that block.
Verification