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

Convert Operand::Move to Operand::Copy #105190

Closed
wants to merge 1 commit into from

Conversation

saethlin
Copy link
Member

@saethlin saethlin commented Dec 2, 2022

Looks like this fires ~72,000 times on the standard library. Neat.

Note: The unleashed version fires ~165,000 times.

cc @JakobDegen

@rustbot
Copy link
Collaborator

rustbot commented Dec 2, 2022

r? @davidtwco

(rustbot has picked a reviewer for you, use r? to override)

@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 Dec 2, 2022
@rustbot
Copy link
Collaborator

rustbot commented Dec 2, 2022

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@saethlin
Copy link
Member Author

saethlin commented Dec 2, 2022

@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 Dec 2, 2022
@bors
Copy link
Contributor

bors commented Dec 2, 2022

⌛ Trying commit 22c8065ee0e0d3eaa3ffe02e0915e2324430033d with merge 19df18cef7165e96fbdd86cb2070613e6f858928...

@JakobDegen
Copy link
Contributor

Is there any reason to do this besides the specific example we'd talked about yesterday?

I'm not so sure this is the right way to address the issue that destprop has. Specifically, destprop needs to be taught to be smarter about dealing with "removable writes" anyway for the purpose of storage statements (see my comment here) and once it can do that, fixing this will be pretty straight forward

@saethlin
Copy link
Member Author

saethlin commented Dec 2, 2022

This is simple/easy to slap together quickly, and is unlikely to be a perf issue in itself. So it is a way to assess what the opportunity is. Of course you know much better than I if this is actually something that should be merged, but I think a PR and perf run is a step to assessing that.

@JakobDegen
Copy link
Contributor

Oh, yeah, don't misunderstand, this is definitely something we should try. That being said, I don't actually see how this could show an improvement in PRLO. In any case, my comment was about whether this made sense to merge, so do carry on with whatever experiments you're interested in

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Dec 3, 2022

