Shaders/IR: eliminate per-instruction/CFG Vec allocations and O(1) effects dedup #2662

Open
RVZO6 wants to merge 1 commit from upstream-pr/2664 into main
RVZO6 commented 2026-11-25 17:44:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by RVZO6 on 2026-11-25T17:44:04Z.


Claimed in #1633: https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7158204478

Summary

Eliminates hot per-instruction and per-CFG-edge heap allocations and O(REGS) / O(n²) scans during GFX10 decoding and SSA IR construction (crates/victory-shader/src/gfx10/fields.rs, crates/victory-shader/src/ir.rs, +319/-53), producing identical SSA IR:

  1. gfx10/fields.rs (valu_dwords): parses suffix widths directly without split('_').collect::<Vec<_>>() and only checks VOP3B for Encoding::Vop3.
  2. Stack-allocated Exit::succs(): adds zero-alloc Succs { to: [usize; 2], len } used across reverse_postorder, link, irreducible_edge, split_irreducible, multi_entry_loop (also borrowing preds without cloning), and liveness, keeping pub Exit::successors() intact.
  3. Bit-scanning RegSet::members(): iterates only set bits via trailing_zeros() / w &= w - 1 instead of scanning all REGS slots.
  4. O(1) effects() dedup: replaces Vec::contains O(n²) dedup with a stack RegSet bitset and writes (Reg, NONE) directly without a second Vec allocation per instruction.

Measured (--release ir::tests::bench_ir_build)

Workload Before (main) After Speedup
valu_cfg (2,048 insts, 128 blocks) 2,310.3 µs/run 1,966.9 µs/run 1.17× (-14.9%)
movrel (64 insts, 128 VGPRs) 602.0 µs/run 139.3 µs/run 4.32× (-76.9%)

Not a duplicate of

  • Checked open PRs and #1633; no open PR or claim overlaps gfx10/fields.rs valu_dwords or ir.rs Exit::succs / RegSet / effects.

Verification

  • Verified on windows-latest MSVC + WARP SM 6.6 CI (both clippy -D warnings profiles, xtask policy 6/6, victory-shader 281/281 including unit tests verifying valu_dwords, RegSet::members, and Exit::succs): https://github.com/RVZO6/VIctory/actions/runs/45666985023
  • Not run: the title; any hardware GPU.

AI-assisted: T3 Code (Antigravity, gemini-4-neon)

