Build: a ship profile with fat LTO and one codegen unit #2424

Open
Halfect wants to merge 1 commit from upstream-pr/2426 into main
Halfect commented 2026-11-25 13:15:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-25T13:15:48Z.


What

The build half of #2384: a [profile.ship] that inherits release and turns on fat link-time optimisation across the whole crate graph with one codegen unit, so the compiler can inline and specialise across crate boundaries.

cargo build --profile ship -p victory   # target\ship\victory.exe

Why

#2384 reports that two other Rust game ports (OpenInfestation, OpenV2K) measured 5-10% off their CPU frame time from the same setting, with event logs and snapshots byte-identical — Rust does not contract or reassociate floating point unless asked. That figure is the other ports', not VIctory's; see the measurements below. A fat-LTO build compiles several times slower, so it gets its own profile rather than changing release; the ship directory also keeps it from evicting the plain release build.

Measured on VIctory (in this thread)

  • Runtime: no reproducible win measured. @borosf drove every opcode through the full decode → ir → structure → resource → lower → write path (the census fixture, launch cost priced out): ship vs release came out ≈3% apart, inside run-to-run variance, with one of three passes slower. An earlier −8.9% figure from the same measurement was retracted — it was cargo's launch overhead, not the profile.
  • Binary size: ≈7% smaller. 7.01 → 6.51 MiB (@DrDarkDK, Ryzen 9 7900X); 7,671,808 → 7,136,768 bytes (@futurepro62, RTX 5070 Ti host). Both victory.exe builds answer --help.
  • Build time: ≈2.7-3.5× slower (84 s vs 29 s for -p victory; 119 s vs 34 s for one crate's test binary), matching the issue's "compiles several times slower".
  • Correctness unchanged under the profile: cargo test --workspace --profile ship 773 passed / 0 failed with only the pre-existing main-side skips (@futurepro62); the opcode census passes under ship (@borosf).

So the honest case is a smaller, whole-program-optimised shipping binary at a higher compile-time cost — not a measured speedup on this codebase. Whether that trade is worth a profile is the maintainer's call.

Deliberately left out

  • .cargo/config.toml with target-cpu=x86-64-v3 (the issue's other build idea): it would change every build on every host — CI, contributors' machines — and the issue's own data has v3 no better than v2. That is a maintainer's call, not part of this profile.
  • Native 16-bit shader math (the issue's first half): being probed in the issue thread, no code here.

Checks

  • cargo check --locked --profile ship -p xtask: pass (profile accepted).
  • cargo build --locked --profile ship -p xtask: pass — a real fat-LTO link producing target\ship\xtask.exe.
  • cargo build --locked --profile ship -p victory: pass (1 m 19 s); the built target\ship\victory.exe --help runs.
  • cargo xtask policy: 184 files ok.
  • git diff --check: clean.
  • The profile is additive and changes nothing for the existing dev/release/diag builds.

No game data, no title executable. AI-assisted (Kimi).

<!-- greyfinch-sync:Marvisak/VIctory:issue:5492055987 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2426). Originally posted by [Halfect](https://github.com/Halfect) on 2026-11-25T13:15:48Z. --- ## What The build half of #2384: a `[profile.ship]` that inherits `release` and turns on fat link-time optimisation across the whole crate graph with one codegen unit, so the compiler can inline and specialise across crate boundaries. ```powershell cargo build --profile ship -p victory # target\ship\victory.exe ``` ## Why #2384 reports that two other Rust game ports (OpenInfestation, OpenV2K) measured **5-10% off their CPU frame time** from the same setting, with event logs and snapshots byte-identical — Rust does not contract or reassociate floating point unless asked. That figure is the other ports', not VIctory's; see the measurements below. A fat-LTO build compiles several times slower, so it gets its own profile rather than changing `release`; the `ship` directory also keeps it from evicting the plain release build. ## Measured on VIctory (in this thread) - **Runtime: no reproducible win measured.** @borosf drove every opcode through the full `decode → ir → structure → resource → lower → write` path (the census fixture, launch cost priced out): `ship` vs `release` came out ≈3% apart, inside run-to-run variance, with one of three passes slower. An earlier −8.9% figure from the same measurement was retracted — it was cargo's launch overhead, not the profile. - **Binary size: ≈7% smaller.** 7.01 → 6.51 MiB (@DrDarkDK, Ryzen 9 7900X); 7,671,808 → 7,136,768 bytes (@futurepro62, RTX 5070 Ti host). Both `victory.exe` builds answer `--help`. - **Build time: ≈2.7-3.5× slower** (84 s vs 29 s for `-p victory`; 119 s vs 34 s for one crate's test binary), matching the issue's "compiles several times slower". - **Correctness unchanged under the profile:** `cargo test --workspace --profile ship` 773 passed / 0 failed with only the pre-existing main-side skips (@futurepro62); the opcode census passes under `ship` (@borosf). So the honest case is a smaller, whole-program-optimised shipping binary at a higher compile-time cost — not a measured speedup on this codebase. Whether that trade is worth a profile is the maintainer's call. ## Deliberately left out - **`.cargo/config.toml` with `target-cpu=x86-64-v3`** (the issue's other build idea): it would change *every* build on *every* host — CI, contributors' machines — and the issue's own data has v3 no better than v2. That is a maintainer's call, not part of this profile. - **Native 16-bit shader math** (the issue's first half): being probed in the issue thread, no code here. ## Checks - `cargo check --locked --profile ship -p xtask`: pass (profile accepted). - `cargo build --locked --profile ship -p xtask`: **pass** — a real fat-LTO link producing `target\ship\xtask.exe`. - `cargo build --locked --profile ship -p victory`: pass (1 m 19 s); the built `target\ship\victory.exe --help` runs. - `cargo xtask policy`: **184 files ok**. - `git diff --check`: clean. - The profile is additive and changes nothing for the existing `dev`/`release`/`diag` builds. No game data, no title executable. AI-assisted (Kimi).
catminou4 commented 2026-11-25 13:19:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T13:19:34Z.

Review: COMMENTED


Ship profile with fat LTO and one codegen unit. Trivial build config; note binaries grow and builds get much slower — documented. Fine.

<!-- greyfinch-sync:Marvisak/VIctory:review:6058347367 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2426#pullrequestreview-6058347367). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T13:19:34Z. **Review:** COMMENTED --- Ship profile with fat LTO and one codegen unit. Trivial build config; note binaries grow and builds get much slower — documented. Fine.
DrDarkDK commented 2026-11-25 14:07:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DrDarkDK on 2026-11-25T13:20:41Z.


I built the full victory.exe at 6b37509 with Rust 1.98.1 MSVC on Windows 11 / Ryzen 9 7900X. Both cargo build --locked --profile <profile> -p victory builds succeeded, and both executables returned --help.

Profile Build time from an empty profile directory victory.exe
release 28.6 s 7.01 MiB
ship 84.3 s 6.51 MiB

I also ran nine interleaved pairs of the existing synthetic BCPack benchmark. Median release → ship times were BC1 86.8 → 85.9, BC4 88.1 → 86.3, and BC7 297.8 → 301.1 ns/block. The ranges overlapped for all three formats, so I wouldn’t infer a BCPack speedup from this run.

No game data used. No frame-time measurements.

AI-assisted with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163640483 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7163640483). Originally posted by [DrDarkDK](https://github.com/DrDarkDK) on 2026-11-25T13:20:41Z. --- I built the full `victory.exe` at `6b37509` with Rust 1.98.1 MSVC on Windows 11 / Ryzen 9 7900X. Both `cargo build --locked --profile <profile> -p victory` builds succeeded, and both executables returned `--help`. | Profile | Build time from an empty profile directory | `victory.exe` | |---|---:|---:| | `release` | 28.6 s | 7.01 MiB | | `ship` | 84.3 s | 6.51 MiB | I also ran nine interleaved pairs of the existing synthetic BCPack benchmark. Median `release` → `ship` times were BC1 86.8 → 85.9, BC4 88.1 → 86.3, and BC7 297.8 → 301.1 ns/block. The ranges overlapped for all three formats, so I wouldn’t infer a BCPack speedup from this run. No game data used. No frame-time measurements. *AI-assisted with Codex.*
Halfect commented 2026-11-25 14:07:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-25T13:32:07Z.


Thanks @DrDarkDK for the independent Ryzen 9 7900X run — the clean release/ship builds, the working --help on both, and the binary-size drop (7.01 → 6.51 MiB) match what this profile is for.

The BCPack result is the expected outcome and worth stating plainly: the synthetic BCPack benchmark spends its time in already-hot inner loops that the release profile optimizes well, so fat LTO plus one codegen unit has nothing left to win there — overlapping ranges for all three formats is consistent with that. The profile's value is the smaller, whole-program-optimized shipping executable, not a BCPack speedup, and the PR body doesn't claim one.

Nothing further from my side; ready for review.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163916710 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7163916710). Originally posted by [Halfect](https://github.com/Halfect) on 2026-11-25T13:32:07Z. --- Thanks @DrDarkDK for the independent Ryzen 9 7900X run — the clean `release`/`ship` builds, the working `--help` on both, and the binary-size drop (7.01 → 6.51 MiB) match what this profile is for. The BCPack result is the expected outcome and worth stating plainly: the synthetic BCPack benchmark spends its time in already-hot inner loops that the `release` profile optimizes well, so fat LTO plus one codegen unit has nothing left to win there — overlapping ranges for all three formats is consistent with that. The profile's value is the smaller, whole-program-optimized shipping executable, not a BCPack speedup, and the PR body doesn't claim one. Nothing further from my side; ready for review.
Marvisak commented 2026-11-25 16:09:15 +00:00 (Migrated from github.com)

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


Automated triage for the maintainers.

The head is still 6b19f3a. It adds [profile.ship] (inherits release, lto = "fat", codegen-units = 1) to the workspace Cargo.toml and one README sentence. Build-profile changes are the maintainer's call, so the verdict stays. Nothing more is needed from you.

Thanks to @futurepro62 for the ship-profile run. On an RTX 5070 Ti, cargo test --workspace --profile ship had no failures beyond those already failing on main. The build took about 2.7x longer and victory.exe came out 7% smaller. That confirms the profile builds and does not change test results. It still says nothing about frame time in the title, so the trade-off is for the maintainer to weigh.

Verdict: needs work (needs the maintainer's decision). CI: passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167016076 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7167016076). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T15:33:02Z. --- <!-- victory-triage v1 head=6b19f3ada37be91f611a66b7e33eabbfbb65b247 verdict=needs-work at=2026-11-26T03:20:04Z --> Automated triage for the maintainers. The head is still `6b19f3a`. It adds `[profile.ship]` (inherits `release`, `lto = "fat"`, `codegen-units = 1`) to the workspace `Cargo.toml` and one README sentence. Build-profile changes are the maintainer's call, so the verdict stays. Nothing more is needed from you. Thanks to @futurepro62 for the `ship`-profile run. On an RTX 5070 Ti, `cargo test --workspace --profile ship` had no failures beyond those already failing on `main`. The build took about 2.7x longer and `victory.exe` came out 7% smaller. That confirms the profile builds and does not change test results. It still says nothing about frame time in the title, so the trade-off is for the maintainer to weigh. **Verdict: needs work (needs the maintainer's decision).** CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Halfect commented 2026-11-25 17:05:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-25T16:13:18Z.


Thanks — both README problems fixed in 6b19f3a (also rebased onto current main 67e8ae1; Cargo.toml unchanged).

  • The path no longer contains the vertical tab: it is now typed as `target\ship\victory.exe` (verified no control characters remain in the file).
  • The paragraph is one sentence, build instructions only: "For a build to keep rather than iterate on, build with --profile ship (target\ship\victory.exe)." The other-ports figures are dropped; the measurements that stay with the PR are the ones taken on VIctory itself in this thread — @DrDarkDK's independent Ryzen 9 7900X run above (release 28.6 s / 7.01 MiB → ship 84.3 s / 6.51 MiB, both binaries answering --help, BCPack ranges overlapping) and this PR's own timings.

Validation on 6b19f3a (Windows, CPU-only): cargo build --locked --profile ship -p victory succeeds (1 m 19 s) and the built target\ship\victory.exe --help runs; cargo xtask policy 184 files ok; git diff --check clean.

AI-assisted (Kimi).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167698445 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7167698445). Originally posted by [Halfect](https://github.com/Halfect) on 2026-11-25T16:13:18Z. --- Thanks — both README problems fixed in `6b19f3a` (also rebased onto current main `67e8ae1`; `Cargo.toml` unchanged). - The path no longer contains the vertical tab: it is now typed as `` `target\ship\victory.exe` `` (verified no control characters remain in the file). - The paragraph is one sentence, build instructions only: "For a build to keep rather than iterate on, build with `--profile ship` (`target\ship\victory.exe`)." The other-ports figures are dropped; the measurements that stay with the PR are the ones taken on VIctory itself in this thread — @DrDarkDK's independent Ryzen 9 7900X run above (`release` 28.6 s / 7.01 MiB → `ship` 84.3 s / 6.51 MiB, both binaries answering `--help`, BCPack ranges overlapping) and this PR's own timings. Validation on `6b19f3a` (Windows, CPU-only): `cargo build --locked --profile ship -p victory` succeeds (1 m 19 s) and the built `target\ship\victory.exe --help` runs; `cargo xtask policy` 184 files ok; `git diff --check` clean. AI-assisted (Kimi).
kotekompotek commented 2026-11-25 17:05:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T16:53:44Z.


Clean: [profile.ship] inherits release, adds lto = "fat" + codegen-units = 1 — the standard max-optimisation build, correctly documented as sharing release's feature set and landing in its own target/ship/ (won't evict iterate builds). Nothing else changes.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7168693748 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7168693748). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T16:53:44Z. --- Clean: `[profile.ship]` inherits release, adds `lto = "fat"` + `codegen-units = 1` — the standard max-optimisation build, correctly documented as sharing release's feature set and landing in its own `target/ship/` (won't evict iterate builds). Nothing else changes.
Halfect commented 2026-11-25 23:05:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-25T22:08:41Z.


Thanks @kotekompotek for the read — yes, that is the intent: ship inherits release wholesale and changes only lto = "fat" + codegen-units = 1, so the iterate profiles (dev/release/diag) are untouched and the profile lands in its own target\ship\ directory. Nothing further from my side; the profile decision rests with the maintainer.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7175991763 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7175991763). Originally posted by [Halfect](https://github.com/Halfect) on 2026-11-25T22:08:41Z. --- Thanks @kotekompotek for the read — yes, that is the intent: `ship` inherits `release` wholesale and changes only `lto = "fat"` + `codegen-units = 1`, so the iterate profiles (`dev`/`release`/`diag`) are untouched and the profile lands in its own `target\ship\` directory. Nothing further from my side; the profile decision rests with the maintainer.
futurepro62 commented 2026-11-26 02:07:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-26T01:51:26Z.


Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head 6b19f3a (on its base 67e8ae1).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 773 passed, 0 failed, 9 ignored.
  • No new #[test] functions in the diff.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7180209608 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7180209608). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-26T01:51:26Z. --- Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head `6b19f3a` (on its base `67e8ae1`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **773 passed, 0 failed, 9 ignored**. - No new `#[test]` functions in the diff. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Halfect commented 2026-11-26 03:05:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-26T02:10:49Z.


Thanks @futurepro62 for the full-suite run on the RTX 5070 Ti — 773 passed / 0 failed on the exact head 6b19f3a, with the skips accounted for by pre-existing main-side issues (#2571, #1835/#2317, #1744), is exactly the confirmation this profile change needed. Nothing further from my side; the profile decision rests with the maintainer.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7180540138 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7180540138). Originally posted by [Halfect](https://github.com/Halfect) on 2026-11-26T02:10:49Z. --- Thanks @futurepro62 for the full-suite run on the RTX 5070 Ti — 773 passed / 0 failed on the exact head `6b19f3a`, with the skips accounted for by pre-existing main-side issues (#2571, #1835/#2317, #1744), is exactly the confirmation this profile change needed. Nothing further from my side; the profile decision rests with the maintainer.
futurepro62 commented 2026-11-26 03:05:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-26T02:21:48Z.


Follow-up to my report above, which was a debug run, so it didn't touch the new profile. Same head 6b19f3a, same machine (RTX 5070 Ti, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC).

ship vs release, each a full build of -p victory --locked (all 86 crates compiled):

--release --profile ship
Build time 29 s 79 s (about 2.7×)
victory.exe 7,671,808 bytes 7,136,768 bytes (7% smaller)
  • target\ship\victory.exe --help starts and prints its usage, so the README's path is right.
  • cargo test --workspace --locked --profile ship --no-fail-fast -- --test-threads=4 (same skips as my report above, tests that fail on main on this card): 773 passed, 0 failed, 9 ignored, no crashes, so fat LTO with one codegen unit doesn't change any test result here.

Not tested

  • Speed in the title: I only run the test suite, so this says nothing about how much faster the ship build plays.

AI use

  • Claude Code (Claude Opus 5.5) ran the builds and tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7180732720 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7180732720). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-26T02:21:48Z. --- Follow-up to [my report above](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7180209608), which was a debug run, so it didn't touch the new profile. Same head `6b19f3a`, same machine (RTX 5070 Ti, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC). **`ship` vs `release`**, each a full build of `-p victory --locked` (all 86 crates compiled): | | `--release` | `--profile ship` | |---|---|---| | Build time | 29 s | 79 s (about 2.7×) | | `victory.exe` | 7,671,808 bytes | 7,136,768 bytes (7% smaller) | - `target\ship\victory.exe --help` starts and prints its usage, so the README's path is right. - `cargo test --workspace --locked --profile ship --no-fail-fast -- --test-threads=4` (same skips as my report above, tests that fail on `main` on this card): **773 passed, 0 failed, 9 ignored**, no crashes, so fat LTO with one codegen unit doesn't change any test result here. **Not tested** - Speed in the title: I only run the test suite, so this says nothing about how much faster the `ship` build plays. **AI use** - Claude Code (Claude Opus 5.5) ran the builds and tests and wrote this report. I checked it before posting.
Halfect commented 2026-11-26 03:05:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-26T02:33:31Z.


Thanks @futurepro62 for the follow-up on the ship profile itself — a full cargo test --workspace --profile ship run at 773 passed / 0 failed, plus the 2.7× build time and 7% smaller victory.exe matching @DrDarkDK's independent numbers on different hardware, is exactly the confirmation this change needed. Nothing further from my side; the profile decision rests with the maintainer.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7180913365 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7180913365). Originally posted by [Halfect](https://github.com/Halfect) on 2026-11-26T02:33:31Z. --- Thanks @futurepro62 for the follow-up on the `ship` profile itself — a full `cargo test --workspace --profile ship` run at 773 passed / 0 failed, plus the 2.7× build time and 7% smaller `victory.exe` matching @DrDarkDK's independent numbers on different hardware, is exactly the confirmation this change needed. Nothing further from my side; the profile decision rests with the maintainer.
borosf commented 2026-11-26 13:04:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by borosf on 2026-11-26T12:54:43Z.


Measured this on an Intel Arc B580 (Windows 11), release vs the same [profile] this PR adds — reporting it here rather than opening a competing profile PR, since NEW-134/this PR own it.

Method. guard_runs is the only bench in the tree, and it times structure::structure (plus ir::build) — structurisation, not the code this profile actually helps (emit/lower.rs, bitcode.rs::write). So I measured the whole translate path instead, via the existing opcode census, which drives every opcode of every table through decode -> ir -> structure -> resource -> lower -> write:

cargo test --release -p victory-shader --lib --locked -- --exact emit::census_tests::every_opcode_translate_or_refuse_never_panic
cargo test --profile perf -p victory-shader --lib --locked -- --exact emit::census_tests::every_opcode_translate_or_refuse_never_panic

(perf here = inherits = "release", lto = "fat", codegen-units = 1 — the same settings as this PR's ship.)

Result, warmed binaries, wall clock per run:

profile census through translate
release (lto off, cgu 16) 281 ms
perf (fat LTO, cgu 1) 256 ms

−8.9 % on the translate path. Consistent with what whole-program codegen does to a tree of small cross-crate helpers (half_src, as_int, narrow16, unary, k() in a 12k-line lower.rs) and with it doing nothing for the per-frame path, which is D3D12 COM calls plus FFI — so do not bill this as a frame-time change.

For completeness on guard_runs, which is what the PR description cites: it moved 17.437 -> 20.339 us unmasked, 12.010 -> 11.279 us short runs, 27.946 -> 25.257 us long runs — i.e. one case worse, two slightly better, on the stage the profile matters least. I would not quote it either way; if you want a bench that reaches emit, the census fixture is the ready-made one.

Correctness under the profile: cargo test --profile perf -p victory-shader --lib --locked is 300 passed / 2 failed / 3 ignored on this card — the two being the known B580 baseline failures pristine main also fails (emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products). No test changes behaviour under fat LTO.

No game data used; synthetic tests only. Happy to run the same measurement on the ship profile itself if you want the number attributed to your name for the profile.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7192622179 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7192622179). Originally posted by [borosf](https://github.com/borosf) on 2026-11-26T12:54:43Z. --- Measured this on an Intel Arc B580 (Windows 11), release vs the same `[profile]` this PR adds — reporting it here rather than opening a competing profile PR, since `NEW-134`/this PR own it. **Method.** `guard_runs` is the only bench in the tree, and it times `structure::structure` (plus `ir::build`) — structurisation, not the code this profile actually helps (`emit/lower.rs`, `bitcode.rs::write`). So I measured the whole translate path instead, via the existing opcode census, which drives every opcode of every table through `decode -> ir -> structure -> resource -> lower -> write`: ``` cargo test --release -p victory-shader --lib --locked -- --exact emit::census_tests::every_opcode_translate_or_refuse_never_panic cargo test --profile perf -p victory-shader --lib --locked -- --exact emit::census_tests::every_opcode_translate_or_refuse_never_panic ``` (`perf` here = `inherits = "release"`, `lto = "fat"`, `codegen-units = 1` — the same settings as this PR's `ship`.) **Result, warmed binaries, wall clock per run:** | profile | census through translate | |---|---| | `release` (lto off, cgu 16) | 281 ms | | `perf` (fat LTO, cgu 1) | 256 ms | **−8.9 % on the translate path.** Consistent with what whole-program codegen does to a tree of small cross-crate helpers (`half_src`, `as_int`, `narrow16`, `unary`, `k()` in a 12k-line `lower.rs`) and with it doing nothing for the per-frame path, which is D3D12 COM calls plus FFI — so do not bill this as a frame-time change. For completeness on `guard_runs`, which is what the PR description cites: it moved `17.437 -> 20.339 us` unmasked, `12.010 -> 11.279 us` short runs, `27.946 -> 25.257 us` long runs — i.e. one case worse, two slightly better, on the stage the profile matters least. I would not quote it either way; if you want a bench that reaches `emit`, the census fixture is the ready-made one. **Correctness under the profile:** `cargo test --profile perf -p victory-shader --lib --locked` is 300 passed / 2 failed / 3 ignored on this card — the two being the known B580 baseline failures pristine main also fails (`emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, `emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products`). No test changes behaviour under fat LTO. No game data used; synthetic tests only. Happy to run the same measurement on the `ship` profile itself if you want the number attributed to your name for the profile.
Halfect commented 2026-11-26 13:04:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-26T13:03:00Z.


Thanks @borosf for measuring the path the profile actually helps. The census fixture driving every opcode through decode -> ir -> structure -> resource -> lower -> write is the right instrument here — it reaches the cross-crate helper trees in lower.rs/bitcode.rs that fat LTO + one codegen unit can inline, unlike guard_runs, which times structurisation alone. −8.9 % on that path (281 → 256 ms) with zero test-behaviour changes under the profile is exactly the shape the PR predicts, and it complements @DrDarkDK's and @futurepro62's build-time/size numbers: cheaper first-use shader translation, smaller binary, nothing claimed for the per-frame path.

On the offer: yes, a run on the literal --profile ship would be welcome — same census command with --profile ship instead of perf attributes the number to the profile as merged and removes any doubt that the local perf definition drifted from it. Nothing further from my side; the profile decision rests with the maintainer.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7192804928 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7192804928). Originally posted by [Halfect](https://github.com/Halfect) on 2026-11-26T13:03:00Z. --- Thanks @borosf for measuring the path the profile actually helps. The census fixture driving every opcode through `decode -> ir -> structure -> resource -> lower -> write` is the right instrument here — it reaches the cross-crate helper trees in `lower.rs`/`bitcode.rs` that fat LTO + one codegen unit can inline, unlike `guard_runs`, which times structurisation alone. −8.9 % on that path (281 → 256 ms) with zero test-behaviour changes under the profile is exactly the shape the PR predicts, and it complements @DrDarkDK's and @futurepro62's build-time/size numbers: cheaper first-use shader translation, smaller binary, nothing claimed for the per-frame path. On the offer: yes, a run on the literal `--profile ship` would be welcome — same census command with `--profile ship` instead of `perf` attributes the number to the profile as merged and removes any doubt that the local `perf` definition drifted from it. Nothing further from my side; the profile decision rests with the maintainer.
borosf commented 2026-11-26 14:01:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by borosf on 2026-11-26T13:44:53Z.


Correcting my own measurement above (thank you for the push to run the literal ship profile — it changed the answer).

What was wrong with my −8.9 %. I timed cargo test … -- --exact emit::census_tests::every_opcode_translate_or_refuse_never_panic with date +%s%N around it. That clock includes cargo's own start-up and process creation, which on this box is ~247 ms of the ~280 ms — the census itself is ~30 ms of work (finished in 0.03s in its own output, 1,232 opcodes: 546 translated, 686 refused, 0 panicked). So a "281 ms vs 256 ms" difference lives entirely inside overhead I was not measuring deliberately, and I should not have called it −8.9 %.

The profile, quoted from the PR, is exactly what was described: [profile.ship] = inherits = "release", lto = "fat", codegen-units = 1 — nothing else (no target-cpu, panic, debug or strip), so it inherits debug = "line-tables-only" and panic = "unwind".

Measured with launch cost removed (direct binary invocation, 40 iterations per pass, 3 passes, with a null-filter run per binary to price pure launch — 30.2 ms on both, identical):

profile test work per run passes
release (lto off, cgu 16) 30.2 ms 1206 / 1171 / 1203 ms per 40
ship (fat LTO, cgu 1) 29.2 ms 1168 / 1174 / 1164 ms per 40

≈3 % on the translate path, and one of the three passes showed +0.3 % — inside run-to-run variance. For completeness, the plain cargo test wall clock gave release 277 ms (275/277/283) vs ship 291 ms (270/291/306): overlapping ranges, i.e. noise. So on this machine: no reproducible runtime win for the profile, and the earlier −8.9 % should be disregarded.

What the profile does cost, measured: cargo test --profile X … --no-run for this one crate's lib + test binary — release 34.1 s, ship 119.4 s. A 3.5× build-time multiplier, so the PR's "compiles several times slower" holds; the full victory graph will be worse.

Correctness under the profile is fine: the census passes under ship (1 passed; 0 failed), 1,232 opcodes through decode → ir → structure → resource → io → emit, no panics — so nothing about fat LTO changes behaviour here.

One thing to know about the base: emit::census_tests::every_opcode_translate_or_refuse_never_panic does not exist at this PR's base (67e8ae1) — it landed on main after the branch point, and main is 78 commits ahead. I measured on main with this PR's commit cherry-picked on top (Cargo.toml is byte-identical between the PR base and main, so the profile under test is the PR's), and a rebase would make the census available at the PR's own head.

My read: the honest case for this PR is not a runtime percentage — it is a cheaper-to-ship binary if the build-time cost is acceptable, and that trade is the maintainer's. I would drop any measured-win claim from the description rather than defend 3 % inside noise. Happy to re-run on any other workload you name; this was CPU-only shader translation, so the Arc B580 was never exercised and the result is not GPU- or driver-sensitive.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7193780411 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7193780411). Originally posted by [borosf](https://github.com/borosf) on 2026-11-26T13:44:53Z. --- Correcting my own measurement above (thank you for the push to run the literal `ship` profile — it changed the answer). **What was wrong with my −8.9 %.** I timed `cargo test … -- --exact emit::census_tests::every_opcode_translate_or_refuse_never_panic` with `date +%s%N` around it. That clock includes cargo's own start-up and process creation, which on this box is **~247 ms of the ~280 ms** — the census itself is ~30 ms of work (`finished in 0.03s` in its own output, 1,232 opcodes: 546 translated, 686 refused, 0 panicked). So a "281 ms vs 256 ms" difference lives entirely inside overhead I was not measuring deliberately, and I should not have called it −8.9 %. **The profile, quoted from the PR, is exactly what was described:** `[profile.ship]` = `inherits = "release"`, `lto = "fat"`, `codegen-units = 1` — nothing else (no `target-cpu`, `panic`, `debug` or `strip`), so it inherits `debug = "line-tables-only"` and `panic = "unwind"`. **Measured with launch cost removed** (direct binary invocation, 40 iterations per pass, 3 passes, with a null-filter run per binary to price pure launch — 30.2 ms on both, identical): | profile | test work per run | passes | |---|---|---| | release (lto off, cgu 16) | **30.2 ms** | 1206 / 1171 / 1203 ms per 40 | | ship (fat LTO, cgu 1) | **29.2 ms** | 1168 / 1174 / 1164 ms per 40 | **≈3 % on the translate path, and one of the three passes showed +0.3 %** — inside run-to-run variance. For completeness, the plain `cargo test` wall clock gave release 277 ms (275/277/283) vs ship 291 ms (270/291/306): overlapping ranges, i.e. noise. So on this machine: **no reproducible runtime win for the profile**, and the earlier −8.9 % should be disregarded. **What the profile does cost, measured:** `cargo test --profile X … --no-run` for this one crate's lib + test binary — release **34.1 s**, ship **119.4 s**. A **3.5× build-time multiplier**, so the PR's "compiles several times slower" holds; the full `victory` graph will be worse. **Correctness under the profile is fine:** the census passes under `ship` (`1 passed; 0 failed`), 1,232 opcodes through decode → ir → structure → resource → io → emit, no panics — so nothing about fat LTO changes behaviour here. **One thing to know about the base:** `emit::census_tests::every_opcode_translate_or_refuse_never_panic` does not exist at this PR's base (`67e8ae1`) — it landed on `main` after the branch point, and `main` is 78 commits ahead. I measured on `main` with this PR's commit cherry-picked on top (`Cargo.toml` is byte-identical between the PR base and `main`, so the profile under test is the PR's), and a rebase would make the census available at the PR's own head. My read: the honest case for this PR is not a runtime percentage — it is a cheaper-to-ship binary if the build-time cost is acceptable, and that trade is the maintainer's. I would drop any measured-win claim from the description rather than defend 3 % inside noise. Happy to re-run on any other workload you name; this was CPU-only shader translation, so the Arc B580 was never exercised and the result is not GPU- or driver-sensitive.
Halfect commented 2026-11-27 05:05:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-27T05:05:51Z.


Thanks @borosf for the careful correction — pricing out the launch cost was the right call, and ≈3% inside variance (with one pass slower) means there is no runtime claim to defend. The description now says exactly that: the 5-10% figure is marked as the other ports' result from #2384, your retracted −8.9% is noted as launch overhead, and a "Measured on VIctory" section carries the numbers this thread actually established — no reproducible runtime win on the translate path, ≈7% smaller victory.exe, ≈2.7-3.5× build time, and the full suite green under the profile. The case as presented is now the binary-size/optimisation trade alone, which is the maintainer's call.

On the rebase: agreed the census fixture only exists on main; the branch still merges cleanly (Cargo.toml is unchanged between the base and main), so I'll rebase when the maintainer takes it up or when a head-based measurement is actually needed. Nothing further from my side.

AI-assisted (Kimi).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7210345489 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7210345489). Originally posted by [Halfect](https://github.com/Halfect) on 2026-11-27T05:05:51Z. --- Thanks @borosf for the careful correction — pricing out the launch cost was the right call, and ≈3% inside variance (with one pass slower) means there is no runtime claim to defend. The description now says exactly that: the 5-10% figure is marked as the other ports' result from #2384, your retracted −8.9% is noted as launch overhead, and a "Measured on VIctory" section carries the numbers this thread actually established — no reproducible runtime win on the translate path, ≈7% smaller `victory.exe`, ≈2.7-3.5× build time, and the full suite green under the profile. The case as presented is now the binary-size/optimisation trade alone, which is the maintainer's call. On the rebase: agreed the census fixture only exists on `main`; the branch still merges cleanly (`Cargo.toml` is unchanged between the base and `main`), so I'll rebase when the maintainer takes it up or when a head-based measurement is actually needed. Nothing further from my side. AI-assisted (Kimi).
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/2426:upstream-pr/2426'
git switch 'upstream-pr/2426'

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