Skip to content
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

Enable ScalarReplacementOfAggregates in optimized builds #112002

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

saethlin
Copy link
Member

@saethlin saethlin commented May 26, 2023

Like MatchBranchSimplification, this pass is known to produce significant runtime improvements in Cranelift artifacts, and I believe based on the perf runs here that the primary effect of this pass is to empower MatchBranchSimplification. ScalarReplacementOfAggregates on its own has little effect on anything, but when this was rebased up to include #112001 we started seeing significant and majority-positive results.

Based on the fact that we see most of the regressions in debug builds (#112002 (comment)) and some rather significant ones in cycles and wall time, I'm only enabling this in optimized builds at the moment.

@saethlin saethlin added A-mir-opt Area: MIR optimizations S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. labels May 26, 2023
@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 May 26, 2023
@saethlin
Copy link
Member Author

@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 May 26, 2023
@saethlin saethlin removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-perf Status: Waiting on a perf run to be completed. labels May 26, 2023
@bors
Copy link
Contributor

bors commented May 26, 2023

⌛ Trying commit 6686240fe60ad46897bbf640ce4bb3767fc312c5 with merge 0ccd19e3bde2dd318205201e542de3df74481878...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented May 26, 2023

☀️ Try build successful - checks-actions
Build commit: 0ccd19e3bde2dd318205201e542de3df74481878 (0ccd19e3bde2dd318205201e542de3df74481878)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (0ccd19e3bde2dd318205201e542de3df74481878): 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.

mean range count
Regressions ❌
(primary)
1.0% [0.3%, 6.0%] 180
Regressions ❌
(secondary)
2.2% [0.4%, 22.4%] 147
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.9% [-3.0%, -0.8%] 2
All ❌✅ (primary) 1.0% [0.3%, 6.0%] 180

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)
5.2% [2.0%, 8.9%] 9
Regressions ❌
(secondary)
3.3% [2.3%, 4.5%] 3
Improvements ✅
(primary)
-3.3% [-5.8%, -0.3%] 4
Improvements ✅
(secondary)
-2.2% [-3.3%, -1.0%] 4
All ❌✅ (primary) 2.6% [-5.8%, 8.9%] 13

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)
2.2% [0.7%, 5.9%] 10
Regressions ❌
(secondary)
5.9% [1.7%, 18.4%] 28
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.1% [-3.1%, -3.1%] 1
All ❌✅ (primary) 2.2% [0.7%, 5.9%] 10

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.7% [0.1%, 2.0%] 40
Regressions ❌
(secondary)
0.8% [0.2%, 1.4%] 4
Improvements ✅
(primary)
-0.2% [-1.2%, -0.0%] 68
Improvements ✅
(secondary)
-0.6% [-1.4%, -0.0%] 27
All ❌✅ (primary) 0.1% [-1.2%, 2.0%] 108

Bootstrap: 643.928s -> 644.654s (0.11%)

@rustbot rustbot added the perf-regression Performance regression. label May 27, 2023
@saethlin saethlin force-pushed the enable-sroa branch 2 times, most recently from c35be22 to da642db Compare May 27, 2023 15:37
@rust-log-analyzer

This comment has been minimized.

@saethlin
Copy link
Member Author

@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 May 27, 2023
@bors
Copy link
Contributor

bors commented May 27, 2023

⌛ Trying commit da642db04142b4d8221ab3fc73afc0eaf2b79e72 with merge 361f7189aba95b845a1670225ede75d76b468f0c...

@bors
Copy link
Contributor

bors commented May 27, 2023

☀️ Try build successful - checks-actions
Build commit: 361f7189aba95b845a1670225ede75d76b468f0c (361f7189aba95b845a1670225ede75d76b468f0c)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (361f7189aba95b845a1670225ede75d76b468f0c): 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.

mean range count
Regressions ❌
(primary)
0.4% [0.2%, 2.7%] 25
Regressions ❌
(secondary)
0.6% [0.3%, 2.5%] 26
Improvements ✅
(primary)
-0.3% [-1.2%, -0.2%] 17
Improvements ✅
(secondary)
-0.3% [-0.4%, -0.2%] 6
All ❌✅ (primary) 0.1% [-1.2%, 2.7%] 42

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)
4.7% [2.4%, 8.7%] 6
Regressions ❌
(secondary)
2.2% [1.7%, 2.6%] 2
Improvements ✅
(primary)
-2.5% [-3.0%, -2.0%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.9% [-3.0%, 8.7%] 8

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)
1.6% [0.9%, 2.2%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.4% [-1.4%, -1.4%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.6% [-1.4%, 2.2%] 3

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.8%] 41
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.8%, -0.0%] 15
Improvements ✅
(secondary)
-0.0% [-0.0%, -0.0%] 4
All ❌✅ (primary) 0.0% [-0.8%, 0.8%] 56

