-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Inline hot part of PatStack::head_ctor #81978
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
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 6a4fed86c78337ae6c5457f2467becbe0d97dcef with merge e775c2bd00d7e18512f927f472d53becf0876862... |
☀️ Try build successful - checks-actions |
Queued e775c2bd00d7e18512f927f472d53becf0876862 with parent 07194ff, future comparison URL. |
Finished benchmarking try commit (e775c2bd00d7e18512f927f472d53becf0876862): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
When building rustc with a single CGU, there is a +32% regression in instruction counts on match-stress-enum-check benchmark. This reduces the regression to +9%. Direct comparison between two 1 CGU builds https://perf.rust-lang.org/compare.html?start=9660b75856b1db922bcfccaba516abaa9d1169fb&end=e775c2bd00d7e18512f927f472d53becf0876862&stat=instructions%3Au BTW. 17% of instructions are in Lets verify impact on the current CGU configuration: @bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 9bf28cfba7b6c39241aec9e2742faeafdf001954 with merge 46cd44235c63130eddf04cbeccfc81bbdd292a97... |
☀️ Try build successful - checks-actions |
Queued 46cd44235c63130eddf04cbeccfc81bbdd292a97 with parent 1efd804, future comparison URL. |
Finished benchmarking try commit (46cd44235c63130eddf04cbeccfc81bbdd292a97): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
As described in #81978 (comment), this helps obtaining favourable inlining results when building codege-units=1. This is not important for the current build of rustc, but it might be worth landing to avoid having investigate the same issue in the future. r? @Mark-Simulacrum or @Nadrieril |
As far as the code is concerned, this is definitely a super-hot spot that seems sensible to inline. I don't understand why |
Could you put the explanation for why this is beneficial in the PR description? I'd also like to see comments in the code justifying the inline(never) in particular. It might be worth trying with cold, too, but I'm not sure if that's actually true? |
Updated commit message and PR description. I left inline hint only, which was sufficient to get desired results. The implementation of |
When building rustc with `-Codegen-units=1` this inline hint ensures that obtaining already initialized head constructor does not involve a function call overhead and reduces the instruction count in match-stress-enum-check full benchmark from 11.9G to 9.8G. It shouldn't have significant impact on the currently default configuration where it reflects existing inlining decisions.
@bors r+ |
📌 Commit a3659bb has been approved by |
⌛ Testing commit a3659bb with merge 5cda2c855d1b15d29cda9263de9105dffd331b91... |
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
@bors retry |
☀️ Test successful - checks-actions |
When building rustc with
-Codegen-units=1
this inline hint ensuresthat obtaining already initialized head constructor does not involve
a function call overhead and reduces the instruction count in
match-stress-enum-check full benchmark from 11.9G to 9.8G.
It shouldn't have significant impact on the currently default
configuration where it reflects existing inlining decisions.