Remove the size of locals heuristic in MIR inlining by saethlin · Pull Request #...
source link: https://github.com/rust-lang/rust/pull/110705
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Remove the size of locals heuristic in MIR inlining #110705
Conversation
Contributor
This heuristic doesn't necessarily correlate to complexity of the MIR Body. In particular, a lot of straight-line code in MIR tends to never reuse a local, even though any optimizer would effectively reuse the storage or just put everything in registers. So it doesn't even necessarily make sense that this would be a stack size heuristic.
So... what happens if we just delete the heuristic? The benchmark suite improves significantly. Less heuristics better?
r? @cjgillot
added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
labels
added A-mir-opt Area: MIR optimizations A-mir-opt-inlining Area: MIR inlining
labels
Contributor
Author
This comment has been minimized.
added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label
Contributor
Try build successful - checks-actions |
This comment has been minimized.
Collaborator
Finished benchmarking commit (cbbf803): 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)Results CyclesResults |
added perf-regression Performance regressions
and removed S-waiting-on-perf Status: Waiting on a perf run to be completed.
labels
Collaborator
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
Member
Wow, those results look great to me. (I don't know why doc builds regressed on instructions -- maybe just that rlibs are bigger with more inlining? -- but overall they look ½-and-½ above and below for cycles, including the non-relevant ones, so my guess is that's fine since you didn't change anything about rustdoc directly.) Spitballing in case someone objects: another possibility would be to count only the size of |
Contributor
Thanks @saethlin! Besides instruction count, we have a regression on metadata and binary size for optimized builds. I think those are tolerable (+0.4% on binary size, +2% on crate metadata on average). The regression in bootstrap timings is a unfortunate, but not a reason not to land this PR. @scottmcm I'm not even convinced that the size of aggregates matters. Those aggregates would end up on the stack either way, through an inlined call or a regular call. Inlining gives the possibility to emit a copy, so that's good to take. @bors r+ |
added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
labels
Contributor
Test successful - checks-actions |
Contributor
Author
One of the biggest inlining changes due to this PR in the standard library is that So MIR opts aside, I'm going to see what I can do about that. I don't know how to validate my guess without implementing a fix for it, so this may not be very quick. |
Collaborator
Finished benchmarking commit (915aa06): comparison URL. Overall result: regressions and improvements - ACTION NEEDEDNext Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression 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)Results CyclesResults |
Contributor
Author
keccak + cranelift-codegen |
Contributor
Improvements outweigh regressions. @rustbot label: +perf-regression-triaged |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
No reviews
None yet
Successfully merging this pull request may close these issues.
None yet
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK