Skip to content

Ignore the always part of #[inline(always)] in MIR inlining - #112294

Merged
bors merged 1 commit into
rust-lang:masterfrom
saethlin:inline-me-maybe
Jun 16, 2023
Merged

Ignore the always part of #[inline(always)] in MIR inlining#112294
bors merged 1 commit into
rust-lang:masterfrom
saethlin:inline-me-maybe

Conversation

@saethlin

@saethlinsaethlin commented Jun 5, 2023

Copy link
Copy Markdown
Member

#[inline(always)] is used in two cases: for functions that are so trivial it is always profitable to inline them, but also for functions which LLVM thinks are a bad inlining candidate, but which actually turn out to be profitable to inline. That second justification doesn't apply to the MIR inliner, so ignoring our cost estimation for these functions is not necessarily the right right thing to do.

This is basically a wash on non-check runs and a perf benefit in check runs. There are some notable regressions, and I think we might be able to claw those back by turning #[inline(always)] into a stronger hint. But I think this PR stands decently on its own as a tidy simplification.

@saethlinsaethlin added A-mir-opt Area: MIR optimizations A-mir-opt-inlining Area: MIR inlining S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. labels Jun 5, 2023
@rustbotrustbot 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 Jun 5, 2023
@saethlin

Copy link
Copy Markdown
MemberAuthor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbotrustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 5, 2023
@bors

bors commented Jun 5, 2023

Copy link
Copy Markdown
Collaborator

⌛ Trying commit 5d45d72cd8a4201dfe98ec28d676e2e569d47197 with merge 988256e3d645e9cda49a57c23c799a49d7513fc3...

@rust-log-analyzer

This comment has been minimized.

@bors

bors commented Jun 5, 2023

Copy link
Copy Markdown
Collaborator

☀️ Try build successful - checks-actions
Build commit: 988256e3d645e9cda49a57c23c799a49d7513fc3 (988256e3d645e9cda49a57c23c799a49d7513fc3)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (988256e3d645e9cda49a57c23c799a49d7513fc3): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

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 @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

meanrangecount
Regressions ❌
(primary)
1.1%[0.2%, 2.3%]9
Regressions ❌
(secondary)
1.0%[0.3%, 1.8%]4
Improvements ✅
(primary)
-0.4%[-2.1%, -0.2%]112
Improvements ✅
(secondary)
-0.4%[-0.8%, -0.2%]46
All ❌✅ (primary)-0.3%[-2.1%, 2.3%]121

Max RSS (memory usage)

Results

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.

meanrangecount
Regressions ❌
(primary)
4.6%[1.0%, 6.8%]4
Regressions ❌
(secondary)
2.1%[2.1%, 2.1%]1
Improvements ✅
(primary)
-5.0%[-9.6%, -2.1%]3
Improvements ✅
(secondary)
--0
All ❌✅ (primary)0.5%[-9.6%, 6.8%]7

Cycles

Results

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.

meanrangecount
Regressions ❌
(primary)
1.2%[0.7%, 2.0%]3
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-2.7%[-2.7%, -2.7%]1
Improvements ✅
(secondary)
--0
All ❌✅ (primary)0.2%[-2.7%, 2.0%]4

Binary size

Results

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.

meanrangecount
Regressions ❌
(primary)
0.2%[0.0%, 0.5%]9
Regressions ❌
(secondary)
0.0%[0.0%, 0.0%]4
Improvements ✅
(primary)
-0.5%[-11.1%, -0.0%]55
Improvements ✅
(secondary)
--0
All ❌✅ (primary)-0.4%[-11.1%, 0.5%]64

Bootstrap: 646.397s -> 653.496s (1.10%)

@rustbotrustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jun 5, 2023
@saethlinsaethlin removed the S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. label Jun 5, 2023
@saethlin

Copy link
Copy Markdown
MemberAuthor

r? mir-opt

@saethlin
saethlin marked this pull request as ready for review June 5, 2023 21:53
@rustbot

Copy link
Copy Markdown
Collaborator

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

