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

Open
github-bot wants to merge 1 commit from github-bot/gh-2426 into main AGit
Owner

@⁠Halfect on GitHub · 2026-11-25 13:15 UTC · original
Halfect:build/ship-lto-profile → main · +12 −0 · 2 files · 1 commits · open

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. Where that could help here: shader translation at first use (draws wait on it), translate --cache, page comparisons, detiling and BCPack. It does not speed up GPU work or the driver's pipeline compiles. As the issue notes, 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.

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 xtask policy: 182 files ok.
  • git diff --check: clean.
  • The full victory binary was not built under this profile locally (compile time); the profile is additive and changes nothing for the existing dev/release/diag builds.

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

**@⁠Halfect** on GitHub · 2026-11-25 13:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/2426) `Halfect:build/ship-lto-profile` → `main` · +12 −0 · 2 files · 1 commits · open ## 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. Where that could help here: shader translation at first use (draws wait on it), `translate --cache`, page comparisons, detiling and BCPack. It does not speed up GPU work or the driver's pipeline compiles. As the issue notes, 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. ## 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 xtask policy`: **182 files ok**. - `git diff --check`: clean. - The full `victory` binary was not built under this profile locally (compile time); the profile is additive and changes nothing for the existing `dev`/`release`/`diag` builds. No game data, no title executable. AI-assisted (Kimi).
The second half of #2384: [profile.ship] inherits release and turns on
fat link-time optimisation across the whole crate graph with a single
codegen unit, so the compiler can inline and specialise across crate
boundaries. The two game ports the issue compares measured 5-10% off
their CPU frame time from the same setting, with byte-identical outputs
(Rust does not contract or reassociate floating point unless asked).
It belongs in its own profile, not release: a fat-LTO build compiles
several times slower.

The issue's other build idea, target-cpu in .cargo/config.toml, is left
out: it would change every build on every host, including CI and
contributors' machines, so it is a maintainer's call rather than part of
this profile. The native 16-bit shader math idea is untouched; it is
being probed in the issue thread.

README documents the profile next to the release build it extends.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:05:27 +00:00
Author
Owner

@⁠DrDarkDK on GitHub · 2026-11-25 13:20 UTC · original

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.

**@⁠DrDarkDK** on GitHub · 2026-11-25 13:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7163640483) 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.*
Author
Owner

@⁠Halfect on GitHub · 2026-11-25 13:32 UTC · original

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.

**@⁠Halfect** on GitHub · 2026-11-25 13:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7163916710) 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.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:33 UTC · original · edited 2026-11-26 03:20 UTC

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

**@⁠Marvisak** on GitHub · 2026-11-25 15:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7167016076) · edited 2026-11-26 03:20 UTC <!-- 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)_
Author
Owner

@⁠Halfect on GitHub · 2026-11-25 16:13 UTC · original

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).

**@⁠Halfect** on GitHub · 2026-11-25 16:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7167698445) 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).
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 16:53 UTC · original

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.

**@⁠kotekompotek** on GitHub · 2026-11-25 16:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7168693748) 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.
Author
Owner

@⁠Halfect on GitHub · 2026-11-25 22:08 UTC · original

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.

**@⁠Halfect** on GitHub · 2026-11-25 22:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7175991763) 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.
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-26 01:51 UTC · original

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.
**@⁠futurepro62** on GitHub · 2026-11-26 01:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7180209608) 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.
Author
Owner

@⁠Halfect on GitHub · 2026-11-26 02:10 UTC · original

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.

**@⁠Halfect** on GitHub · 2026-11-26 02:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7180540138) 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.
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-26 02:21 UTC · original

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.
**@⁠futurepro62** on GitHub · 2026-11-26 02:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7180732720) Follow-up to [my report above](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2426), 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.
Author
Owner

@⁠Halfect on GitHub · 2026-11-26 02:33 UTC · original

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.

**@⁠Halfect** on GitHub · 2026-11-26 02:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7180913365) 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.
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 13:19 UTC · original · reviewed

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

**@⁠catminou4** on GitHub · 2026-11-25 13:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2426#pullrequestreview-6058347367) · **reviewed** Ship profile with fat LTO and one codegen unit. Trivial build config; note binaries grow and builds get much slower — documented. Fine.
Author
Owner

@⁠borosf on GitHub · 2026-11-26 12:54 UTC · original

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.

**@⁠borosf** on GitHub · 2026-11-26 12:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7192622179) 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.
Author
Owner

@⁠Halfect on GitHub · 2026-11-26 13:03 UTC · original

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.

**@⁠Halfect** on GitHub · 2026-11-26 13:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7192804928) 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.
Author
Owner

@⁠borosf on GitHub · 2026-11-26 13:44 UTC · original

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.

**@⁠borosf** on GitHub · 2026-11-26 13:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/2426#issuecomment-7193780411) 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.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2426/head:github-bot/gh-2426'
git switch 'github-bot/gh-2426'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2426'
git switch 'github-bot/gh-2426'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2426'
git switch 'github-bot/gh-2426'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2426'
git switch 'main'
git merge --squash 'github-bot/gh-2426'
git switch 'main'
git merge --ff-only 'github-bot/gh-2426'
git switch 'main'
git merge 'github-bot/gh-2426'
git push origin 'main'
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!2426
No description provided.