Iter 23: Fix scalar code bounds panic in ir::unspill #8

Merged
Androtim merged 1 commit from upstream-pr/8 into main 2026-11-28 13:16:05 +00:00
Androtim commented 2026-11-28 02:07:53 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T02:07:53Z.


Summary

Ports fxceless/victory-fork commit 2f3f399 (8ddcf35, PR #1495 backport/shader-scalar-code-bounds) into crates/victory-shader/src/ir.rs:

  • Expands used in unspill() from [false; 128] to [false; 256] so scalar destination codes >= 128 (constants / special codes) do not panic with index-out-of-bounds during scalar parking.
  • Adds the upstream regression unit test ir::tests::scalar_codes_past_the_registers_do_not_panic covering both wave64 and wave32 opcodes.

Rig Specs Tested On

  • CPU: Intel Core i7-13700F (13th Gen)
  • GPU & VRAM: NVIDIA GeForce RTX 4060 Ti (8 GiB VRAM)
  • System RAM: 32 GiB (33,304,932 KiB)
  • OS & GPU Driver: Windows 11 Home 10.0.26300 / NVIDIA Driver 32.0.16.2124

Run Settings & Profile

  • Build & Commit SHA: Unit tests & workspace clippy on feat/iter23-ir-unspill-scalar-bounds (source-level shader IR panic fix; no runtime gameplay playtest conducted for this single-file IR fix)
  • Console Profile & Internal Resolution / Scale: N/A (shader IR unit test coverage)
  • Ray Tracing: N/A
  • Upscaling: N/A
  • Frame Generation: N/A
  • Launcher Command / Preset & Extra VICTORY_* Overrides: N/A
  • Scene / Area & Session Length: N/A

Measurements & Verification

  • Base FPS (without Frame Gen): N/A (shader IR unit test fix)
  • Frame-Gen FPS (if enabled): N/A
  • VRAM / RAM Usage: N/A
  • Crashes / DRED Resets: 0 (ir::tests::scalar_codes_past_the_registers_do_not_panic passed)
  • Automated Checks:
    • cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy
    • cargo +1.98.1-x86_64-pc-windows-gnu test -p xtask
    • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings
    • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics -- -D warnings
    • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader -- ir::tests
<!-- greyfinch-sync:Androtim/MiniVI:issue:5535670575 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/8). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T02:07:53Z. --- ## Summary Ports `fxceless/victory-fork` commit `2f3f399` (`8ddcf35`, PR #1495 `backport/shader-scalar-code-bounds`) into `crates/victory-shader/src/ir.rs`: - Expands `used` in `unspill()` from `[false; 128]` to `[false; 256]` so scalar destination codes `>= 128` (constants / special codes) do not panic with index-out-of-bounds during scalar parking. - Adds the upstream regression unit test `ir::tests::scalar_codes_past_the_registers_do_not_panic` covering both wave64 and wave32 opcodes. ## Rig Specs Tested On - **CPU:** Intel Core i7-13700F (13th Gen) - **GPU & VRAM:** NVIDIA GeForce RTX 4060 Ti (8 GiB VRAM) - **System RAM:** 32 GiB (`33,304,932` KiB) - **OS & GPU Driver:** Windows 11 Home `10.0.26300` / NVIDIA Driver `32.0.16.2124` ## Run Settings & Profile - **Build & Commit SHA:** Unit tests & workspace clippy on `feat/iter23-ir-unspill-scalar-bounds` (source-level shader IR panic fix; no runtime gameplay playtest conducted for this single-file IR fix) - **Console Profile & Internal Resolution / Scale:** N/A (shader IR unit test coverage) - **Ray Tracing:** N/A - **Upscaling:** N/A - **Frame Generation:** N/A - **Launcher Command / Preset & Extra `VICTORY_*` Overrides:** N/A - **Scene / Area & Session Length:** N/A ## Measurements & Verification - **Base FPS (without Frame Gen):** N/A (shader IR unit test fix) - **Frame-Gen FPS (if enabled):** N/A - **VRAM / RAM Usage:** N/A - **Crashes / DRED Resets:** `0` (`ir::tests::scalar_codes_past_the_registers_do_not_panic` passed) - **Automated Checks:** - [x] `cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy` - [x] `cargo +1.98.1-x86_64-pc-windows-gnu test -p xtask` - [x] `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings` - [x] `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics -- -D warnings` - [x] `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader -- ir::tests`
Androtim commented 2026-11-28 02:11:19 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T02:11:19Z.


