-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Don't merge CGUs in incremental builds. #112441
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
Conversation
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 819bf71 with merge affbc221b471eba0070f640c6cecc8701bb9d5fd... |
The job Click to see the possible cause of the failure (guessed by this bot)
|
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (affbc221b471eba0070f640c6cecc8701bb9d5fd): comparison URL. Overall result: ❌✅ regressions and improvements - 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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never 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.
CyclesResultsThis 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.
Binary sizeResultsThis 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.
Bootstrap: 648.127s -> 649.584s (0.22%) |
The idea here is that the default number of CGUs for incremental builds is 256. This is a high number. Most benchmarks don't have that many CGUs. Only the biggest benchmarks do, which means they tend to do worse with The drastic results for incremental opt builds of The big swings for The -4.17% walltime for A good comparison is this result in #111666 where I reduced the number of CGUs in incremental builds from 256 to 64, and there were some drastic |
// Merge until we have at most `max_cgu_count` codegen units. | ||
// `merge_codegen_units` is responsible for updating the CGU size | ||
// estimates. | ||
{ | ||
if cx.tcx.sess.opts.incremental.is_none() { |
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.
Currently -Ccodegen-units
overrides the 256 default for incr comp. With this change that no longer happens. I think user's intent should be preserved even with incr comp. Maybe they care about runtime perf too and many codegen units is a huge regression (eg in a game) or maybe duplication of inlined functions costs more than not merging saves in reusable cgus. Either way the user should have the option to do what is best for them.
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.
Sure, as written I've done this too crudely. If this were to land various other changes would be needed, e.g. documentation. I have changed the PR to draft status to better reflect this.
To second @bjorn3's comment: I think we should keep having a way for controlling the max number of CGUs for incremental builds. Making incr. comp. respect I'm not against doing experiments in this area, of course. I just want to make sure this is taking into account. |
Respecting |
I'm not sure about unlimited1 but I have no objection to increasing the default to a much higher number. If I remember correctly, the current default was introduced in the same PR that made incr. comp. take Footnotes
|
Sounds like the simplest path forward would be to lift the limit from 256 CGUs to perhaps 512 or 1024. But now I'm not sure it's worth the effort. |
r? @ghost