Shaders: discover irreducible loops with iterative SCC decomposition #1840

Open
github-bot wants to merge 2 commits from github-bot/gh-1840 into main AGit
Owner

@⁠VlREX on GitHub · 2026-11-24 23:11 UTC · original
VlREX:perf/shader-scc-loop-discovery → main · +233 −37 · 1 files · 2 commits · open

Replace repeated CFG reachability searches with iterative Kosaraju SCC decomposition. Preserve original loop selection semantics. Independent Python models matched on 24,096 graph cases. Synthetic 2,048-block graph traversal reduced from 4,194,308 to 4,098 edge examinations. Three Rust regression tests included. Native Rust compilation and real shader benchmarks pending. No proprietary data used. AI-assisted (ChatGPT).

**@⁠VlREX** on GitHub · 2026-11-24 23:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/1840) `VlREX:perf/shader-scc-loop-discovery` → `main` · +233 −37 · 1 files · 2 commits · open Replace repeated CFG reachability searches with iterative Kosaraju SCC decomposition. Preserve original loop selection semantics. Independent Python models matched on 24,096 graph cases. Synthetic 2,048-block graph traversal reduced from 4,194,308 to 4,098 edge examinations. Three Rust regression tests included. Native Rust compilation and real shader benchmarks pending. No proprietary data used. AI-assisted (ChatGPT).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:46:20 +00:00
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 23:16 UTC · original

NVIDIA run: RTX 3070 8 GB, driver 616.56, plus WARP, Windows 11, debug, 7811cf9 (on main 70564ae). cargo test -p victory-shader --locked: 209 passed, 3 failed, 2 ignored. The 3 are #1744's NVIDIA heap-cap failures on main, so the new loop discovery changes no test result here, the waterfall and loop tests included.

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

**@⁠upipibi** on GitHub · 2026-11-24 23:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/1840#issuecomment-7147222338) NVIDIA run: RTX 3070 8 GB, driver 616.56, plus WARP, Windows 11, debug, `7811cf9` (on `main` `70564ae`). `cargo test -p victory-shader --locked`: 209 passed, 3 failed, 2 ignored. The 3 are #1744's NVIDIA heap-cap failures on `main`, so the new loop discovery changes no test result here, the waterfall and loop tests included. AI-assisted (Claude Code). Synthetic tests only.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 07:25 UTC · original · edited 2026-11-26 00:22 UTC

Automated triage for the maintainers.

Needs work. The head (f813235) hasn't changed since the last review, so the verdict stays.

On your reply: thanks for the regression run and the benchmark table. Every number in it comes from synthetic CFGs, though, and your own note says real shader-pack timing is still needed. That is the open point. The rewrite of multi_entry_loop (cyclic_components in crates/victory-shader/src/ir.rs) still looks behaviour-preserving, and the outside runs (RTX 3070, and the full-pack translate --validate with no count change) back that up. The reason to take 230 lines is still missing. split_irreducible only reaches this path after irreducible_edge finds an irreducible edge, so please show one of these on the real pack:

  • translate wall time over the pack before and after, or
  • how many programs reach multi_entry_loop, and the time spent there.

If real shaders hardly reach this path, the simpler existing search is better kept.

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 07:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/1840#issuecomment-7155842510) · edited 2026-11-26 00:22 UTC <!-- victory-triage v1 head=f8132358098d08f8fe58df32732d14b8e1c388fd verdict=needs-work at=2026-11-26T00:22:14Z --> Automated triage for the maintainers. **Needs work.** The head (`f813235`) hasn't changed since the last review, so the verdict stays. On your reply: thanks for the regression run and the benchmark table. Every number in it comes from synthetic CFGs, though, and your own note says real shader-pack timing is still needed. That is the open point. The rewrite of `multi_entry_loop` (`cyclic_components` in `crates/victory-shader/src/ir.rs`) still looks behaviour-preserving, and the outside runs (RTX 3070, and the full-pack `translate --validate` with no count change) back that up. The reason to take 230 lines is still missing. `split_irreducible` only reaches this path after `irreducible_edge` finds an irreducible edge, so please show one of these on the real pack: - `translate` wall time over the pack before and after, or - how many programs reach `multi_entry_loop`, and the time spent there. If real shaders hardly reach this path, the simpler existing search is better kept. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 12:14 UTC · original