<!-- greyfinch-sync:Marvisak/VIctory:issue:5496254518 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2664). Originally posted by [RVZO6](https://github.com/RVZO6) on 2026-11-25T17:44:04Z. --- Claimed in #1633: https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7158204478 ### Summary Eliminates hot per-instruction and per-CFG-edge heap allocations and `O(REGS)` / `O(n²)` scans during GFX10 decoding and SSA IR construction (`crates/victory-shader/src/gfx10/fields.rs`, `crates/victory-shader/src/ir.rs`, `+319/-53`), producing identical SSA IR: 1. **`gfx10/fields.rs` (`valu_dwords`):** parses suffix widths directly without `split('_').collect::<Vec<_>>()` and only checks VOP3B for `Encoding::Vop3`. 2. **Stack-allocated `Exit::succs()`:** adds zero-alloc `Succs { to: [usize; 2], len }` used across `reverse_postorder`, `link`, `irreducible_edge`, `split_irreducible`, `multi_entry_loop` (also borrowing `preds` without cloning), and `liveness`, keeping `pub Exit::successors()` intact. 3. **Bit-scanning `RegSet::members()`:** iterates only set bits via `trailing_zeros()` / `w &= w - 1` instead of scanning all `REGS` slots. 4. **O(1) `effects()` dedup:** replaces `Vec::contains` `O(n²)` dedup with a stack `RegSet` bitset and writes `(Reg, NONE)` directly without a second `Vec` allocation per instruction. ### Measured (`--release ir::tests::bench_ir_build`) | Workload | Before (`main`) | After | Speedup | |---|---:|---:|---:| | `valu_cfg` (2,048 insts, 128 blocks) | `2,310.3 µs/run` | `1,966.9 µs/run` | **1.17× (-14.9%)** | | `movrel` (64 insts, 128 VGPRs) | `602.0 µs/run` | `139.3 µs/run` | **4.32× (-76.9%)** | ### Not a duplicate of - Checked open PRs and #1633; no open PR or claim overlaps `gfx10/fields.rs` `valu_dwords` or `ir.rs` `Exit::succs` / `RegSet` / `effects`. ### Verification - Verified on `windows-latest` MSVC + WARP SM 6.6 CI (both clippy `-D warnings` profiles, `xtask` policy 6/6, `victory-shader` 281/281 including unit tests verifying `valu_dwords`, `RegSet::members`, and `Exit::succs`): https://github.com/RVZO6/VIctory/actions/runs/45666985023 - **Not run:** the title; any hardware GPU. AI-assisted: T3 Code (Antigravity, gemini-4-neon)
kotekompotek commented 2026-11-25 18:02:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T17:57:09Z.


Reviewed: mechanical perf cleanup — VOP3B.contains is read inline now (same lookup, no hoisted variable), and valu_dwords parses via split('_') iterator instead of a Vec. No semantic change visible in the hunks read. CI green.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7170230144 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2664#issuecomment-7170230144). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T17:57:09Z. --- Reviewed: mechanical perf cleanup — `VOP3B.contains` is read inline now (same lookup, no hoisted variable), and `valu_dwords` parses via `split('_')` iterator instead of a Vec. No semantic change visible in the hunks read. CI green.
oni-swr commented 2026-11-25 19:06:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T18:21:50Z.


Independent verification of #2664 (IR: inline Succs, no per-instruction Vecs, bit-scan RegSet)

PR head e6ab345e7b73be37a0741a54767e061aad35239c, merges cleanly onto origin/main 13f91caee25f2fdf2c062be5f7a27f058e51cbca.

Environment: Windows 11 Pro 10.0.26200, rustc 1.98.1, VICTORY_WARP=1 + VICTORY_D3D12_WARP=1 on every run (WARP adapter only, no physical GPU created), DXC/dxil 1.8.2502.11 (Windows SDK 10.0.26100.0, via VICTORY_DXIL), cargo ... -j 4 --locked.

Tests/clippy vs baseline. origin/main 13f91caee25f2fdf2c062be5f7a27f058e51cbca: cargo test -p victory-shader --lib --locked -- --test-threads=1 = 267 passed, 3 failed, 3 ignored. The 3 failures are WARP limits and are the same 3 in every variant below: a_mask_joined_with_data_at_a_uniform_loop_is_its_number and permutes_read_the_lane_named_and_zero_from_lanes_left_out ("no pipeline for a wave of 32"), and gathers_at_a_level_match_the_hardware (WARP gather result differs). Clippy: cargo clippy -p victory-shader --all-targets --locked = 0 warnings.
With #2664: 271 passed, 3 failed (same 3), 4 ignored (+4 tests, +1 ignored benchmark). Clippy: 0 warnings.

Equivalence. Full diff read. Succs keeps the old order and duplicates (a branch with taken == not_taken still yields two entries, so the "single predecessor" patterns elsewhere behave the same); members() stops at REGS so padding bits are ignored; the bitset dedup in effects() keeps first-occurrence order (covered by effects_dedup_preserves_first_occurrence_order); valu_dwords is checked against the old split-based version for every VOP1/2/C/3/3P name plus edge strings. Output check with the throwaway hashing patch: 650 containers (476 distinct) byte-identical to origin/main.

Perf (release; bench_ir_build added to base for comparison, combined run). ir::build 2048 insts/128 blocks: 2235 / 2290 us (base, 2 rounds) -> 1839 / 1796 us; 64 movrel insts: 426 / 456 us -> 103 / 88 us.

Findings: no bugs. Nit only: Succs stores len as usize (a u8 would shrink it); irrelevant for correctness.

Limits: no physical GPU (WARP only), no game files; the 3 WARP-limited tests above are therefore not verified on hardware. Benchmarks are synthetic, release mode, one machine, two back-to-back rounds each for base and combined; they say nothing about real-title shaders.

AI-assisted: independent verification by Claude Code / Claude Sonnet 5.5, run on behalf of oni-swr. Claims for #1633.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7170805033 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2664#issuecomment-7170805033). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T18:21:50Z. --- **Independent verification of #2664** (IR: inline `Succs`, no per-instruction `Vec`s, bit-scan `RegSet`) PR head `e6ab345e7b73be37a0741a54767e061aad35239c`, merges cleanly onto `origin/main` `13f91caee25f2fdf2c062be5f7a27f058e51cbca`. **Environment:** Windows 11 Pro 10.0.26200, rustc 1.98.1, `VICTORY_WARP=1` + `VICTORY_D3D12_WARP=1` on every run (WARP adapter only, no physical GPU created), DXC/dxil 1.8.2502.11 (Windows SDK 10.0.26100.0, via `VICTORY_DXIL`), `cargo ... -j 4 --locked`. **Tests/clippy vs baseline.** `origin/main` `13f91caee25f2fdf2c062be5f7a27f058e51cbca`: `cargo test -p victory-shader --lib --locked -- --test-threads=1` = **267 passed, 3 failed, 3 ignored**. The 3 failures are WARP limits and are the same 3 in every variant below: `a_mask_joined_with_data_at_a_uniform_loop_is_its_number` and `permutes_read_the_lane_named_and_zero_from_lanes_left_out` ("no pipeline for a wave of 32"), and `gathers_at_a_level_match_the_hardware` (WARP gather result differs). Clippy: `cargo clippy -p victory-shader --all-targets --locked` = 0 warnings. With #2664: **271 passed, 3 failed (same 3), 4 ignored** (+4 tests, +1 ignored benchmark). Clippy: 0 warnings. **Equivalence.** Full diff read. `Succs` keeps the old order and duplicates (a branch with `taken == not_taken` still yields two entries, so the "single predecessor" patterns elsewhere behave the same); `members()` stops at `REGS` so padding bits are ignored; the bitset dedup in `effects()` keeps first-occurrence order (covered by `effects_dedup_preserves_first_occurrence_order`); `valu_dwords` is checked against the old split-based version for every VOP1/2/C/3/3P name plus edge strings. Output check with the throwaway hashing patch: **650 containers (476 distinct) byte-identical to `origin/main`**. **Perf (release; `bench_ir_build` added to base for comparison, combined run).** `ir::build` 2048 insts/128 blocks: 2235 / 2290 us (base, 2 rounds) -> 1839 / 1796 us; 64 `movrel` insts: 426 / 456 us -> 103 / 88 us. **Findings:** no bugs. Nit only: `Succs` stores `len` as `usize` (a `u8` would shrink it); irrelevant for correctness. **Limits:** no physical GPU (WARP only), no game files; the 3 WARP-limited tests above are therefore not verified on hardware. Benchmarks are synthetic, release mode, one machine, two back-to-back rounds each for base and combined; they say nothing about real-title shaders. AI-assisted: independent verification by Claude Code / Claude Sonnet 5.5, run on behalf of oni-swr. Claims for #1633.
oni-swr commented 2026-11-25 19:06:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T18:23:06Z.


Composition check: #2662 + #2664 + #2665 together

Heads: #2662 95f56a53f8ff90f700d74d102ad79538bad68771, #2664 e6ab345e7b73be37a0741a54767e061aad35239c, #2665 8105fdcfb68ac99d79ea728847a0f555b7a41521, merged in that order onto origin/main 13f91caee25f2fdf2c062be5f7a27f058e51cbca as a local merge commit (31ed3543e4c18b978f7b0a699a71f8d18e52a81b, not pushed). No conflicts: the three touch disjoint files (structure.rs; gfx10/fields.rs + ir.rs; emit/bitcode.rs + emit/shader.rs).

Environment: Windows 11 Pro 10.0.26200, rustc 1.98.1, VICTORY_WARP=1 + VICTORY_D3D12_WARP=1 (WARP only), dxil 1.8.2502.11 (SDK 10.0.26100.0), -j 4 --locked.

  • cargo test -p victory-shader --lib --locked -- --test-threads=1: 276 passed, 3 failed, 5 ignored. That is exactly baseline 267 + 2 + 4 + 3 new tests; the 3 failures are the same WARP-limited ones as on origin/main (wave-of-32 x2, WARP gather).
  • cargo clippy -p victory-shader --all-targets --locked: 0 warnings.
  • Emitted containers over the lib test run: 650 byte-identical to origin/main, plus one extra from #2665's new test (throwaway hashing patch, not committed).
  • Perf (release, combined vs base, 2 rounds each): shader::op 4096 calls 2.84-2.94 ms -> 0.53-0.56 ms; ir::build 2048 insts 2.24-2.29 ms -> 1.80-1.84 ms; 64 movrel insts 426-456 us -> 88-103 us; bitcode writer, 256x512 synthetic module, 8.9-9.8 ms -> 7.0-7.1 ms; BDD given n=13 ~465 us -> ~0.45 us (synthetic).
  • No interaction bugs found. The merge order does not matter (disjoint files).

Limits: no physical GPU, no game files; synthetic benchmarks only.

AI-assisted: independent verification by Claude Code / Claude Sonnet 5.5, run on behalf of oni-swr. Claims for #1633.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7170834074 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2664#issuecomment-7170834074). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T18:23:06Z. --- **Composition check: #2662 + #2664 + #2665 together** Heads: #2662 `95f56a53f8ff90f700d74d102ad79538bad68771`, #2664 `e6ab345e7b73be37a0741a54767e061aad35239c`, #2665 `8105fdcfb68ac99d79ea728847a0f555b7a41521`, merged in that order onto `origin/main` `13f91caee25f2fdf2c062be5f7a27f058e51cbca` as a local merge commit (`31ed3543e4c18b978f7b0a699a71f8d18e52a81b`, not pushed). No conflicts: the three touch disjoint files (`structure.rs`; `gfx10/fields.rs` + `ir.rs`; `emit/bitcode.rs` + `emit/shader.rs`). Environment: Windows 11 Pro 10.0.26200, rustc 1.98.1, `VICTORY_WARP=1` + `VICTORY_D3D12_WARP=1` (WARP only), dxil 1.8.2502.11 (SDK 10.0.26100.0), `-j 4 --locked`. - `cargo test -p victory-shader --lib --locked -- --test-threads=1`: **276 passed, 3 failed, 5 ignored**. That is exactly baseline 267 + 2 + 4 + 3 new tests; the 3 failures are the same WARP-limited ones as on `origin/main` (wave-of-32 x2, WARP gather). - `cargo clippy -p victory-shader --all-targets --locked`: 0 warnings. - Emitted containers over the lib test run: 650 byte-identical to `origin/main`, plus one extra from #2665's new test (throwaway hashing patch, not committed). - Perf (release, combined vs base, 2 rounds each): `shader::op` 4096 calls 2.84-2.94 ms -> 0.53-0.56 ms; `ir::build` 2048 insts 2.24-2.29 ms -> 1.80-1.84 ms; 64 `movrel` insts 426-456 us -> 88-103 us; bitcode writer, 256x512 synthetic module, 8.9-9.8 ms -> 7.0-7.1 ms; BDD `given` n=13 ~465 us -> ~0.45 us (synthetic). - No interaction bugs found. The merge order does not matter (disjoint files). Limits: no physical GPU, no game files; synthetic benchmarks only. AI-assisted: independent verification by Claude Code / Claude Sonnet 5.5, run on behalf of oni-swr. Claims for #1633.
fuzeofficlal commented 2026-11-25 20:06:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T19:27:35Z.


Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP + dxil.dll verification and code review of e6ab345e (on 13f91ca):

Verification (rustc 1.98.1 MSVC, Windows SDK 10.0.26100.0 dxil.dll)

  • cargo xtask policy: 184 files ok.
  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings and --features host: 0 warnings.
  • victory-shader (gfx10, ir, structure, emit::tests, emit::lower, emit::waterfall_tests on RTX 5090 + WARP + dxil.dll, emit::bitcode with unchanged FNV-1a): 101 passed, 0 failed, 3 ignored.
  • --release ir::tests::bench_ir_build: valu_cfg(2048 insts, 128 blks) = 1511.6 µs/run, movrel(64 insts, 128 vgprs) = 67.5 µs/run.
  • Merge compatibility with #2662 & #2665: clean zero-conflict 3-way git merge-tree across all three PRs.

Code Review Notes

  • Moving VOP3B.contains inside the non-Vop3p Vop3 arm, allocation-free valu_dwords (valu_dwords_matches_split_reference_for_all_valu_opcodes), stack-inline Succs, members bit-scan clearing padding bits past REGS = 385, and RegSet-backed effects() dedup preserving first-occurrence order are all strictly equivalent with zero unsafe. Clean and ready to merge.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7172325408 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2664#issuecomment-7172325408). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T19:27:35Z. --- Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP + `dxil.dll` verification and code review of `e6ab345e` (on `13f91ca`): ### Verification (`rustc 1.98.1` MSVC, Windows SDK `10.0.26100.0` `dxil.dll`) - `cargo xtask policy`: **184 files ok**. - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` and `--features host`: **0 warnings**. - `victory-shader` (`gfx10`, `ir`, `structure`, `emit::tests`, `emit::lower`, `emit::waterfall_tests` on RTX 5090 + WARP + `dxil.dll`, `emit::bitcode` with unchanged FNV-1a): **101 passed, 0 failed, 3 ignored**. - `--release` `ir::tests::bench_ir_build`: `valu_cfg(2048 insts, 128 blks) = 1511.6 µs/run`, `movrel(64 insts, 128 vgprs) = 67.5 µs/run`. - **Merge compatibility with #2662 & #2665:** clean zero-conflict 3-way `git merge-tree` across all three PRs. ### Code Review Notes - Moving `VOP3B.contains` inside the non-`Vop3p` `Vop3` arm, allocation-free `valu_dwords` (`valu_dwords_matches_split_reference_for_all_valu_opcodes`), stack-inline `Succs`, `members` bit-scan clearing padding bits past `REGS = 385`, and `RegSet`-backed `effects()` dedup preserving first-occurrence order are all strictly equivalent with zero `unsafe`. Clean and ready to merge.
Marvisak commented 2026-11-25 23:06:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:16:02Z.


Automated triage for the maintainers.

Verdict: merge candidate. I re-reviewed the rebased head 02fb20d. It is a behaviour-preserving performance change:

  • valu_dwords (gfx10/fields.rs) parses without a Vec, and a test checks it against the old split-based version for every VALU opcode.
  • VOP3B.contains is only evaluated in the VOP3 arm.
  • Exit::succs() returns an inline Succs (same order and duplicates as successors(), which is kept).
  • effects() dedups with a RegSet bitset in place of Vec::contains.

I checked that every entry in r is (reg, NONE) at that point, so deduplicating by register alone matches the old tuple compare, and first-occurrence order is kept. The RegSet::members part that already landed on main has been dropped. One small point: the bench_ir_build test is #[ignore]d, so it adds code to maintain but nothing runs it.

CI: check passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7176146072 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2664#issuecomment-7176146072). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T22:16:02Z. --- <!-- victory-triage v1 head=02fb20dff69a7ed6f16c5cefa91f65c89e885608 verdict=merge-candidate at=2026-11-26T03:21:59Z --> Automated triage for the maintainers. **Verdict: merge candidate.** I re-reviewed the rebased head `02fb20d`. It is a behaviour-preserving performance change: - `valu_dwords` (`gfx10/fields.rs`) parses without a `Vec`, and a test checks it against the old split-based version for every VALU opcode. - `VOP3B.contains` is only evaluated in the VOP3 arm. - `Exit::succs()` returns an inline `Succs` (same order and duplicates as `successors()`, which is kept). - `effects()` dedups with a `RegSet` bitset in place of `Vec::contains`. I checked that every entry in `r` is `(reg, NONE)` at that point, so deduplicating by register alone matches the old tuple compare, and first-occurrence order is kept. The `RegSet::members` part that already landed on `main` has been dropped. One small point: the `bench_ir_build` test is `#[ignore]`d, so it adds code to maintain but nothing runs it. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
upstream-sync changed title from [PR #2664] Shaders/IR: eliminate per-instruction/CFG Vec allocations and bit-scan RegSet to [PR #2664] Shaders/IR: eliminate per-instruction/CFG Vec allocations and O(1) effects dedup 2026-11-26 01:03:18 +00:00
RVZO6 commented 2026-11-26 01:04:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by RVZO6 on 2026-11-26T00:21:01Z.


Rebased onto current main (63bcca4, head 02fb20d). Dropped the RegSet::members() bit-scan and Effects changes that already landed on main (63bcca4), keeping zero-alloc valu_dwords + VOP3B scoping in gfx10/fields.rs, stack Exit::succs(), and O(1) RegSet dedup in effects(). Verified green on windows-latest MSVC + WARP SM 6.6 CI (clippy, xtask policy, full workspace tests): https://github.com/RVZO6/VIctory/actions/runs/45727774760.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7178662609 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2664#issuecomment-7178662609). Originally posted by [RVZO6](https://github.com/RVZO6) on 2026-11-26T00:21:01Z. --- Rebased onto current `main` (`63bcca4`, head `02fb20d`). Dropped the `RegSet::members()` bit-scan and `Effects` changes that already landed on `main` (`63bcca4`), keeping zero-alloc `valu_dwords` + VOP3B scoping in `gfx10/fields.rs`, stack `Exit::succs()`, and O(1) `RegSet` dedup in `effects()`. Verified green on `windows-latest` MSVC + WARP SM 6.6 CI (clippy, xtask policy, full workspace tests): https://github.com/RVZO6/VIctory/actions/runs/45727774760.
Dukestar69 commented 2026-11-26 04:29:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T04:29:05Z.

Review: APPROVED


Tested merged onto origin/main (63bcca4) on Windows 11 x64:

  • cargo test -p victory-shader --lib ir::tests: 11 passed, 0 failed, 1 ignored (including new exit_succs_matches_successors and effects_dedup_preserves_first_occurrence_order).
  • cargo test -p victory-shader --lib gfx10::fields::tests: 1 passed, 0 failed (valu_dwords_matches_split_reference_for_all_valu_opcodes).
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

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

<!-- greyfinch-sync:Marvisak/VIctory:review:6068560783 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2664#pullrequestreview-6068560783). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T04:29:05Z. **Review:** APPROVED --- Tested merged onto `origin/main` (`63bcca4`) on Windows 11 x64: - `cargo test -p victory-shader --lib ir::tests`: **11 passed, 0 failed, 1 ignored** (including new `exit_succs_matches_successors` and `effects_dedup_preserves_first_occurrence_order`). - `cargo test -p victory-shader --lib gfx10::fields::tests`: **1 passed, 0 failed** (`valu_dwords_matches_split_reference_for_all_valu_opcodes`). - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
fuzeofficlal commented 2026-11-27 02:41:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-27T02:41:28Z.

Review: APPROVED


Reviewed at 02fb20dff69a7ed6f16c5cefa91f65c89e885608 — APPROVE.

Verification

  • cargo xtask policy (191 files ok) and cargo clippy -p victory-shader --all-targets --all-features -- -D warnings passed cleanly (with no new rustfmt issues introduced).
  • Verified Succs ([usize; 2]) matches Exit's exact 0/1/2-successor invariant and preserves [taken, not_taken] order across all CFG callers, while preds, phis, reads, and writes remain growable Vecs with no fixed-capacity truncation risk for multi-dword memory ops or wide relative VGPR ranges.
  • Verified RegSet ([u64; 7], 448 bits) covers all 385 register indices (128 SGPR + SCC + 256 VGPR), and because all reads carry placeholder NONE during effects(), Reg-keyed deduplication preserves the exact first-occurrence order of the prior (Reg, Value) Vec::contains check.
  • Passed gfx10:: (17/17), ir:: (11/11, 1 benchmark ignored), structure:: (13/13, 1 benchmark ignored), and emit::lower::tests (33/33).

Non-blocking test notes

  • exit_succs_matches_successors (crates/victory-shader/src/ir.rs:1528) compares succs() against successors() (which delegates to succs()); asserting literal expected slices (including a branch with identical targets) would make it self-contained.
  • effects_dedup_preserves_first_occurrence_order (crates/victory-shader/src/ir.rs:1550) projects to Reg; adding a wave64 relative move reaching v255 would also cover the upper end of the RegSet bitset and (Reg, Value) pairs.
<!-- greyfinch-sync:Marvisak/VIctory:review:6082786339 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2664#pullrequestreview-6082786339). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-27T02:41:28Z. **Review:** APPROVED --- Reviewed at `02fb20dff69a7ed6f16c5cefa91f65c89e885608` — **APPROVE**. ### Verification - `cargo xtask policy` (`191 files ok`) and `cargo clippy -p victory-shader --all-targets --all-features -- -D warnings` passed cleanly (with no new `rustfmt` issues introduced). - Verified `Succs` (`[usize; 2]`) matches `Exit`'s exact 0/1/2-successor invariant and preserves `[taken, not_taken]` order across all CFG callers, while `preds`, `phis`, `reads`, and `writes` remain growable `Vec`s with no fixed-capacity truncation risk for multi-dword memory ops or wide relative VGPR ranges. - Verified `RegSet` (`[u64; 7]`, 448 bits) covers all 385 register indices (`128` SGPR + `SCC` + `256` VGPR), and because all `reads` carry placeholder `NONE` during `effects()`, `Reg`-keyed deduplication preserves the exact first-occurrence order of the prior `(Reg, Value)` `Vec::contains` check. - Passed `gfx10::` (17/17), `ir::` (11/11, 1 benchmark ignored), `structure::` (13/13, 1 benchmark ignored), and `emit::lower::tests` (33/33). ### Non-blocking test notes - `exit_succs_matches_successors` (`crates/victory-shader/src/ir.rs:1528`) compares `succs()` against `successors()` (which delegates to `succs()`); asserting literal expected slices (including a branch with identical targets) would make it self-contained. - `effects_dedup_preserves_first_occurrence_order` (`crates/victory-shader/src/ir.rs:1550`) projects to `Reg`; adding a wave64 relative move reaching `v255` would also cover the upper end of the `RegSet` bitset and `(Reg, Value)` pairs.
andrewpozdnakov7-jpg commented 2026-11-29 00:29:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-29T00:29:01Z.


I checked the exact 02fb20d IR changes together with the packed-storage change in #3813. Combined c584215 keeps both commits as parents. Git merged the changes cleanly.

All nine generated packed multiply, FMA and mixed shaders returned byte-identical DXIL against 02fb20d in five alternating Windows release comparisons. The Microsoft validator accepted each object. The combined build saved three allocations and 96 requested bytes per packed instruction, with the same reallocation count. The 512-instruction mixed case went from 15,932 to 14,396 allocations.

Mixed-chain translation medians were 0.851× at 128 instructions and 0.978× at 512. Pure multiply medians were 1.002–1.048×, and FMA medians were 0.956–1.020×. The VALU width, CFG successor and effects order regressions passed, along with the 33 lowerer tests, both strict Clippy configurations and the asset policy.

The next step is maintainer review. Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the work into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7248143116 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2664#issuecomment-7248143116). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-29T00:29:01Z. --- I checked the exact `02fb20d` IR changes together with the packed-storage change in #3813. [Combined `c584215`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/c5842155c51e70fa54454e6631f25c079d3d328e) keeps both commits as parents. Git merged the changes cleanly. All nine generated packed multiply, FMA and mixed shaders returned byte-identical DXIL against `02fb20d` in five alternating Windows release comparisons. The Microsoft validator accepted each object. The combined build saved three allocations and 96 requested bytes per packed instruction, with the same reallocation count. The 512-instruction mixed case went from 15,932 to 14,396 allocations. Mixed-chain translation medians were 0.851× at 128 instructions and 0.978× at 512. Pure multiply medians were 1.002–1.048×, and FMA medians were 0.956–1.020×. The VALU width, CFG successor and effects order regressions passed, along with the 33 lowerer tests, both strict Clippy configurations and the asset policy. The next step is maintainer review. Please retain the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the work into another commit. AI-assisted with OpenAI Codex.
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/2664:upstream-pr/2664'
git switch 'upstream-pr/2664'

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/2664'
git switch 'upstream-pr/2664'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2664'
git switch 'upstream-pr/2664'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2664'
git switch 'main'
git merge --squash 'upstream-pr/2664'
git switch 'main'
git merge --ff-only 'upstream-pr/2664'
git switch 'main'
git merge 'upstream-pr/2664'
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!2662
No description provided.