Shaders: worklist register liveness with 96 independent synthetic CFG… #1844

Open
VlREX wants to merge 1 commit from upstream-pr/1846 into main
VlREX commented 2026-11-24 23:19:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by VlREX on 2026-11-24T23:19:02Z.


Replace repeated full-CFG register liveness sweeps with a predecessor worklist. Includes 96 independent synthetic regression fixtures across 12 graph families. Old sweep, new worklist and path-search models agreed on all 4,192 cases. Synthetic block visits decreased by 47.88%. 100 files, 1,965 additions, no new dependencies. Native Rust tests and real shader benchmarks pending. No proprietary game data. AI-assisted (ChatGPT).

<!-- greyfinch-sync:Marvisak/VIctory:issue:5481982987 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1846). Originally posted by [VlREX](https://github.com/VlREX) on 2026-11-24T23:19:02Z. --- Replace repeated full-CFG register liveness sweeps with a predecessor worklist. Includes 96 independent synthetic regression fixtures across 12 graph families. Old sweep, new worklist and path-search models agreed on all 4,192 cases. Synthetic block visits decreased by 47.88%. 100 files, 1,965 additions, no new dependencies. Native Rust tests and real shader benchmarks pending. No proprietary game data. AI-assisted (ChatGPT).
catminou4 commented 2026-11-24 23:52:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T23:52:17Z.

Review: APPROVED


Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae), cargo test -p victory-shader --locked → 214 passed, 0 failed. GPU execution tests are #[cfg(all(test, windows))] and run only on Windows.

Worklist register liveness with 96 independent synthetic tests: 214 macOS tests green (biggest suite in the repo now) — strong verification of the new liveness worklist.

<!-- greyfinch-sync:Marvisak/VIctory:review:6049333534 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1846#pullrequestreview-6049333534). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T23:52:17Z. **Review:** APPROVED --- Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae), cargo test -p victory-shader --locked → 214 passed, 0 failed. GPU execution tests are #[cfg(all(test, windows))] and run only on Windows. Worklist register liveness with 96 independent synthetic tests: 214 macOS tests green (biggest suite in the repo now) — strong verification of the new liveness worklist.
upipibi commented 2026-11-25 00:06:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-24T23:23:04Z.


NVIDIA run: RTX 3070 8 GB, driver 616.56, plus WARP, Windows 11, debug, 5d4445d (on main 70564ae). cargo test -p victory-shader --locked: 302 passed, 3 failed, 2 ignored. The 96 new CFG cases pass, and the 3 failures are #1744's NVIDIA heap-cap failures on main.

AI-assisted (Claude Code). Synthetic tests only.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7147336927 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1846#issuecomment-7147336927). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-24T23:23:04Z. --- NVIDIA run: RTX 3070 8 GB, driver 616.56, plus WARP, Windows 11, debug, `5d4445d` (on `main` `70564ae`). `cargo test -p victory-shader --locked`: 302 passed, 3 failed, 2 ignored. The 96 new CFG cases pass, and the 3 failures are #1744's NVIDIA heap-cap failures on `main`. AI-assisted (Claude Code). Synthetic tests only.
Marvisak commented 2026-11-25 02:06:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:37:10Z.


Automated triage for the maintainers.

Merge candidate. The head (fc589db) hasn't changed since the last review. solve_liveness in crates/victory-shader/src/ir.rs replaces the round-robin fixed point with a predecessor worklist and keeps the transfer function (uses | out & !defs). ir/liveness_tests.rs checks it against a separate path-to-first-use oracle on generated CFGs. The diff is two files and 181 added lines.

On your reply: thanks for the measurements. A 1.9x to 2.7x speed-up of the solver on 2,048-block synthetic CFGs, with identical live sets, supports the change. A timing on a large real shader would still be the stronger number, but it doesn't block this.

CI: passing (check).


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149758054 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1846#issuecomment-7149758054). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:37:10Z. --- <!-- victory-triage v1 head=fc589dbde847ea5bb6b587d9bfcb0dd78d481532 verdict=merge-candidate at=2026-11-26T00:22:16Z --> Automated triage for the maintainers. **Merge candidate.** The head (`fc589db`) hasn't changed since the last review. `solve_liveness` in `crates/victory-shader/src/ir.rs` replaces the round-robin fixed point with a predecessor worklist and keeps the transfer function (`uses | out & !defs`). `ir/liveness_tests.rs` checks it against a separate path-to-first-use oracle on generated CFGs. The diff is two files and 181 added lines. On your reply: thanks for the measurements. A 1.9x to 2.7x speed-up of the solver on 2,048-block synthetic CFGs, with identical live sets, supports the change. A timing on a large real shader would still be the stronger number, but it doesn't block this. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
VlREX commented 2026-11-25 21:03:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by VlREX on 2026-11-25T20:42:14Z.


Local performance validation

Ryzen 5 3600X / RX 5700 XT / Windows 10
Rust 1.98.1

  • Workspace check: PASS
  • Targeted tests: 3/3 PASS
  • Clippy (-D warnings): PASS
  • Release benchmark: 12/12 PASS

2048-block synthetic CFG results:

CFG Baseline (us) Worklist (us) Speedup
Straight 264.175 142.175 1.858x
Local loops 397.869 152.938 2.602x
Long loop 389.413 146.556 2.657x

