Shader tests: pin IR reachability and PHI invariants #1619

Open
github-bot wants to merge 1 commit from github-bot/gh-1619 into main AGit
Owner

@⁠ArnabSaga on GitHub · 2026-11-24 19:52 UTC · original
ArnabSaga:test/1242-bt002-ir-invariants → main · +213 −0 · 1 files · 1 commits · open

Summary

Adds seven synthetic regression and characterization tests to verify
CFG reachability, SSA construction, and PHI invariants in the shader IR.

During an independent investigation of VIC-BT-002, I found that the
reported failure mechanism does not reproduce on the current baseline.

The GFX10 decoder follows control-flow reachability and does not decode
instructions skipped by unconditional branches. Consequently, the
reported unreachable predecessors do not enter SSA construction through
the proposed failure path.

This PR preserves the existing behavior through targeted tests rather
than introducing an unnecessary production correction.

Coverage

  • Unconditional branches skipping unreachable instructions.
  • Unreachable instruction reads.
  • Multiple skipped predecessors.
  • Reachability after irreducible loop splitting.
  • PHI argument ordering.
  • Trivial PHI elimination.
  • Rejection of reachable branches targeting the program entry.

The shared invariant helper additionally verifies:

  • Reachability of every IR block.
  • Valid successor indices.
  • Predecessor/successor consistency.
  • PHI operand counts.
  • Absence of invalid NONE values.

Verification

Tested against baseline ffe310e:

  • Targeted IR tests, debug: 13 passed.
  • Targeted IR tests, release: 13 passed.
  • Shader library tests: 127 passed, 1 ignored.
  • Changed-file formatting: passed.
  • git diff --check: passed.

A separate bounded investigation of 937,420 synthetic programs
found no panics, unreachable IR blocks, or surviving NONE values
among successful builds.

Scope

  • Test-only changes.
  • One file changed.
  • 213 insertions, zero deletions.
  • No production code changes.
  • No new dependencies.
  • No proprietary game assets or extracted shaders.

Limitations

Verification used Rust 1.98.1 with GNU/MinGW.
MSVC and full workspace CI parity remain unverified.

AI-assisted investigation and testing using synthetic inputs only.

Refs #1242 (VIC-BT-002).

This PR does not claim to fix VIC-BT-002. It adds characterization
coverage for the existing compiler invariants.

**@⁠ArnabSaga** on GitHub · 2026-11-24 19:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/1619) `ArnabSaga:test/1242-bt002-ir-invariants` → `main` · +213 −0 · 1 files · 1 commits · open ## Summary Adds seven synthetic regression and characterization tests to verify CFG reachability, SSA construction, and PHI invariants in the shader IR. During an independent investigation of VIC-BT-002, I found that the reported failure mechanism does not reproduce on the current baseline. The GFX10 decoder follows control-flow reachability and does not decode instructions skipped by unconditional branches. Consequently, the reported unreachable predecessors do not enter SSA construction through the proposed failure path. This PR preserves the existing behavior through targeted tests rather than introducing an unnecessary production correction. ## Coverage - Unconditional branches skipping unreachable instructions. - Unreachable instruction reads. - Multiple skipped predecessors. - Reachability after irreducible loop splitting. - PHI argument ordering. - Trivial PHI elimination. - Rejection of reachable branches targeting the program entry. The shared invariant helper additionally verifies: - Reachability of every IR block. - Valid successor indices. - Predecessor/successor consistency. - PHI operand counts. - Absence of invalid NONE values. ## Verification Tested against baseline `ffe310e`: - Targeted IR tests, debug: 13 passed. - Targeted IR tests, release: 13 passed. - Shader library tests: 127 passed, 1 ignored. - Changed-file formatting: passed. - `git diff --check`: passed. A separate bounded investigation of 937,420 synthetic programs found no panics, unreachable IR blocks, or surviving NONE values among successful builds. ## Scope - Test-only changes. - One file changed. - 213 insertions, zero deletions. - No production code changes. - No new dependencies. - No proprietary game assets or extracted shaders. ## Limitations Verification used Rust 1.98.1 with GNU/MinGW. MSVC and full workspace CI parity remain unverified. AI-assisted investigation and testing using synthetic inputs only. Refs #1242 (VIC-BT-002). This PR does not claim to fix VIC-BT-002. It adds characterization coverage for the existing compiler invariants.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:38:38 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:32 UTC · original

Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: crates/victory-shader/src/ir.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/1619#issuecomment-7149664037) <!-- victory-triage v1 head=1f47ee79d0a364842f2aa98d0182949f7e386921 verdict=needs-rebase at=2026-11-25T01:32:28Z --> Automated triage for the maintainers. **Needs rebase.** This pull request conflicts with `main` (conflicting: `crates/victory-shader/src/ir.rs`). It will be reviewed once it is rebased onto the current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Headache3318 on GitHub · 2026-11-25 01:42 UTC · original

Tested on Linux (Arch, kernel 7.3.5, 3× RTX 4090 driver 620.73.04), Rust 1.98.1 (pinned). PR head 1f47ee7 applied cleanly onto current main ccfb029.

  • cargo test -p victory-shader --locked: 103 passed, 0 failed, 1 ignored. All tests pass, including the 7 new IR reachability/PHI invariants tests.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: 2 pre-existing unused-import errors in test code (fail identically on main ccfb029). The PR introduces no new clippy warnings.

Not tested: Windows MSVC build, the title itself. AI-assisted.

**@⁠Headache3318** on GitHub · 2026-11-25 01:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/1619#issuecomment-7149868408) Tested on Linux (Arch, kernel 7.3.5, 3× RTX 4090 driver 620.73.04), Rust 1.98.1 (pinned). PR head `1f47ee7` applied cleanly onto current `main` `ccfb029`. - `cargo test -p victory-shader --locked`: 103 passed, 0 failed, 1 ignored. All tests pass, including the 7 new IR reachability/PHI invariants tests. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: 2 pre-existing unused-import errors in test code (fail identically on main `ccfb029`). The PR introduces no new clippy warnings. Not tested: Windows MSVC build, the title itself. AI-assisted.
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/ir.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1619'
git switch 'github-bot/gh-1619'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1619'
git switch 'github-bot/gh-1619'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1619'
git switch 'main'
git merge --squash 'github-bot/gh-1619'
git switch 'main'
git merge --ff-only 'github-bot/gh-1619'
git switch 'main'
git merge 'github-bot/gh-1619'
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!1619
No description provided.