Shaders: index interpolation halves on demand #179

Closed
github-bot wants to merge 2 commits from gh-pr/179/head into gh-pr/179/base
Owner

@⁠TG0000 on GitHub · 2026-11-24 01:10 UTC · original
TG0000:perf/lazy-shader-interpolation-index → main · +195 −48 · 1 files · 2 commits · closed without merging

Summary

  • Build the SSA definition and phi maps only when a second interpolation instruction needs to trace its first half. All pairs in a shader reuse those maps.
  • Recognize packed interpolation by its decoded attribute operand so the I/O pass can skip opcode-name lookups for ordinary ALU instructions.
  • Cover branch-merged first halves, vertex sampling, packed f16 interpolation, and unsupported packed forms with hand-written synthetic inputs.

Benchmark

Median of seven release samples on a Ryzen 9 5900X with Windows MSVC. The harness builds synthetic SSA before timing and measures only I/O raising.

Synthetic shader ALU instructions Before (ns) After (ns) Before/after
Compute 64 4678.4 124.6 37.55x
Compute 512 30949.8 1063.5 29.10x
Compute 4096 414438.9 9949.0 41.66x
Pixel vertex sample 64 5867.9 301.6 19.46x
Pixel vertex sample 512 41911.7 1253.4 33.44x
Pixel vertex sample 4096 373081.8 10494.5 35.55x
Pixel interpolation pair 64 6226.4 4210.6 1.48x
Pixel interpolation pair 512 36562.0 27506.3 1.33x
Pixel interpolation pair 4096 314436.7 317615.4 0.99x

Run the same harness at the benchmark-only commit f5f4ad9 and at the PR head:

cargo +stable-x86_64-pc-windows-msvc test --release -p victory-shader --lib io::tests::bench_raise_io -- --ignored --nocapture --test-threads=1

Verification

  • MSVC workspace tests passed (267 passed, 5 ignored).
  • MSVC Clippy passed with existing warnings outside the changed file.
  • cargo xtask policy, targeted rustfmt --check, and git diff --check passed.
  • AI-assisted. All benchmark and regression inputs are synthetic. The retail game was not launched, so the timings do not measure frame rate.
**@⁠TG0000** on GitHub · 2026-11-24 01:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/179) `TG0000:perf/lazy-shader-interpolation-index` → `main` · +195 −48 · 1 files · 2 commits · closed without merging ## Summary - Build the SSA definition and phi maps only when a second interpolation instruction needs to trace its first half. All pairs in a shader reuse those maps. - Recognize packed interpolation by its decoded attribute operand so the I/O pass can skip opcode-name lookups for ordinary ALU instructions. - Cover branch-merged first halves, vertex sampling, packed f16 interpolation, and unsupported packed forms with hand-written synthetic inputs. ## Benchmark Median of seven release samples on a Ryzen 9 5900X with Windows MSVC. The harness builds synthetic SSA before timing and measures only I/O raising. | Synthetic shader | ALU instructions | Before (ns) | After (ns) | Before/after | | --- | ---: | ---: | ---: | ---: | | Compute | 64 | 4678.4 | 124.6 | 37.55x | | Compute | 512 | 30949.8 | 1063.5 | 29.10x | | Compute | 4096 | 414438.9 | 9949.0 | 41.66x | | Pixel vertex sample | 64 | 5867.9 | 301.6 | 19.46x | | Pixel vertex sample | 512 | 41911.7 | 1253.4 | 33.44x | | Pixel vertex sample | 4096 | 373081.8 | 10494.5 | 35.55x | | Pixel interpolation pair | 64 | 6226.4 | 4210.6 | 1.48x | | Pixel interpolation pair | 512 | 36562.0 | 27506.3 | 1.33x | | Pixel interpolation pair | 4096 | 314436.7 | 317615.4 | 0.99x | Run the same harness at the benchmark-only commit `f5f4ad9` and at the PR head: ```powershell cargo +stable-x86_64-pc-windows-msvc test --release -p victory-shader --lib io::tests::bench_raise_io -- --ignored --nocapture --test-threads=1 ``` ## Verification - MSVC workspace tests passed (267 passed, 5 ignored). - MSVC Clippy passed with existing warnings outside the changed file. - `cargo xtask policy`, targeted `rustfmt --check`, and `git diff --check` passed. - AI-assisted. All benchmark and regression inputs are synthetic. The retail game was not launched, so the timings do not measure frame rate.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:53:34 +00:00
github-bot closed this pull request 2026-11-26 03:53:34 +00:00
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-24 01:19 UTC · original

Tested 3248948 on Arch Linux x86_64, rustc 1.98.1: pass.

  • cargo test -p victory-shader: 59 passed, 0 failed, 1 ignored (2 test binaries), including the 4 tests this PR adds.
  • The ignored test is io::tests::bench_raise_io (benchmark).
  • The full workspace still needs #112 for the victory-gpu E0425.

No game data used.

**@⁠DaviTostes** on GitHub · 2026-11-24 01:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/179#issuecomment-7118989606) Tested `3248948` on **Arch Linux x86_64, rustc 1.98.1**: **pass**. - `cargo test -p victory-shader`: **59 passed, 0 failed, 1 ignored** (2 test binaries), including the 4 tests this PR adds. - The ignored test is `io::tests::bench_raise_io` (benchmark). - The full workspace still needs #112 for the `victory-gpu` E0425. No game data used.

Pull request closed

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!179
No description provided.