-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Avoid MIR bloat in inlining #127113
Avoid MIR bloat in inlining #127113
Conversation
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Avoid MIR bloat in inlining In rust-lang#126578 we ended up with more binary size increases than expected. This change attempts to avoid inlining large things into small things, to avoid that kind of increase, in cases when top-down inlining will still be able to do that inlining later. r? ghost
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (53ba00a): 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 (primary 1.6%, secondary -5.9%)This 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.
CyclesResults (primary -0.1%, secondary -0.1%)This 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 sizeResults (primary -0.1%, secondary -0.6%)This 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: 694.857s -> 695.619s (0.11%) |
ba09e7c
to
29e8c80
Compare
This comment has been minimized.
This comment has been minimized.
29e8c80
to
3f104b1
Compare
This comment has been minimized.
This comment has been minimized.
3f104b1
to
0d36257
Compare
This comment has been minimized.
This comment has been minimized.
0d36257
to
00c4b72
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Avoid MIR bloat in inlining In rust-lang#126578 we ended up with more binary size increases than expected. This change attempts to avoid inlining large things into small things, to avoid that kind of increase, in cases when top-down inlining will still be able to do that inlining later. r? ghost
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (4626152): 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 (primary 1.7%, secondary -6.2%)This 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.
CyclesResults (primary 0.2%, secondary -1.1%)This 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 sizeResults (primary -0.1%, secondary -0.6%)This 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: 695.844s -> 695.214s (-0.09%) |
Well, I was hoping for a bit more, but this is neutral-to-green on instructions and claws back some of the size losses from #126578 -- for example, image-opt-full was +0.95% in that and is -1.38% here. r? mir-opt |
@@ -1091,3 +1103,37 @@ fn try_instance_mir<'tcx>( | |||
} | |||
Ok(tcx.instance_mir(instance)) | |||
} | |||
|
|||
fn body_is_forwarder(body: &Body<'_>) -> bool { |
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.
may be useful to look into methods that only forward to other methods, but may trigger autoderef through Deref
impls or other things that can cause this method to return false
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.
Yeah, a bigger version of the problem here is that we just loop through the blocks in order, inlining stuff.
If I find time I want to try some bigger changes like a p-queue of Call
s so I could do things like apply the trivial things first, then apply a check like this to decide whether to continue.
…i-obk Avoid MIR bloat in inlining In rust-lang#126578 we ended up with more binary size increases than expected. This change attempts to avoid inlining large things into small things, to avoid that kind of increase, in cases when top-down inlining will still be able to do that inlining later. r? ghost
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
In 126578 we ended up with more binary size increases than expected. This change attempts to avoid inlining large things into small things, to avoid that kind of increase, in cases when top-down inlining will still be able to do that inlining later.
00c4b72
to
23c8ed1
Compare
@bors try |
Avoid MIR bloat in inlining try-job: test-various In rust-lang#126578 we ended up with more binary size increases than expected. This change attempts to avoid inlining large things into small things, to avoid that kind of increase, in cases when top-down inlining will still be able to do that inlining later. r? ghost
☀️ Try build successful - checks-actions |
Looks like this tweak made something a CGU test was looking for inline away, so I disabled MIR inlining in that test and the try build said that fixed it, so |
☀️ Test successful - checks-actions |
Finished benchmarking commit (221e274): 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 (primary -0.5%, secondary -6.4%)This 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.
CyclesResults (primary -0.8%, secondary -3.0%)This 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 sizeResults (primary -0.2%, secondary -0.6%)This 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: 697.337s -> 695.345s (-0.29%) |
Visiting for weekly rustc-perf triage
@rustbot label: +perf-regression-triaged |
In #126578 we ended up with more binary size increases than expected.
This change attempts to avoid inlining large things into small things, to avoid that kind of increase, in cases when top-down inlining will still be able to do that inlining later.
r? ghost