Skip to content

Only check inlining counter after recursing. #112240

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

Merged
merged 1 commit into from
Jun 4, 2023

Conversation

cjgillot
Copy link
Contributor

@cjgillot cjgillot commented Jun 3, 2023

This PR aims to reduce the strength of #105119 even more.

In the current implementation, we check the inline count before recursing. This means that we never actually reach inlining depth 3.

This PR checks the counter after recursion, to give a chance to inline at depth >= 3.

r? @scottmcm
cc @JakobDegen

@rustbot rustbot 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 3, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jun 3, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@cjgillot cjgillot changed the title Only check inlining counter after recusing. Only check inlining counter after recursing. Jun 3, 2023
@cjgillot
Copy link
Contributor Author

cjgillot commented Jun 3, 2023

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 3, 2023
@bors
Copy link
Collaborator

bors commented Jun 3, 2023

⌛ Trying commit 9e68344 with merge 8c6964db79fae5c0e4d65a28b8399e3f128b6909...

@bors
Copy link
Collaborator

bors commented Jun 3, 2023

☀️ Try build successful - checks-actions
Build commit: 8c6964db79fae5c0e4d65a28b8399e3f128b6909 (8c6964db79fae5c0e4d65a28b8399e3f128b6909)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (8c6964db79fae5c0e4d65a28b8399e3f128b6909): comparison URL.

Overall result: ✅ improvements - no 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.

@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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.4%, -0.3%] 2
Improvements ✅
(secondary)
-0.7% [-1.4%, -0.4%] 8
All ❌✅ (primary) -0.4% [-0.4%, -0.3%] 2

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.

mean range count
Regressions ❌
(primary)
1.9% [1.6%, 2.2%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.1% [-1.1%, -1.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.9% [-1.1%, 2.2%] 3

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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.0% [2.0%, 2.0%] 1
Improvements ✅
(primary)
-3.4% [-3.8%, -3.1%] 6
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -3.4% [-3.8%, -3.1%] 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.

mean range count
Regressions ❌
(primary)
0.1% [0.0%, 0.4%] 17
Regressions ❌
(secondary)
0.5% [0.5%, 0.5%] 1
Improvements ✅
(primary)
-0.1% [-0.2%, -0.0%] 7
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [-0.2%, 0.4%] 24

Bootstrap: 647.289s -> 646.164s (-0.17%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 3, 2023
@scottmcm
Copy link
Member

scottmcm commented Jun 3, 2023

Looks great! Simple code change, pure win on instructions, helps a known case, and has roughly neutral overall binary size impact (which is probably usually the case for inlining tweaks, and just needs to not be obviously worse on size).

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 3, 2023

📌 Commit 9e68344 has been approved by scottmcm

It is now in the queue for this repository.

@bors bors 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 3, 2023
@bors
Copy link
Collaborator

bors commented Jun 4, 2023

⌛ Testing commit 9e68344 with merge 9eee230...

@bors
Copy link
Collaborator

bors commented Jun 4, 2023

☀️ Test successful - checks-actions
Approved by: scottmcm
Pushing 9eee230 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 4, 2023
@bors bors merged commit 9eee230 into rust-lang:master Jun 4, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jun 4, 2023
@cjgillot cjgillot deleted the recurse-inline branch June 4, 2023 07:46
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9eee230): 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.2% [0.1%, 0.3%] 5
Improvements ✅
(primary)
-0.3% [-0.5%, -0.2%] 6
Improvements ✅
(secondary)
-0.5% [-1.0%, -0.3%] 11
All ❌✅ (primary) -0.3% [-0.5%, -0.2%] 6

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.8% [-4.0%, -0.7%] 8
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.8% [-4.0%, -0.7%] 8

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.

mean range count
Regressions ❌
(primary)
0.1% [0.0%, 0.4%] 20
Regressions ❌
(secondary)
0.5% [0.5%, 0.5%] 1
Improvements ✅
(primary)
-0.2% [-0.3%, -0.0%] 7
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [-0.3%, 0.4%] 27

Bootstrap: 647.947s -> 645.202s (-0.42%)

@rustbot rustbot added the perf-regression Performance regression. label Jun 4, 2023
@nnethercote
Copy link
Contributor

Wins outweigh losses.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant 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.

6 participants