-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Enable MIR inlining in incremental mode too. #99640
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
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
r? @oli-obk who reviewed the enable MIR inlining PR |
This comment has been minimized.
This comment has been minimized.
Note that it causes failures for people who do, because CI tests with incremental disabled. |
sess.opts.optimize == OptLevel::Default | ||
|| sess.opts.optimize == OptLevel::Aggressive |
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.
Could this match on optimize
? The names are kind of confusing, and seeing them ordered by strength could make me more comfortable.
Alternatively, >= Default
(assuming Default
is -O
aka -C opt-level=2
?) would be another way to indicate that it "starts" somewhere and increases with opt-level.
Could you add "Fixes #99619" to the issue description? For reference, it's this issue: |
Won't this slow down compilation for people who compile rustc with incremental enabled? Rustc is always compiled in release mode. |
There is a subtle ICE in |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit ffec672 with merge 5a39b2d33adc481de0478cd0c3a78889b2733498... |
☀️ Try build successful - checks-actions |
Queued 5a39b2d33adc481de0478cd0c3a78889b2733498 with parent 2f847b8, future comparison URL. |
Finished benchmarking commit (5a39b2d33adc481de0478cd0c3a78889b2733498): comparison url. Instruction count
Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking 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 Footnotes |
The perf impact has to be expected. Perf runs the compiler in incremental+optimizations mode, which is not a typical work case. The faster LLVM optimizations do not happen as often as in the non-incremental case, probably because we don't use the same amount of CGUs in the two cases. The cost centers are:
I conclude that the regression is entirely due to larger MIR. The only workaround would be to tweak MIR inlining threshold for size. |
The one thing I'd note about the perf report is that (if I'm reading things correctly) the size of compiled binaries seems to have increased. That seems concerning, because it means we're inlining a lot of things that LLVM is not, which we generally shouldn't be. Lowering the threshold is one path towards fixing this, but we should potentially be revisiting the algorithm for calculating the decision more generally |
The original issue has been fixed since the PR was opened, I think because we had a bootstrap bump so both stage 1 and stage 2 are now using MIR inlining. Does it still make sense to keep this PR open? |
Gating MIR inlining on non-incremental mode causes spurious codegen test failures for contributors that do not compile rustc in incremental mode.
This PR stops this behaviour, to rely only on optimization options. In general, release mode disables incremental, so this should not change much for end users.
Fixes #99619