Offline measurement on a retail dump

Result: no count change against main.

I merged head 7811cf9b onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

**@⁠sinan-cmyk** on GitHub · 2026-11-25 12:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/1840#issuecomment-7162116652) ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 7811cf9b onto `main` 940d32f (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 23,918 on `main`, 23,918 with this PR. No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Author
Owner

@⁠VlREX on GitHub · 2026-11-25 20:26 UTC · original

VIREX - Local regression and performance report

Hardware: Ryzen 5 3600X, Radeon RX 5700 XT
OS: Windows 10 Pro (19045)
Rust: 1.98.1

Regression testing

Version Passed Failed Ignored
Baseline 146 63 2
Optimized 149 63 2

Identical 63 failing tests on both revisions.
No new observed regressions.
All three additional SCC tests passed.
SM 6.6 availability remains a local limitation.

Release benchmark

CFG blocks Reference (us) SCC (us) Speedup
32 96.034 5.442 17.6x
128 922.250 15.403 59.9x
512 14818.075 49.312 300.5x
2048 231791.300 212.550 1090.5x

2048-block multi-entry scenarios:

  • Late multi-entry: 1042.2x
  • Nested multi-entry: 953.4x

All 12 synthetic configurations matched the reference.
Seven alternating-order measurements per configuration,
using median execution times.

Baseline: 70564ae
PR head: f813235

Benchmark source:
github.com/VlREX/VIREX@b561b22e51

These are synthetic algorithm benchmarks, not game FPS.
The acyclic case does not represent the guarded production
call path. Real shader-pack timing remains necessary.

AI-assisted development (ChatGPT).
Benchmarks executed locally using VIREX Test Studio.

**@⁠VlREX** on GitHub · 2026-11-25 20:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/1840#issuecomment-7173665621) ### VIREX - Local regression and performance report Hardware: Ryzen 5 3600X, Radeon RX 5700 XT OS: Windows 10 Pro (19045) Rust: 1.98.1 #### Regression testing | Version | Passed | Failed | Ignored | |---|---:|---:|---:| | Baseline | 146 | 63 | 2 | | Optimized | 149 | 63 | 2 | Identical 63 failing tests on both revisions. No new observed regressions. All three additional SCC tests passed. SM 6.6 availability remains a local limitation. #### Release benchmark | CFG blocks | Reference (us) | SCC (us) | Speedup | |---:|---:|---:|---:| | 32 | 96.034 | 5.442 | 17.6x | | 128 | 922.250 | 15.403 | 59.9x | | 512 | 14818.075 | 49.312 | 300.5x | | 2048 | 231791.300 | 212.550 | 1090.5x | 2048-block multi-entry scenarios: - Late multi-entry: 1042.2x - Nested multi-entry: 953.4x All 12 synthetic configurations matched the reference. Seven alternating-order measurements per configuration, using median execution times. Baseline: 70564ae PR head: f813235 Benchmark source: https://github.com/VlREX/VIREX/commit/b561b22e518de41d54be01dd470c2c042d2b8a5c These are synthetic algorithm benchmarks, not game FPS. The acyclic case does not represent the guarded production call path. Real shader-pack timing remains necessary. AI-assisted development (ChatGPT). Benchmarks executed locally using VIREX Test Studio.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1840/head:github-bot/gh-1840'
git switch 'github-bot/gh-1840'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1840'
git switch 'github-bot/gh-1840'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1840'
git switch 'github-bot/gh-1840'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1840'
git switch 'main'
git merge --squash 'github-bot/gh-1840'
git switch 'main'
git merge --ff-only 'github-bot/gh-1840'
git switch 'main'
git merge 'github-bot/gh-1840'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1840
No description provided.