-
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
Introduce MIR summary to avoid loading large bodies without inlining them #89708
Conversation
if callee_summary.diverges { | ||
threshold = 0; | ||
} | ||
let threshold = threshold; |
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.
Nit: seems like we can remove this line 🙂
|
||
fn optimized_mir_summary<'tcx>(tcx: TyCtxt<'tcx>, did: DefId) -> Summary { | ||
let body = tcx.optimized_mir(did); | ||
let param_env = tcx.param_env_reveal_all_normalized(body.source.def_id()); |
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.
let param_env = tcx.param_env_reveal_all_normalized(body.source.def_id()); | |
let param_env = tcx.param_env_reveal_all_normalized(did); |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit a24590a517c6d5572a907a2e1a116c2e4cc02c13 with merge a1873ce951ce1a384c423d5b4ff6fae61d723370... |
☀️ Try build successful - checks-actions |
Queued a1873ce951ce1a384c423d5b4ff6fae61d723370 with parent 5dab47d, future comparison URL. |
Finished benchmarking commit (a1873ce951ce1a384c423d5b4ff6fae61d723370): comparison url. Summary: This change led to very large relevant regressions 😿 in compiler performance.
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 led 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 |
Marking as blocked on #82280 |
☔ The latest upstream changes (presumably #94129) made this pull request unmergeable. Please resolve the merge conflicts. |
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 3f4afce with merge 92b8e388fcdff0238f30b942398546107fc237fb... |
☀️ Try build successful - checks-actions |
Queued 92b8e388fcdff0238f30b942398546107fc237fb with parent c907b6f, future comparison URL. |
Finished benchmarking commit (92b8e388fcdff0238f30b942398546107fc237fb): 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 |
MIR inlining loads the bodies of all callees in order to assess whether to inline them. This implies useless decoding of large MIR bodies, which may incur a significant cost (#80536).
In order to avoid loading such large MIR, this PR introduces a MIR summary structure with pre-computed statistics. Those statistics are used as a fast-reject path for inlining.
r? @wesleywiser