-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Add a debug-info cost to MIR inlining #123011
Conversation
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
[EXPERIMENT] Add a debug-info cost to MIR inlining r? ghost
@scottmcm just curious, is there a particular problem with having 100 debuginfos and 1 statement? |
@workingjubilee Not exactly a problem per se, just that I think we shouldn't treat that as basically-free for inlining. Copying them all into every caller just because it's cheap at runtime still has impact on memory usage and rlib sizes and such. I expect this to actually change the inlining decision quite rarely -- the cost used given to them is extremely small. But since it's also really cheap to compute this cost, I'm guessing it's still worth it to have some limit on how much stuff we'd inline. |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (94c5411): comparison URL. Overall result: no relevant changes - no 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. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. 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 sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 670.98s -> 670.188s (-0.12%) |
21e0519
to
9bae087
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
[EXPERIMENT] Add a debug-info cost to MIR inlining Inspired by all the MIR I keep looking at that's inlined away like 7 different function calls so the body is 2 statements but 30 debug-infos. r? ghost
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (ea37c63): comparison URL. Overall result: no relevant changes - no 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. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. 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.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 670.209s -> 670.51s (0.04%) |
Well, those results look great, but the two big wins in wall time look like they're noise. I still think this is worth doing, since it's not regressing anything and should help the outliers. But let's see what a reviewer has to say... |
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
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.
This seems fine to me as MIR inlining cost (imperfectly) represents LLVM IR size which debuginfo certainly contributes to.
@bors r+ |
Add a debug-info cost to MIR inlining Inspired by all the MIR I keep looking at that's inlined away like 7 different function calls so the body is 2 statements but 30 debug-infos. r? ghost
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (a40a62a): 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: 671.741s -> 673.856s (0.31%) |
Ah, that makes more sense. Exactly the kind of messy non-obvious perf result I would have expected for an inlining change 😆 |
ce93553
to
e9d6d0f
Compare
This comment has been minimized.
This comment has been minimized.
e9d6d0f
to
989bee0
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Add a debug-info cost to MIR inlining Inspired by all the MIR I keep looking at that's inlined away like 7 different function calls so the body is 2 statements but 30 debug-infos. r? ghost
This comment has been minimized.
This comment has been minimized.
☀️ Try build successful - checks-actions |
1 similar comment
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
989bee0
to
963c6ef
Compare
The job Click to see the possible cause of the failure (guessed by this bot)
|
Finished benchmarking commit (628e4f4): 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: 670.407s -> 672.371s (0.29%) |
mir-inline: use the visitor to walk blocks Today it's manually DFS-traversing them; let's see if that's actually fruitful. Inspired by <rust-lang#123011 (comment)> & <https://discord.com/channels/273534239310479360/957720175619215380/1222325151731945503> r? ghost
Closing in favour of #123179 |
Inspired by all the MIR I keep looking at that's inlined away like 7 different function calls so the body is 2 statements but 30 debug-infos.
r? ghost