fix(shader/hwrt): lift multi-hop forward-PHI live-outs and post-waterfall Blocks callbacks (#339) #391

Merged
Androtim merged 13 commits from upstream-pr/391 into main 2026-12-04 04:49:49 +00:00
Androtim commented 2026-12-03 13:06:44 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T13:06:44Z.


Refs #339.

Summary

  • Forward-edge live-out propagation (crates/victory-shader/src/emit/lower/rayquery/analyze.rs):
    • In compute_live_outside, conjoin edge_extra onto cs across forward PHI edges (ir.rpo[pred] < ir.rpo[pb]) via ClauseSet::with_lit instead of discarding edge_extra, while keeping backedge ClauseSet(edge_extra.clone()) unchanged.
    • Raise ClauseSet::with_lit literal cap from 12 to 24 (and update its doc comment) so 6+ forward PHI skip-diamond hops retain local predicates.
  • Post-waterfall CallbackKind::Blocks & deferred Pattern C filtering (crates/victory-shader/src/emit/lower/rayquery/analyze.rs):
    • In locks_site_decision, allow st.reach[site.0] != st.reach[cb_head] strictly when all four invariants hold: st.reach[site.0] => st.reach[cb_head], st.reach[cb_head] & st.reach[site.0] is satisfiable, st.guards[site.0][site.1].is_none(), and the site's EXEC (st.mask_bits(lo, hi)) matches Some(st.reach[cb_head]) or cb_head's entry EXEC mask.
    • Defer Pattern C site_decision / locks_site_decision / ri_merge_block reach validation in merge_mov_sites until after target filtering so internal scratch/flag moves (e.g. _mov_b32 v_flag, 0) skip cleanly while leaks_commit continues guarding against unrecognized commit writes.
  • Unit tests (crates/victory-shader/src/emit/rayquery_tests.rs):
    • Added positive and negative tests for multi-hop forward PHI skip diamonds (>12 hops) and CallbackKind::Blocks with an inner Wave32 descriptor waterfall loop, internal guarded _mov_b32, and
      estore_cb_exec true/false + wrong outer EXEC cases.

Verification

  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --lib rayquery (30 passed)
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p xtask --locked (8 passed)
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy -p victory-shader --all-targets -- -D warnings (clean)
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy -p victory-shader --all-targets --all-features -- -D warnings (clean)
<!-- greyfinch-sync:Androtim/MiniVI:issue:5627099476 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/391). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T13:06:44Z. --- Refs #339. ### Summary - **Forward-edge live-out propagation (crates/victory-shader/src/emit/lower/rayquery/analyze.rs)**: - In compute_live_outside, conjoin edge_extra onto cs across forward PHI edges (ir.rpo[pred] < ir.rpo[pb]) via ClauseSet::with_lit instead of discarding edge_extra, while keeping backedge ClauseSet(edge_extra.clone()) unchanged. - Raise ClauseSet::with_lit literal cap from 12 to 24 (and update its doc comment) so 6+ forward PHI skip-diamond hops retain local predicates. - **Post-waterfall CallbackKind::Blocks & deferred Pattern C filtering (crates/victory-shader/src/emit/lower/rayquery/analyze.rs)**: - In locks_site_decision, allow st.reach[site.0] != st.reach[cb_head] strictly when all four invariants hold: st.reach[site.0] => st.reach[cb_head], st.reach[cb_head] & st.reach[site.0] is satisfiable, st.guards[site.0][site.1].is_none(), and the site's EXEC (st.mask_bits(lo, hi)) matches Some(st.reach[cb_head]) or cb_head's entry EXEC mask. - Defer Pattern C site_decision / locks_site_decision / ri_merge_block reach validation in merge_mov_sites until after target filtering so internal scratch/flag moves (e.g. _mov_b32 v_flag, 0) skip cleanly while leaks_commit continues guarding against unrecognized commit writes. - **Unit tests (crates/victory-shader/src/emit/rayquery_tests.rs)**: - Added positive and negative tests for multi-hop forward PHI skip diamonds (>12 hops) and CallbackKind::Blocks with an inner Wave32 descriptor waterfall loop, internal guarded _mov_b32, and estore_cb_exec true/false + wrong outer EXEC cases. ### Verification - cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --lib rayquery (30 passed) - cargo +1.98.1-x86_64-pc-windows-gnu test -p xtask --locked (8 passed) - cargo +1.98.1-x86_64-pc-windows-gnu clippy -p victory-shader --all-targets -- -D warnings (clean) - cargo +1.98.1-x86_64-pc-windows-gnu clippy -p victory-shader --all-targets --all-features -- -D warnings (clean)
Androtim commented 2026-12-03 13:33:17 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T13:33:17Z.


Triage (e29cecd7, CI check PASS):

  • Scoped strictly to crates/victory-shader/src/emit/lower/rayquery/analyze.rs (+140/-107) and rayquery_tests.rs (+204/-1) — zero non-RT impact when VICTORY_HW_RT=0/unset. Note file overlap with #387 (rayquery/analyze.rs), so #387 and #391 will merge sequentially.
  • Holding auto-merge for Gate 2 Reasoning Audit (#282) + Gate 3 live VICTORY_HW_RT=1 GPU verification (0 DXIL errors / 0 DRED).
<!-- greyfinch-sync:Androtim/MiniVI:comment:7379992391 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/391#issuecomment-7379992391). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T13:33:17Z. --- Triage (`e29cecd7`, **CI `check` PASS**): - Scoped strictly to `crates/victory-shader/src/emit/lower/rayquery/analyze.rs` (+140/-107) and `rayquery_tests.rs` (+204/-1) — zero non-RT impact when `VICTORY_HW_RT=0`/unset. Note file overlap with `#387` (`rayquery/analyze.rs`), so `#387` and `#391` will merge sequentially. - Holding auto-merge for Gate 2 Reasoning Audit (`#282`) + Gate 3 live `VICTORY_HW_RT=1` GPU verification (`0` DXIL errors / `0` DRED).
Androtim commented 2026-12-03 19:02:05 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T19:02:05Z.


Automated triage for the maintainers (not an approval).

Verdict: needs-rebase · CI (check): passing

This PR no longer merges cleanly into main.

To change the verdict: Rebase onto current main and resolve conflicts; CI and triage will run again automatically.


Generated with Antigravity CLI (agy).

<!-- greyfinch-sync:Androtim/MiniVI:comment:7389053719 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/391#issuecomment-7389053719). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T19:02:05Z. --- <!-- minivi-triage v1 head=9bddb7aea46c4f4bde21beccae60e0139009bbdc verdict=needs-rebase ci=passing at=2026-12-03T19:02:44Z --> Automated triage for the maintainers (not an approval). **Verdict:** `needs-rebase` · **CI (`check`):** `passing` This PR no longer merges cleanly into `main`. **To change the verdict:** Rebase onto current `main` and resolve conflicts; CI and triage will run again automatically. --- _Generated with Antigravity CLI (`agy`)._
Androtim commented 2026-12-03 19:02:43 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T19:02:43Z.


Marking triage: needs rebase after #387 merged onto main (bfb94b93, overlapping rayquery/analyze.rs). Once rebased with green CI, ready for Gate 2 + Gate 3 VICTORY_HW_RT=1 check.

<!-- greyfinch-sync:Androtim/MiniVI:comment:7389069471 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/391#issuecomment-7389069471). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T19:02:43Z. --- Marking `triage: needs rebase` after `#387` merged onto `main` (`bfb94b93`, overlapping `rayquery/analyze.rs`). Once rebased with green CI, ready for Gate 2 + Gate 3 `VICTORY_HW_RT=1` check.
Androtim commented 2026-12-03 22:01:12 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T22:01:12Z.


Verified clean rebase onto main (7bf58c79) and CI check PASS. Swapped label to triage: needs gpu test — awaiting Gate 2 Audit (#282) + Gate 3 VICTORY_HW_RT=1 GPU verification.

<!-- greyfinch-sync:Androtim/MiniVI:comment:7393624090 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/391#issuecomment-7393624090). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T22:01:12Z. --- Verified clean rebase onto `main` (`7bf58c79`) and CI `check` PASS. Swapped label to `triage: needs gpu test` — awaiting Gate 2 Audit (`#282`) + Gate 3 `VICTORY_HW_RT=1` GPU verification.
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
Androtim/MiniVI!391
No description provided.