perf(shader): default-on finite-data legacy multiply lowering (VICTORY_LEGACY_MUL=data) #346

Manually merged
github merged 1 commit from github-bot/gh-346 into gh-pr/346/base 2026-12-02 15:06:57 +00:00 AGit
Owner

@⁠Androtim on GitHub · 2026-12-02 14:46 UTC · original
Androtim:perf/legacy-mul-data → main · +340 −6 · 6 files · 1 commits · merged 2026-12-02 15:03 UTC

Summary

  • Ported finite-data bitcode analysis (Module::finite_data in crates/victory-shader/src/emit/bitcode/finite.rs) and default-on VICTORY_LEGACY_MUL=data lowering (LegacyForm::Data in crates/victory-shader/src/emit/lower.rs) for v_mul_legacy_f32 / v_mac_legacy_f32 / v_mad_legacy_f32 on non-RDNA GPUs (NVIDIA/Intel).
  • Elides redundant 5-instruction zero-guard fcmp oeq 0.0 + or + select sequences when both factors are provably finite from inputs/constants/loads (or either is a non-zero finite constant / a == b), while keeping a single zero guard when one factor may be non-finite (e.g. rcp/sqrt/log/exp/fdiv).
  • Preserves the existing AMD RDNA rdna::LEGACY bounded path when host_rdna() & LEGACY != 0 and provides kill-switch VICTORY_LEGACY_MUL=0 (or exact), alongside bounded and ieee.
  • Pinned synthetic NaN/Inf exactness unit tests (valu_tests::rdna_forms_give_what_the_spelled_out_ones_give, diff_tests::float_semantics_are_the_consoles) to LegacyForm::Exact and added unit tests in finite.rs and lower_tests.rs.

Warm-Cache Plain --release Paired A/B vs main (baf967f, RTX 4060 Ti 8 GB, Series X + DLSS Quality)

1440p (90s in-world, warm shader caches)

Metric main (baf967f) perf/legacy-mul-data Delta
Median FPS 14.4 fps (69.5 ms) 14.75 fps (67.6 ms) +0.35 fps (-1.9 ms)
card_busy_avg 72.4% 70.1% -2.3%
preparing_core_ms avg / med 27.08 / 33.00 ms 25.61 / 31.80 ms -1.47 / -1.20 ms
waiting_flights_ms avg 0.66 ms 0.14 ms -0.52 ms (-79%)
Crashes / Device Removed 0 / 0 0 / 0 clean

4K (90s in-world, warm shader caches)

Metric main (baf967f) perf/legacy-mul-data Delta
Median FPS / Frame Time 6.3 fps (159.7 ms) 6.3 fps (157.6 ms) -2.1 ms/frame
card_busy_avg / GPU 90.2% / 103.25 ms 88.0% / 102.85 ms -2.2% / -0.4 ms
Dedicated VRAM max 6708 MB 6561 MB -147 MB
Working set avg / max 16774 / 20960 MB 14020 / 19691 MB -2754 / -1269 MB
Crashes / Device Removed 0 / 0 0 / 0 clean

Diagnostics Visual Check (--features diagnostics, 1440p 90s)

  • 6/6 Gates PASS: world_windows=21, max_draws=14031, crashes=0, no_host_texture_errors=0, used_max=6231 / 6697 MB (over=0 MB), pngs=24, lit=21/24, luma=99.98, near_black=0.07%, edge_energy=7.91, magenta=0.0%.
  • Visually inspected 3 largest PNGs (frame-2274.png, frame-2266.png, frame-2290.png): clean lighting, water reflections, textures, foliage, and zero NaN/magenta artifacts.

Static & Test Verification

  • cargo +1.98.1-x86_64-pc-windows-gnu xtask policy: 325 files ok
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --locked finite: 2 passed; 0 failed
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --locked lower::tests: 24 passed; 0 failed; 1 ignored
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --locked valu_tests: 38 passed; 0 failed; 2 ignored
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --locked wave64_tests: 19 passed; 0 failed
  • Dual workspace clippy --workspace --all-targets -- -D warnings (default & --features diagnostics): PASS
  • objdump -p: standard Windows DLLs only
