-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add rust.lto=off
to bootstrap and set as compiler/library default
#107241
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
b582992
to
d6549fc
Compare
@@ -722,6 +722,9 @@ impl Step for Rustc { | |||
cargo.rustflag("-Cembed-bitcode=yes"); | |||
} | |||
RustcLto::ThinLocal => { /* Do nothing, this is the default */ } | |||
RustcLto::Off => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FYI, this doesn't disable LTO for the compiler built in stage0. I think this would need to go outside the check for the compiler stage.
To elaborate: The reason -Clto
doesn't run in stage 0 is per the comment above about LTO not working in stage 0, but the "off" setting is specifically turning it off, so it doesn't have the same restriction.
d6549fc
to
54b6917
Compare
Can you confirm by local benchmarks that rebuilds are faster with this option set to |
For |
Looks great! Hopefully the compiler won't be unusably slow without any LTO. |
|
How much slower is the resulting compiler built without LTO, e.g. on one of the longer check build benchmarks from rustc-perf (like cargo, diesel, keccak) ? |
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than Eric's comment, this looks great!
54b6917
to
2adf26f
Compare
rust.lto=off
to bootstraprust.lto=off
to bootstrap and set as compiler/library default
Let's also notify people if the default for these profiles is changed: a 30% difference is significant enough to be surprising/confusing, especially when a PR will need interacting with the perfbot, its results are likely to be quite different from local runs. |
Indeed, and probably we should also add it to the rustc-dev-guide, e.g. here: https://rustc-dev-guide.rust-lang.org/profiling.html. |
What do you mean by "notify people"? In the past, we've used blog posts and bumping |
Do you have a link to the perf run for that screenshot? I'm curious to know how much it improves bootstrap times for the compiler itself. |
I ran it locally, just a few crates, I didn't test bootstrap. We could run the whole perf. suite in this PR by changing this line to Actually, now that I think about it, we should be very careful with the Edit: I'm not sure if the defaults in the modified |
Nothing necessarily major, but like the announcements at the beginning of t-compiler meetings, a zulip message there, and/or one to the wg-compiler-performance zulip stream. Not a full MCP or Inside Rust blog post I don't think, just a heads up that this is coming. Using these profiles is the preferred way described in the dev guide IIRC, and the perf difference could therefore surprise many contributors ? |
@Kobzol no, CI intentionally doesn't use any of the customized defaults (I want to change it to use |
Ah, good to know :) Then it should be fine. |
r=me after a notification at next meeting, I'll nominate for putting it on the agenda. |
Did anyone look into how this affects EDIT: I don't mean to block this PR -- it's just something we might want to look out for after it has landed. |
$ hyperfine -L mode off,thin-local -s "x clean; x build library --config config.{mode}.toml" "x t tests/ui --force-rerun --config config.{mode}.toml"
Benchmark 1: x t tests/ui --force-rerun --config config.off.toml
Time (mean ± σ): 192.653 s ± 7.313 s [User: 926.090 s, System: 301.098 s]
Range (min … max): 186.157 s … 200.573 s 3 runs
Benchmark 2: x t tests/ui --force-rerun --config config.thin-local.toml
Time (mean ± σ): 190.043 s ± 4.840 s [User: 852.896 s, System: 298.910 s]
Range (min … max): 185.453 s … 195.100 s 3 runs
Summary
'x t tests/ui --force-rerun --config config.thin-local.toml' ran
1.01 ± 0.05 times faster than 'x t tests/ui --force-rerun --config config.off.toml' |
We discussed this at today's T-compiler triage meeting. We concluded by saying we'd like to see this PR move forward, and we'll just need to keep an eye on whether there's negative fallout from the change in defaults. But overall, we expect that a decent proportion of the developers will benefit from this change. @rustbot label: -I-compiler-nominated
oh, and after re-reading @lqd 's message above, I opted to also post a topic about this PR moving forward in the t-compiler/performance zulip stream. |
☀️ Test successful - checks-actions |
Finished benchmarking commit (f02439d): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. 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. |
Sync codegen defaults with compiler defaults and add a ping message so they stay in sync Looks like this got missed in rust-lang#107241.
Closes #107202
The issue mentions
embed-bitcode=on
, but hererust/src/bootstrap/compile.rs
Lines 379 to 381 in c8e6a9e
it appears that this is always set for std stage 1+, so I'm unsure if changes are needed here.
@rustbot label +A-bootstrap