Skip to content

feat: build release binaries with PGO - #1327

Merged
DaniPopes merged 4 commits into
mainfrom
centaur/pgo-releases-1787953222
Aug 30, 2026
Merged

DaniPopes merged 4 commits into
mainfrom
centaur/pgo-releases-1787953222

Conversation

@decofe

@decofe decofe commented Aug 28, 2026 •

Copy link
Copy Markdown
Member

Release binaries now use a custom native workflow based on uv's Linux x86-64 PGO release work. Five host-native targets collect an LLVM profile from the existing synthetic and Standard JSON corpora, then build and package the final binary with the same target flags. The cross-compiled musl target stays unprofiled. cargo-dist 0.32.0 still plans and hosts releases, consumes the checksummed local artifact manifest, and builds the installers, source archive, and wasm bundle. Release builds use Rust 1.98.0, and the GNU installers require glibc 2.34; CI rejects binaries that exceed that limit.

The Linux x86-64 PR job compares the PGO binary with an unprofiled build on a fixed, source-file-disjoint set of eight named projects. It warms both binaries, runs paired per-case ABBA measurements, checks canonical compiler output for every repeat, and gates aggregate speed, case regressions, drift, and binary growth.

The hosted PR run measured these compile-time reductions:

Case Wall time
solady-lib-string 🟢 15.95%
seaport-1.6-project 🟢 14.30%
v4-core-project 🟢 13.11%
morpho-blue-project 🟢 12.60%
forge-std-1.16.1-project 🟢 12.71%
prb-math-4.1.1-project 🟢 10.59%
solmate-6-project 🟢 14.01%
solarray-a547630-project 🟢 3.81%
Geometric mean 🟢 12.20%

A local Valgrind 3.25.1 Callgrind run at commit 50c0b1a87 measured retired guest instructions (Ir) for two ABBA legs per binary. This deterministic count is a stable proxy for CPU work, not a hardware cycle count. Canonical compiler output matched in every run, and maximum leg drift was 0.09%.

Case Callgrind instructions
solady-lib-string 🟢 6.88%
seaport-1.6-project 🟢 9.14%
v4-core-project 🟢 9.13%
morpho-blue-project 🟢 7.80%
forge-std-1.16.1-project 🟢 7.88%
prb-math-4.1.1-project 🟢 7.07%
solmate-6-project 🟢 7.66%
solarray-a547630-project 🟢 2.46%
Geometric mean 🟢 7.27%

The Linux x86-64 binary decreased from 13,731,504 bytes to 13,011,952 bytes, or 5.24%. These measurements apply only to Linux x86-64.

Prompted by: @DaniPopes

Train host-native release binaries with the existing synthetic and
Standard JSON benchmark corpora before cargo-dist packages them. Align
LLVM hot-code and size thresholds to avoid profile-driven code
expansion.

The held-out corpus is 10.2% faster by geometric mean with a 0.4%
baseline noise floor, and the Linux x86-64 binary is 4.5% smaller.

Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com>
Build each release archive in a native custom workflow so training and the final binary use the same target flags. Pass checksummed local manifests back to cargo-dist for installer and release generation.\n\nUse a source-file-disjoint evaluation corpus with paired ABBA runs, canonical output checks, and speed, regression, drift, and size gates.
@DaniPopes
DaniPopes marked this pull request as ready for review August 30, 2026 07:02
@DaniPopes
DaniPopes requested a review from onbjerg as a code owner August 30, 2026 07:02
Pin the Rust release toolchain and carry cargo-dist's glibc floor into\nthe custom native builds. Reject binaries that exceed that floor and use\nthe release plan's cargo-dist binary for manifest generation.\n\nRead build features and release limits from dist-workspace.toml to prevent\nconfig drift. Reduce benchmark noise with hybrid percent/time gates and\navoid repeated output canonicalization.

@mattsse mattsse left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@DaniPopes
DaniPopes merged commit 501779d into main Aug 30, 2026
43 of 46 checks passed
@DaniPopes
DaniPopes deleted the centaur/pgo-releases-1787953222 branch August 30, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants