From 3d19c756e2af3510d693610f81e79e1231910f74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Szczepa=C5=84ski?= Date: Tue, 24 Nov 2026 20:08:43 +0100 Subject: [PATCH] build: use fat LTO and one codegen unit for release builds (#116) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Release and bench builds used Cargo's defaults: no cross-crate LTO and 16 codegen units. Fat LTO with a single codegen unit lets the interpreter and DBT hot paths inline across crates. On Apple M5, dbt_bench medians over five alternating rounds of 101 samples drop from 903 to 845 us for the interpreter (-6%) and from 1.155 to 1.046 ms for cold DBT (-9%, faster in all five rounds); warm DBT is unchanged. The xenora binary shrinks from 2.73 to 2.11 MB. A clean release build of the workspace takes 14.0 s instead of 5.9 s. Debug and test builds keep the dev profile and are unaffected. Signed-off-by: Bartosz Szczepański --- CHANGELOG.md | 1 + Cargo.toml | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e686c9c..196a6aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Guest execution uses original, purpose-built test programs. Commercial Xbox game remains unsupported. ### Changed +- Release and bench builds now use fat link-time optimization with one codegen unit (#116). On a local Apple M5, `dbt_bench` medians over five alternating runs dropped by about 6 % for the interpreter (903 to 845 µs) and about 9 % for cold DBT (1.155 to 1.046 ms), with warm DBT unchanged. The `xenora` binary shrank from 2.73 to 2.11 MB. A clean release build of the workspace takes about 14 s instead of 6 s. Debug and test builds are unchanged. - Moved the six supported gfx1030 SOPP compute control forms into the semantic registry, preserving instruction decoding and shader lowering. Part of #215. - Moved gfx1030 `s_mov_b32` (SOP1) into the semantic registry, preserving its existing decode domain and shader output. The move operand rule retains explicit VCC and EXEC half destinations. Part of #215. - Moved the six hand-written gfx1030 VOP2 logical and shift forms (`v_and_b32`, `v_or_b32`, `v_xor_b32`, `v_lshlrev_b32`, `v_lshrrev_b32`, `v_ashrrev_i32`, AMD guide section 12.7) into the semantic registry under a new VGPR-only operand rule `vop2_vgpr2`, with no behaviour change: a sweep of 132,608 VOP2, VOP1 and SOP1 words decodes to the same text, length and error before and after, the MSL goldens are unchanged, and the runtime-region allowlist admits exactly the same six forms. The per-lane `VectorBinary` gained `And`, `Or`, `Xor` and the three shifts (count masked to S0[4:0]); 6 hand-written instruction variants and their decoder and lowering arms are gone (17 hand-written forms remain). Part of #215. diff --git a/Cargo.toml b/Cargo.toml index 47e4f04..5e5d156 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,3 +10,10 @@ rust-version = "1.100" [workspace.lints.rust] unsafe_op_in_unsafe_fn = "deny" + +# Whole-program optimization for release and bench builds (#116). On an Apple M5 the +# interpreter ran about 6 % and cold DBT about 9 % faster in `dbt_bench`, at the cost of +# slower release builds. Debug and test builds are unaffected. +[profile.release] +lto = "fat" +codegen-units = 1