rebuild LLVM when bootstrap.toml config changes#157836
Conversation
|
This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp. This PR modifies If appropriate, please update |
|
|
There was a problem hiding this comment.
I tried to add a target to llvm.targets (on main), and it did trigger a rebuild 😆 But it was only because I stopped the following Rust compilation in the middle, once I let it finish, it indeed does not rebuild.
While this cache busting is not perfect (e.g. it won't detect changing the host CC/CXX toolchain), it sounds very reasonabe to me.
One slightly annoying thing is that if you go from config A to config B and back, LLVM is still re-linked and rustc is rebuilt from rustc_llvm, because we only keep the latest hash. Before, you could modify the config arbitrarily and had a manual way to break the cache.
I'm also not sure why is it happening, but sometimes if I change the config, and then execute ./x build compiler, it will also relink LLVM on the second execution, rather than just on the first (without changing anything in the meantime). Does that also happen to you? It was kinda hard to reproduce for me though, maybe I did something wrong.
CC @nikic Would you be okay with bootstrap rebuilding LLVM when it detects a LLVM-relevant bootstrap config change?
Sounds fine to me |
89fb475 to
0fb4a0c
Compare
This comment has been minimized.
This comment has been minimized.
0fb4a0c to
48e7c28
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Thank you, let's try! @bors r+ |
…ap-change, r=Kobzol rebuild LLVM when `bootstrap.toml` config changes When using a local build of LLVM, previously changes in `bootstrap.toml` would not trigger an LLVM rebuild (e.g. when adding an additional target, or enabling `assertions`). Create a cache key based on the config, and incorporate it into the hash that is used to decide when to rebuild. r? Kobzol
…uwer Rollup of 9 pull requests Successful merges: - #156356 (bootstrap: add bootstrap step to run intrinsic-test in CI) - #157711 (Move proc-macro dlopen from proc-macro-srv to rustc_metadata) - #157836 (rebuild LLVM when `bootstrap.toml` config changes) - #158214 (Don't try to remove assignments in SimplifyComparisonIntegral) - #158226 (miri subtree update) - #158108 (Update actions/download-artifact action to v8.0.1) - #158150 (Update backtrace submodule to pick up AIX related fixes.) - #158178 (Use the target checking infrastructure for the diagnostic attributes) - #158195 (Add me to some rotation groups)
Rollup merge of #157836 - folkertdev:rebuild-llvm-on-bootstrap-change, r=Kobzol rebuild LLVM when `bootstrap.toml` config changes When using a local build of LLVM, previously changes in `bootstrap.toml` would not trigger an LLVM rebuild (e.g. when adding an additional target, or enabling `assertions`). Create a cache key based on the config, and incorporate it into the hash that is used to decide when to rebuild. r? Kobzol
…uwer Rollup of 9 pull requests Successful merges: - rust-lang/rust#156356 (bootstrap: add bootstrap step to run intrinsic-test in CI) - rust-lang/rust#157711 (Move proc-macro dlopen from proc-macro-srv to rustc_metadata) - rust-lang/rust#157836 (rebuild LLVM when `bootstrap.toml` config changes) - rust-lang/rust#158214 (Don't try to remove assignments in SimplifyComparisonIntegral) - rust-lang/rust#158226 (miri subtree update) - rust-lang/rust#158108 (Update actions/download-artifact action to v8.0.1) - rust-lang/rust#158150 (Update backtrace submodule to pick up AIX related fixes.) - rust-lang/rust#158178 (Use the target checking infrastructure for the diagnostic attributes) - rust-lang/rust#158195 (Add me to some rotation groups)
…uwer Rollup of 9 pull requests Successful merges: - rust-lang/rust#156356 (bootstrap: add bootstrap step to run intrinsic-test in CI) - rust-lang/rust#157711 (Move proc-macro dlopen from proc-macro-srv to rustc_metadata) - rust-lang/rust#157836 (rebuild LLVM when `bootstrap.toml` config changes) - rust-lang/rust#158214 (Don't try to remove assignments in SimplifyComparisonIntegral) - rust-lang/rust#158226 (miri subtree update) - rust-lang/rust#158108 (Update actions/download-artifact action to v8.0.1) - rust-lang/rust#158150 (Update backtrace submodule to pick up AIX related fixes.) - rust-lang/rust#158178 (Use the target checking infrastructure for the diagnostic attributes) - rust-lang/rust#158195 (Add me to some rotation groups)
|
For #158228 @rust-timer build 26cf92e |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (26cf92e): comparison URL. Overall result: ❌✅ regressions and improvements - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 3.7%, secondary 4.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 4.4%, secondary 4.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (secondary -0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 480.522s -> 503.535s (4.79%) |
|
Hey, this PR seems to have caused pretty mysterious perf results in #158228:
This indicates that we probably do something suspicious with LLVM, maybe we unintentionaly rebuild it on CI with different config or something like that? I'll re-add the label for now. The bot removed it because it's not visible in instruction counts, but it's pretty clear on other metrics that something suspicious is going on. @rustbot label +perf-regression |
|
That any of the code here runs in CI is surprising to me. We don't actually build LLVM in CI right? Building |
|
Based on the results, I'd guess this broke BOLT optimizations.
Not sure what you mean by this, but we do build LLVM on all the dist builders, even if it did not change. |
|
Given that we don't really understand what's going on and the regression looks pretty broad, I think we should probably revert this for now? |
|
Ah, crap, yeah, this will break the assumptions made by opt-dist about LLVM not being rebuilt in the final step, I didn't realize that. Yeah, this should be reverted ASAP (I can't do it atm though, as I'm only on phone this week). |
|
I'll set up the revert, and we can think about how to work around that issue when you're back. |
…bootstrap-change, r=folkertdev Revert "rebuild LLVM when `bootstrap.toml` config changes" This reverts commit 48e7c28. Turns out that currently this change makes perf a lot worse, see rust-lang#157836 (comment). cc @panstromek @Kobzol r? @ghost
…bootstrap-change, r=folkertdev Revert "rebuild LLVM when `bootstrap.toml` config changes" This reverts commit 48e7c28. Turns out that currently this change makes perf a lot worse, see rust-lang#157836 (comment). cc @panstromek @Kobzol r? @ghost
…bootstrap-change, r=folkertdev Revert "rebuild LLVM when `bootstrap.toml` config changes" This reverts commit 48e7c28. Turns out that currently this change makes perf a lot worse, see rust-lang#157836 (comment). cc @panstromek @Kobzol r? @ghost
…bootstrap-change, r=folkertdev Revert "rebuild LLVM when `bootstrap.toml` config changes" This reverts commit 48e7c28. Turns out that currently this change makes perf a lot worse, see rust-lang#157836 (comment). cc @panstromek @Kobzol r? @ghost
…bootstrap-change, r=folkertdev Revert "rebuild LLVM when `bootstrap.toml` config changes" This reverts commit 48e7c28. Turns out that currently this change makes perf a lot worse, see rust-lang#157836 (comment). cc @panstromek @Kobzol r? @ghost
…bootstrap-change, r=folkertdev Revert "rebuild LLVM when `bootstrap.toml` config changes" This reverts commit 48e7c28. Turns out that currently this change makes perf a lot worse, see rust-lang#157836 (comment). cc @panstromek @Kobzol r? @ghost
View all comments
When using a local build of LLVM, previously changes in
bootstrap.tomlwould not trigger an LLVM rebuild (e.g. when adding an additional target, or enablingassertions). Create a cache key based on the config, and incorporate it into the hash that is used to decide when to rebuild.r? Kobzol