The Miri subtree was changed

cc @rust-lang/miri

@rust-log-analyzer

This comment has been minimized.

@RalfJung

Copy link
Copy Markdown
Member

The justification for this change should be recorded in the code itself via a comment. Otherwise someone is bound to accidentally revert this eventually.

@bors

bors commented Jun 14, 2023

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #112418) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jun 15, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit b604e358063f8d392f05b87e506933597f662a59 has been approved by oli-obk

It is now in the queue for this repository.

@borsbors 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 Jun 15, 2023
@bors

bors commented Jun 16, 2023

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #112346) made this pull request unmergeable. Please resolve the merge conflicts.

@borsbors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 16, 2023
@saethlin

Copy link
Copy Markdown
MemberAuthor

@oli-obk I think in the rebase I tweaked some of the way I patched up some of the mir-opt tests. Wouldn't hurt for you to take a look and make sure you still agree with what I've done.

Comment threadtests/mir-opt/inline/inline_diverging.rs Outdated
@oli-obk

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jun 16, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit c153f3a has been approved by oli-obk

It is now in the queue for this repository.

@borsbors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 16, 2023
@bors

bors commented Jun 16, 2023

Copy link
Copy Markdown
Collaborator

⌛ Testing commit c153f3a with merge 6bba061...

@bors

bors commented Jun 16, 2023

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing 6bba061 to master...

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Jun 16, 2023
@bors
bors merged commit 6bba061 into rust-lang:masterJun 16, 2023
@rustbotrustbot added this to the 1.72.0 milestone Jun 16, 2023
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (6bba061): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

meanrangecount
Regressions ❌
(primary)
1.7%[1.2%, 2.5%]8
Regressions ❌
(secondary)
0.6%[0.2%, 1.4%]7
Improvements ✅
(primary)
-0.4%[-3.0%, -0.2%]61
Improvements ✅
(secondary)
-0.4%[-1.0%, -0.2%]18
All ❌✅ (primary)-0.1%[-3.0%, 2.5%]69

Max RSS (memory usage)

Results

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.

meanrangecount
Regressions ❌
(primary)
4.5%[2.7%, 6.2%]3
Regressions ❌
(secondary)
2.8%[2.8%, 2.8%]1
Improvements ✅
(primary)
-6.0%[-15.3%, -1.5%]7
Improvements ✅
(secondary)
-2.5%[-3.1%, -2.1%]3
All ❌✅ (primary)-2.9%[-15.3%, 6.2%]10

Cycles

Results

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.

meanrangecount
Regressions ❌
(primary)
1.6%[1.3%, 2.2%]4
Regressions ❌
(secondary)
2.7%[2.7%, 2.7%]1
Improvements ✅
(primary)
-2.7%[-3.1%, -2.3%]2
Improvements ✅
(secondary)
--0
All ❌✅ (primary)0.1%[-3.1%, 2.2%]6

Binary size

Results

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.

meanrangecount
Regressions ❌
(primary)
0.2%[0.0%, 0.4%]8
Regressions ❌
(secondary)
0.0%[0.0%, 0.0%]4
Improvements ✅
(primary)
-0.6%[-13.3%, -0.0%]59
Improvements ✅
(secondary)
-1.4%[-1.4%, -1.4%]1
All ❌✅ (primary)-0.5%[-13.3%, 0.4%]67

Bootstrap: 646.921s -> 655.492s (1.32%)

@saethlin
saethlin deleted the inline-me-maybe branch June 17, 2023 00:38
@rylev

Copy link
Copy Markdown
Member

Since the perf regressions are justified in the PR description, I'll mark this as triaged.

@rustbot label: +perf-regression-triaged

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-mir-optArea: MIR optimizationsA-mir-opt-inliningArea: MIR inliningmerged-by-borsThis PR was explicitly merged by bors.perf-regressionPerformance regression.perf-regression-triagedThe performance regression has been triaged.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@saethlin@rust-timer@bors@rust-log-analyzer@rustbot@RalfJung@oli-obk@rylev