**@⁠Androtim** on GitHub · 2026-12-02 14:46 UTC · [original](https://github.com/Androtim/MiniVI/pull/346) `Androtim:perf/legacy-mul-data` → `main` · +340 −6 · 6 files · 1 commits · merged 2026-12-02 15:03 UTC ## Summary - Ported finite-data bitcode analysis (`Module::finite_data` in `crates/victory-shader/src/emit/bitcode/finite.rs`) and default-on `VICTORY_LEGACY_MUL=data` lowering (`LegacyForm::Data` in `crates/victory-shader/src/emit/lower.rs`) for `v_mul_legacy_f32` / `v_mac_legacy_f32` / `v_mad_legacy_f32` on non-RDNA GPUs (NVIDIA/Intel). - Elides redundant 5-instruction zero-guard `fcmp oeq 0.0` + `or` + `select` sequences when both factors are provably finite from inputs/constants/loads (or either is a non-zero finite constant / `a == b`), while keeping a single zero guard when one factor may be non-finite (e.g. `rcp`/`sqrt`/`log`/`exp`/`fdiv`). - Preserves the existing AMD RDNA `rdna::LEGACY` bounded path when `host_rdna() & LEGACY != 0` and provides kill-switch `VICTORY_LEGACY_MUL=0` (or `exact`), alongside `bounded` and `ieee`. - Pinned synthetic NaN/Inf exactness unit tests (`valu_tests::rdna_forms_give_what_the_spelled_out_ones_give`, `diff_tests::float_semantics_are_the_consoles`) to `LegacyForm::Exact` and added unit tests in `finite.rs` and `lower_tests.rs`. ## Warm-Cache Plain `--release` Paired A/B vs `main` (`baf967f`, RTX 4060 Ti 8 GB, Series X + DLSS Quality) ### 1440p (90s in-world, warm shader caches) | Metric | `main` (`baf967f`) | `perf/legacy-mul-data` | Delta | |---|---:|---:|---:| | Median FPS | `14.4 fps` (`69.5 ms`) | `14.75 fps` (`67.6 ms`) | **`+0.35 fps` (`-1.9 ms`)** | | `card_busy_avg` | `72.4%` | `70.1%` | **`-2.3%`** | | `preparing_core_ms` avg / med | `27.08 / 33.00 ms` | `25.61 / 31.80 ms` | `-1.47 / -1.20 ms` | | `waiting_flights_ms` avg | `0.66 ms` | `0.14 ms` | **`-0.52 ms` (`-79%`)** | | Crashes / Device Removed | `0 / 0` | `0 / 0` | clean | ### 4K (90s in-world, warm shader caches) | Metric | `main` (`baf967f`) | `perf/legacy-mul-data` | Delta | |---|---:|---:|---:| | Median FPS / Frame Time | `6.3 fps` (`159.7 ms`) | `6.3 fps` (`157.6 ms`) | **`-2.1 ms/frame`** | | `card_busy_avg` / `GPU` | `90.2%` / `103.25 ms` | `88.0%` / `102.85 ms` | **`-2.2%` / `-0.4 ms`** | | Dedicated VRAM max | `6708 MB` | `6561 MB` | **`-147 MB`** | | Working set avg / max | `16774 / 20960 MB` | `14020 / 19691 MB` | **`-2754 / -1269 MB`** | | Crashes / Device Removed | `0 / 0` | `0 / 0` | clean | ## Diagnostics Visual Check (`--features diagnostics`, 1440p 90s) - **6/6 Gates PASS**: `world_windows=21`, `max_draws=14031`, `crashes=0`, `no_host_texture_errors=0`, `used_max=6231 / 6697 MB` (`over=0 MB`), `pngs=24`, `lit=21/24`, `luma=99.98`, `near_black=0.07%`, `edge_energy=7.91`, `magenta=0.0%`. - Visually inspected 3 largest PNGs (`frame-2274.png`, `frame-2266.png`, `frame-2290.png`): clean lighting, water reflections, textures, foliage, and zero NaN/magenta artifacts. ## Static & Test Verification - `cargo +1.98.1-x86_64-pc-windows-gnu xtask policy`: `325 files ok` - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --locked finite`: `2 passed; 0 failed` - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --locked lower::tests`: `24 passed; 0 failed; 1 ignored` - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --locked valu_tests`: `38 passed; 0 failed; 2 ignored` - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --locked wave64_tests`: `19 passed; 0 failed` - Dual workspace `clippy --workspace --all-targets -- -D warnings` (default & `--features diagnostics`): PASS - `objdump -p`: standard Windows DLLs only
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 14:50:21 +00:00
github-bot changed target branch from main to gh-pr/346/base 2026-12-02 15:06:55 +00:00
github manually merged commit 0574b47357 into gh-pr/346/base 2026-12-02 15:06:57 +00:00
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/Androtim--MiniVI!346
No description provided.