Bootstrap: 645.972s -> 648.299s (0.36%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 27, 2023
@saethlin
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented May 31, 2023

📌 Commit ebd6649565c62843cbfaec676864c43faf92c203 has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label May 31, 2023
@bors
Copy link
Contributor

bors commented May 31, 2023

⌛ Testing commit ebd6649565c62843cbfaec676864c43faf92c203 with merge 0c4b9b71bef0e724967937bd92abb14240c877dd...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented May 31, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 31, 2023
@saethlin
Copy link
Member Author

A codegen test was broken, I guess I just totally forgot to run all the tests locally. I "fixed" the test by disabling the pass in its // compile-flags 🤷

StorageLive(_4); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29
_4 = (move _3,); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful to see the closure noise disappearing in MIR 🚀

@scottmcm
Copy link
Member

scottmcm commented Jun 1, 2023

That test update looks fine
@bors r=oli-obk,scottmcm

@bors
Copy link
Contributor

bors commented Jun 1, 2023

📌 Commit 79ba7b3 has been approved by oli-obk,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 1, 2023
@bors
Copy link
Contributor

bors commented Jun 1, 2023

⌛ Testing commit 79ba7b3 with merge 642c92e...

@bors
Copy link
Contributor

bors commented Jun 1, 2023

☀️ Test successful - checks-actions
Approved by: oli-obk,scottmcm
Pushing 642c92e to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 1, 2023
@bors bors merged commit 642c92e into rust-lang:master Jun 1, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jun 1, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (642c92e): 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.4% [0.2%, 0.9%] 6
Regressions ❌
(secondary)
0.8% [0.3%, 2.3%] 15
Improvements ✅
(primary)
-0.3% [-0.9%, -0.2%] 13
Improvements ✅
(secondary)
-1.2% [-2.9%, -0.3%] 3
All ❌✅ (primary) -0.1% [-0.9%, 0.9%] 19

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)
2.6% [1.6%, 3.8%] 4
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.7% [-4.7%, -0.1%] 6
Improvements ✅
(secondary)
-3.1% [-4.7%, -2.4%] 8
All ❌✅ (primary) 0.0% [-4.7%, 3.8%] 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.8% [-3.8%, -3.8%] 1
All ❌✅ (primary) - - 0

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.3% [0.0%, 1.4%] 19
Regressions ❌
(secondary)
0.8% [0.2%, 1.3%] 2
Improvements ✅
(primary)
-0.2% [-2.1%, -0.0%] 61
Improvements ✅
(secondary)
-0.8% [-1.5%, -0.1%] 16
All ❌✅ (primary) -0.1% [-2.1%, 1.4%] 80

Bootstrap: 643.626s -> 644.65s (0.16%)

@nnethercote
Copy link
Contributor

Time-related metrics (instrustions, cycles, walltime) are kind of a wash. Binary size is slightly improved, on average. This seems fine.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Jun 2, 2023
RalfJung pushed a commit to RalfJung/miri that referenced this pull request Jun 2, 2023
Enable ScalarReplacementOfAggregates in optimized builds

Like MatchBranchSimplification, this pass is known to produce significant runtime improvements in Cranelift artifacts, and I believe based on the perf runs here that the primary effect of this pass is to empower MatchBranchSimplification. ScalarReplacementOfAggregates on its own has little effect on anything, but when this was rebased up to include rust-lang/rust#112001 we started seeing significant and majority-positive results.

Based on the fact that we see most of the regressions in debug builds (rust-lang/rust#112002 (comment)) and some rather significant ones in cycles and wall time, I'm only enabling this in optimized builds at the moment.
@saethlin saethlin deleted the enable-sroa branch June 14, 2023 21:33
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 20, 2024
Enable ScalarReplacementOfAggregates in optimized builds

Like MatchBranchSimplification, this pass is known to produce significant runtime improvements in Cranelift artifacts, and I believe based on the perf runs here that the primary effect of this pass is to empower MatchBranchSimplification. ScalarReplacementOfAggregates on its own has little effect on anything, but when this was rebased up to include rust-lang/rust#112001 we started seeing significant and majority-positive results.

Based on the fact that we see most of the regressions in debug builds (rust-lang/rust#112002 (comment)) and some rather significant ones in cycles and wall time, I'm only enabling this in optimized builds at the moment.
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 27, 2024
Enable ScalarReplacementOfAggregates in optimized builds

Like MatchBranchSimplification, this pass is known to produce significant runtime improvements in Cranelift artifacts, and I believe based on the perf runs here that the primary effect of this pass is to empower MatchBranchSimplification. ScalarReplacementOfAggregates on its own has little effect on anything, but when this was rebased up to include rust-lang/rust#112001 we started seeing significant and majority-positive results.

Based on the fact that we see most of the regressions in debug builds (rust-lang/rust#112002 (comment)) and some rather significant ones in cycles and wall time, I'm only enabling this in optimized builds at the moment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir-opt Area: MIR optimizations 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.

10 participants