Verification complete for PR #8 (2628b0f):

  • GitHub Actions CI (46096543517): success (Clippy, Clippy diagnostics, Tests)
  • Local checks: xtask policy (294 files ok), xtask test (6 passed), ictory-shader -- ir::tests (11 passed, including scalar_codes_past_the_registers_do_not_panic), both clippy passes (
<!-- greyfinch-sync:Androtim/MiniVI:comment:7232191478 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/8#issuecomment-7232191478). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T02:11:19Z. --- Verification complete for PR #8 (2628b0f): - GitHub Actions CI (46096543517): **success** (Clippy, Clippy diagnostics, Tests) - Local checks: xtask policy (294 files ok), xtask test (6 passed), ictory-shader -- ir::tests (11 passed, including scalar_codes_past_the_registers_do_not_panic), both clippy passes (
Androtim commented 2026-11-28 03:02:45 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T03:02:45Z.


Automated triage for the maintainers (not an approval).

Verdict: merge-candidate · CI (check): passing

Review Summary

Clean, minimal panic fix in crates/victory-shader/src/ir.rs with CI passing.

  • Root cause & fix (ir::unspill): At ir.rs:336, Reg::S(c) => used[usize::from(c)] = true indexes used with any u8 scalar code emitted by effects()/operand() (which allows codes >= 128, e.g., constants/special codes or >= PARKED). Expanding used from [false; 128] to [false; 256] prevents an index-out-of-bounds panic for all possible u8 codes.
  • No behavioral regression: used is only read at ir.rs:544-546 for indices (0..105).chain(108..=123), so programs that did not previously panic produce identical IR and shader output.
  • Test coverage: Adds ir::tests::scalar_codes_past_the_registers_do_not_panic, exercising v_writelane_b32 parking alongside wave64 and wave32 instructions with scalar codes past 127.
  • GPU testing: Not required—this is a pure CPU-side IR bounds fix with no change to generated shader code or GPU behavior, fully covered by unit tests and CI.

Automated triage review; not a formal maintainer approval.


Generated with Antigravity CLI (agy).

<!-- greyfinch-sync:Androtim/MiniVI:comment:7232757636 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/8#issuecomment-7232757636). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T03:02:45Z. --- <!-- minivi-triage v1 head=2628b0f3203584dcc5bc2f91639cb098edb7b8cb verdict=merge-candidate ci=passing at=2026-11-28T03:03:12Z --> Automated triage for the maintainers (not an approval). **Verdict:** `merge-candidate` · **CI (`check`):** `passing` ### Review Summary Clean, minimal panic fix in [`crates/victory-shader/src/ir.rs`](crates/victory-shader/src/ir.rs) with CI passing. - **Root cause & fix (`ir::unspill`)**: At `ir.rs:336`, `Reg::S(c) => used[usize::from(c)] = true` indexes `used` with any `u8` scalar code emitted by `effects()`/`operand()` (which allows codes `>= 128`, e.g., constants/special codes or `>= PARKED`). Expanding `used` from `[false; 128]` to `[false; 256]` prevents an index-out-of-bounds panic for all possible `u8` codes. - **No behavioral regression**: `used` is only read at `ir.rs:544-546` for indices `(0..105).chain(108..=123)`, so programs that did not previously panic produce identical IR and shader output. - **Test coverage**: Adds `ir::tests::scalar_codes_past_the_registers_do_not_panic`, exercising `v_writelane_b32` parking alongside wave64 and wave32 instructions with scalar codes past 127. - **GPU testing**: Not required—this is a pure CPU-side IR bounds fix with no change to generated shader code or GPU behavior, fully covered by unit tests and CI. *Automated triage review; not a formal maintainer approval.* --- _Generated with Antigravity CLI (`agy`)._
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!8
No description provided.