☀️ Try build successful - checks-actions
Build commit: 19df18cef7165e96fbdd86cb2070613e6f858928 (19df18cef7165e96fbdd86cb2070613e6f858928)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (19df18cef7165e96fbdd86cb2070613e6f858928): 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.7% [0.7%, 0.7%] 1
Improvements ✅
(primary)
-0.4% [-1.4%, -0.2%] 13
Improvements ✅
(secondary)
-0.5% [-0.8%, -0.1%] 21
All ❌✅ (primary) -0.4% [-1.4%, -0.2%] 13

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.4% [3.7%, 5.1%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.8% [-5.5%, -1.9%] 5
Improvements ✅
(secondary)
-0.9% [-0.9%, -0.9%] 1
All ❌✅ (primary) -1.5% [-5.5%, 5.1%] 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.2% [2.7%, 4.3%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.6% [-4.7%, -4.4%] 3
All ❌✅ (primary) - - 0

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

saethlin commented Dec 4, 2022

@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 Dec 4, 2022
@bors
Copy link
Contributor

bors commented Dec 4, 2022

⌛ Trying commit 46d3a94bb3e768653b0a25db5bd1c5c5008a33da with merge 54a548dce63e8923dd55d8d52c96cd377f1148c4...

@bors
Copy link
Contributor

bors commented Dec 4, 2022

☀️ Try build successful - checks-actions
Build commit: 54a548dce63e8923dd55d8d52c96cd377f1148c4 (54a548dce63e8923dd55d8d52c96cd377f1148c4)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (54a548dce63e8923dd55d8d52c96cd377f1148c4): 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.7% [0.3%, 3.4%] 65
Regressions ❌
(secondary)
4.4% [0.5%, 13.0%] 23
Improvements ✅
(primary)
-3.1% [-3.1%, -3.1%] 1
Improvements ✅
(secondary)
-0.3% [-0.7%, -0.2%] 9
All ❌✅ (primary) 0.6% [-3.1%, 3.4%] 66

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)
3.4% [1.3%, 4.4%] 8
Regressions ❌
(secondary)
1.7% [1.7%, 1.7%] 1
Improvements ✅
(primary)
-3.5% [-8.0%, -0.0%] 7
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.2% [-8.0%, 4.4%] 15

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.9% [2.9%, 2.9%] 1
Regressions ❌
(secondary)
8.2% [1.5%, 12.3%] 9
Improvements ✅
(primary)
-1.7% [-3.5%, -0.9%] 8
Improvements ✅
(secondary)
-2.6% [-3.1%, -2.2%] 7
All ❌✅ (primary) -1.2% [-3.5%, 2.9%] 9

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Dec 4, 2022
@saethlin saethlin marked this pull request as draft December 4, 2022 05:36
@rust-log-analyzer

This comment has been minimized.

@saethlin saethlin reopened this Dec 11, 2022
@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 Dec 11, 2022
@compiler-errors
Copy link
Member

@bors try

@bors
Copy link
Contributor

bors commented Dec 11, 2022

⌛ Trying commit ec2edf264ff086ce84b5d196fc743c816b295cb6 with merge ebd4a176a1f40179f0806f9cfba1b7cdc7062a95...

@bors
Copy link
Contributor

bors commented Dec 11, 2022

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ebd4a176a1f40179f0806f9cfba1b7cdc7062a95): 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.3% [0.2%, 0.5%] 39
Regressions ❌
(secondary)
0.3% [0.2%, 0.4%] 3
Improvements ✅
(primary)
-1.4% [-1.4%, -1.4%] 1
Improvements ✅
(secondary)
-0.9% [-0.9%, -0.8%] 2
All ❌✅ (primary) 0.3% [-1.4%, 0.5%] 40

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.1% [2.4%, 7.8%] 2
Regressions ❌
(secondary)
1.5% [1.5%, 1.5%] 1
Improvements ✅
(primary)
-4.2% [-7.5%, -0.2%] 5
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.6% [-7.5%, 7.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.

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

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 11, 2022
@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 Dec 13, 2022
@bors
Copy link
Contributor

bors commented Dec 13, 2022

⌛ Trying commit 5c581d0 with merge 00374ac50ce2b3336298b9b945c964a1dabe7df9...

@bors
Copy link
Contributor

bors commented Dec 13, 2022

☀️ Try build successful - checks-actions
Build commit: 00374ac50ce2b3336298b9b945c964a1dabe7df9 (00374ac50ce2b3336298b9b945c964a1dabe7df9)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (00374ac50ce2b3336298b9b945c964a1dabe7df9): comparison URL.

Overall result: no relevant changes - 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 benchmark run did not return any relevant results for this metric.

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)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.3% [-7.2%, -2.3%] 3
All ❌✅ (primary) - - 0

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.0% [-3.0%, -3.0%] 1
All ❌✅ (primary) - - 0

@rustbot rustbot removed S-waiting-on-perf Status: Waiting on a perf run to be completed. perf-regression Performance regression. labels Dec 13, 2022
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-13 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Some tests failed in compiletest suite=mir-opt mode=mir-opt host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
...i................................
failures:

---- [mir-opt] src/test/mir-opt/issue_101973.rs stdout ----
67           _18 = _16;                       // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
68           StorageLive(_19);                // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
69           _19 = _17;                       // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-           _3 = rotate_right::<u32>(move _18, move _19) -> bb4; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+           _3 = rotate_right::<u32>(_18, _19) -> bb4; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
71                                            // mir::Constant
72                                            // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
73                                            // + literal: Const { ty: extern "rust-intrinsic" fn(u32, u32) -> u32 {rotate_right::<u32>}, val: Value(<ZST>) }

thread '[mir-opt] src/test/mir-opt/issue_101973.rs' panicked at 'Actual MIR output differs from expected MIR output /checkout/src/test/mir-opt/issue_101973.inner.ConstProp.diff', src/tools/compiletest/src/runtest.rs:3451:21


failures:
    [mir-opt] src/test/mir-opt/issue_101973.rs

@saethlin
Copy link
Member Author

This was a cool experiment to feed discussion about DestinationPropagation, but that's all it is ultimately.

@saethlin saethlin closed this Dec 28, 2022
@saethlin saethlin deleted the move-to-copy branch March 15, 2023 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

8 participants