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 1/2] 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 From 36c4fbd520d9c1c0bbf9671b2d94e443f5772d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Szczepa=C5=84ski?= Date: Tue, 24 Nov 2026 21:02:54 +0100 Subject: [PATCH 2/2] changelog: state the warm DBT cost of fat LTO (#116) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review re-measurement on Apple M5 showed warm DBT about 2% slower under fat LTO with one codegen unit in four of four alternating runs. The entry said it was unchanged. Signed-off-by: Bartosz Szczepański --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33464c7..70ace17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +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. +- 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), while warm DBT (cache hits) became about 2 % slower (21.83-22.08 to 22.29-22.54 µs over four further runs). 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. - The ARM64 assembler loads 64-bit constants with the fewest MOVZ or MOVN plus MOVK instructions (#92). It no longer emits MOVK for zero halfwords and starts from MOVN when more halfwords are 0xFFFF than zero, so small negative values take one instruction instead of four. On Apple M5 the DBT benchmark emits 245,168 instead of 290,184 native bytes for its 626 blocks (-15.5%) and the 1,048 integer fixture instructions 128,724 instead of 145,732 (-11.7%); benchmark run times did not change measurably. New tests check the sequences against LLVM encodings and execute 1,056 of them on the host through the JIT. - Resolve the tiled BC1 mip and array layer once per linearization and copy contiguous block runs within each tile row. Partial edge blocks are retained and padding slots are skipped. Closes #349. - Relocation reports now build their type histogram once per image, avoiding a tree lookup for every entry. Target checks and fixup order are unchanged; synthetic regressions and an opt-in relocation timing test cover the change (#109).