All 12 configurations were faster and produced
identical live-in and live-out sets.

Maximum execution time reduction: 62.4%.

PR tested: fc589db
Benchmark source:
github.com/VlREX/VIREX@1627eaa3bb

Seven alternating-order samples per configuration.
Synthetic solver benchmark, not end-to-end shader
translation or game FPS.

AI-assisted development (ChatGPT).
Native local measurements.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7174065856 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1846#issuecomment-7174065856). Originally posted by [VlREX](https://github.com/VlREX) on 2026-11-25T20:42:14Z. --- ### Local performance validation Ryzen 5 3600X / RX 5700 XT / Windows 10 Rust 1.98.1 - Workspace check: PASS - Targeted tests: 3/3 PASS - Clippy (-D warnings): PASS - Release benchmark: 12/12 PASS 2048-block synthetic CFG results: | CFG | Baseline (us) | Worklist (us) | Speedup | |---|---:|---:|---:| | Straight | 264.175 | 142.175 | 1.858x | | Local loops | 397.869 | 152.938 | 2.602x | | Long loop | 389.413 | 146.556 | 2.657x | All 12 configurations were faster and produced identical live-in and live-out sets. Maximum execution time reduction: 62.4%. PR tested: fc589db Benchmark source: https://github.com/VlREX/VIREX/commit/1627eaa3bba86d6cbce0f8ba8234ef9fdb02c542 Seven alternating-order samples per configuration. Synthetic solver benchmark, not end-to-end shader translation or game FPS. AI-assisted development (ChatGPT). Native local measurements.
fuzeofficlal commented 2026-11-26 19:24:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T19:24:07Z.

Review: APPROVED


Verified locally merged onto origin/main (63bcca43, Windows 11 x64, Rust 1.98.1 MSVC):

  • cargo test --locked -p victory-shader --lib ir:: — 11 passed, 0 failed (including duplicate_edges_and_unreachable_predecessors and generated_control_flow_matches_path_oracle, which checks 192 synthetic CFGs against reaches_use)
  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings (default and --all-features) — 0 warnings
  • cargo xtask policy — ok (192 files ok)

Review notes

  • Verified fixed-point equivalence between solve_liveness and the prior round-robin loop: link() keeps preds synced with Exit::successors() (including after split_irreducible), live_out[b] is stored on every pop even when live_in[b] does not change, queued[b] is cleared before evaluation so self-loops re-enqueue cleanly, and unreachable blocks stay zeroed under !reachable[p].
  • Minor non-blocking formatting nit: rustfmt --edition 2024 --check flags three Exit::Branch struct literals in crates/victory-shader/src/ir/liveness_tests.rs (around lines 93, 123, and 129).
<!-- greyfinch-sync:Marvisak/VIctory:review:6079495449 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1846#pullrequestreview-6079495449). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T19:24:07Z. **Review:** APPROVED --- Verified locally merged onto `origin/main` (`63bcca43`, Windows 11 x64, Rust 1.98.1 MSVC): - `cargo test --locked -p victory-shader --lib ir::` — **11 passed, 0 failed** (including `duplicate_edges_and_unreachable_predecessors` and `generated_control_flow_matches_path_oracle`, which checks 192 synthetic CFGs against `reaches_use`) - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` (default and `--all-features`) — 0 warnings - `cargo xtask policy` — ok (`192 files ok`) ### Review notes - Verified fixed-point equivalence between `solve_liveness` and the prior round-robin loop: `link()` keeps `preds` synced with `Exit::successors()` (including after `split_irreducible`), `live_out[b]` is stored on every pop even when `live_in[b]` does not change, `queued[b]` is cleared before evaluation so self-loops re-enqueue cleanly, and unreachable blocks stay zeroed under `!reachable[p]`. - Minor non-blocking formatting nit: `rustfmt --edition 2024 --check` flags three `Exit::Branch` struct literals in `crates/victory-shader/src/ir/liveness_tests.rs` (around lines 93, 123, and 129).
Dukestar69 commented 2026-11-27 00:08:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-27T00:08:29Z.

Review: APPROVED


LGTM — verified on Windows against origin/main (63bcca4).

  • Worklist-based register liveness passes all existing IR tests plus the 96 synthetic CFG liveness tests cleanly.
  • cargo test -p victory-shader --lib ir:: -- --test-threads=1: all passed.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: 192 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6081860822 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1846#pullrequestreview-6081860822). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-27T00:08:29Z. **Review:** APPROVED --- LGTM — verified on Windows against `origin/main` (`63bcca4`). - Worklist-based register liveness passes all existing IR tests plus the 96 synthetic CFG liveness tests cleanly. - `cargo test -p victory-shader --lib ir:: -- --test-threads=1`: all passed. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 192 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1846:upstream-pr/1846'
git switch 'upstream-pr/1846'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1846'
git switch 'upstream-pr/1846'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1846'
git switch 'upstream-pr/1846'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1846'
git switch 'main'
git merge --squash 'upstream-pr/1846'
git switch 'main'
git merge --ff-only 'upstream-pr/1846'
git switch 'main'
git merge 'upstream-pr/1846'
git push origin 'main'
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
Marvisak/VIctory!1844
No description provided.