Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust: Add PGO to rustc #2814

Merged
merged 1 commit into from
Jun 5, 2024
Merged

rust: Add PGO to rustc #2814

merged 1 commit into from
Jun 5, 2024

Conversation

ReillyBrogan
Copy link
Contributor

This increases the length of the build phase by about 7 minutes for me, but improves building Serpent boulder in development by 9%.

The profiling phase is just to use the rust bootstrapping to build a stage 1 instrumented rustc and then the stdlib/rustc/cargo/rustdoc as stage 2. thin-local LTO is used during the profiling stage as it is much faster than fat LTO and the different LTO types don't change how rustc generates code but how LLVM links it.

joebonrichie
joebonrichie previously approved these changes Jun 4, 2024
Copy link
Contributor

@joebonrichie joebonrichie left a comment

Choose a reason for hiding this comment

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

Got about a 13% speedup compiling starship.

Possibly worth exploring the opt-dist binary in the future. https://rustc-dev-guide.rust-lang.org/building/optimized-build.html#profile-guided-optimization as less manual fiddling is required and it supports bolt as well.

@GZGavinZhao
Copy link
Member

Aw shoot, sorry I wrote #2814 instead of #2824 in my commit message and accidentally closed this.

@GZGavinZhao GZGavinZhao reopened this Jun 5, 2024
@ReillyBrogan
Copy link
Contributor Author

Possibly worth exploring the opt-dist binary in the future. https://rustc-dev-guide.rust-lang.org/building/optimized-build.html#profile-guided-optimization as less manual fiddling is required and it supports bolt as well.

I did reference the source code for that. I'm not sure it fits very well into the build workflow.

Got about a 13% speedup compiling starship.

There's probably some additional speedup by using the full profiling/benchmarking build like opt-dist does, but I just went for low-hanging gains here.

Signed-off-by: Reilly Brogan <[email protected]>
@ReillyBrogan ReillyBrogan merged commit a1e8fb6 into main Jun 5, 2024
1 check passed
@ReillyBrogan ReillyBrogan deleted the rust-pgo branch June 5, 2024 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants