Track divergent re-entry into shader loop exits #831

Closed
Kamiloj9 wants to merge 1 commit from upstream-pr/832 into main
Kamiloj9 commented 2026-11-25 09:47:46 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Kamiloj9 on 2026-11-25T09:47:46Z.


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

  • 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.
<!-- greyfinch-sync:fxceless/victory-fork:issue:6601675395 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/832). Originally posted by [Kamiloj9](https://github.com/Kamiloj9) on 2026-11-25T09:47:46Z. --- ## 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 - 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.
avt0m4t48 commented 2026-11-25 12:07:02 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by avt0m4t48 on 2026-11-25T11:15:50Z.


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.

AI-assisted using Codex.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7160813493 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/832#issuecomment-7160813493). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-25T11:15:50Z. --- 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. AI-assisted using Codex.
MamaLeVrai commented 2026-11-25 13:06:04 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by MamaLeVrai on 2026-11-25T12:23:41Z.


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 main f85101b 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.

AI-assisted (Claude Code); no game data.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7162313620 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/832#issuecomment-7162313620). Originally posted by [MamaLeVrai](https://github.com/MamaLeVrai) on 2026-11-25T12:23:41Z. --- 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 `main` `f85101b` 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. AI-assisted (Claude Code); no game data.
upstream-sync closed this pull request 2026-11-26 01:05:57 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!831
No description provided.