-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Move BOLT from bootstrap
to opt-dist
#113592
Conversation
This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp. These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 09bc296902727636018054eadc15588c2f4d4826 with merge 055c6de761070321adc987bdf8e6fcd5ccff7fa9... |
I also want to see Mark's review on this. |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (055c6de761070321adc987bdf8e6fcd5ccff7fa9): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 657.52s -> 659.403s (0.29%) |
Rebased. |
☔ The latest upstream changes (presumably #114141) made this pull request unmergeable. Please resolve the merge conflicts. |
Rebased to incorporate #114141. |
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #114126) made this pull request unmergeable. Please resolve the merge conflicts. |
Gentle ping @Mark-Simulacrum, just to make sure that this isn't forgotten. |
@bors r+ rollup=never |
☀️ Test successful - checks-actions |
Finished benchmarking commit (3114eb1): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 652.068s -> 649.988s (-0.32%) |
Currently, we use BOLT to optimize LLVM for x64 Linux. The BOLT instrumentation and optimization step is implemented in
bootstrap
, but it was always quite hacky, because BOLT works quite differently than PGO. Rather than building an instrumented artifact, it takes an already built artifact and instruments it in-place. This is not a good fit for the bootstrap caching mechanism, and it meant that we had to run BOLT "on-the-fly" when packaging LLVM artifacts into the created sysroot.The BOLT code was also really only used by the PGO script (now called
opt-dist
) and nothing else, so it was quite hardcoded for this one single usage. And even if someone wanted to use the--llvm-bolt-profile-[use/generate]
bootstrap flags outside of the PGO script, they would also need to implement profile gathering, as this is not performed by bootstrap anyway.I think that it could be more practical to move the BOLT logic to the
opt-dist
tool instead. This simplifies bootstrap, removes unneeded implementation of BOLT caching (we will now do it exactly once - no need to check if it has been performed already when bootstrap copieslibLLVM.so
around multiple times) and removes two BOLT-specific bootstrap flags, and also one special case for building LLVM (instead I pass the linker flags with--set llvm.ldflags
fromopt-dist
now).There are also a few disadvantages to this new approach:
libLLVM.so
file (but currently this is quite easy, it's just instage2/lib
).opt-dist
(namely, thatlibLLVM.so
is hardlinked). But we do that for many other things in theopt-dist
tool anyway, it's tied quite closely to bootstrap.I would like to go back to my attempts to also use BOLT for
librustc_driver.so
, and I think that it might be a bit simpler if I also do it from theopt-dist
tool, so this is the first step towards that.Anyway, let me know what you think about this. It's just a refactoring in a way, no big deal.
r? bootstrap