Skip to content

Tell LLVM Vec::len is invariant across growth #123930

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
Apr 21, 2024

Conversation

Mark-Simulacrum
Copy link
Member

This allows LLVM to avoid re-loading it from memory.

@rustbot
Copy link
Collaborator

rustbot commented Apr 14, 2024

r? @jhpratt

rustbot has assigned @jhpratt.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 14, 2024
@Mark-Simulacrum
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 Apr 14, 2024
@bors
Copy link
Collaborator

bors commented Apr 14, 2024

⌛ Trying commit 066490a with merge e80b3f5...

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 14, 2024
…, r=<try>

Tell LLVM Vec::len is invariant across growth

This allows LLVM to avoid re-loading it from memory.
@Mark-Simulacrum Mark-Simulacrum marked this pull request as ready for review April 14, 2024 16:29
@bors
Copy link
Collaborator

bors commented Apr 14, 2024

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e80b3f5): 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.2% [0.2%, 0.4%] 18
Regressions ❌
(secondary)
0.3% [0.2%, 0.4%] 13
Improvements ✅
(primary)
-0.5% [-1.0%, -0.3%] 9
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.2%] 4
All ❌✅ (primary) 0.0% [-1.0%, 0.4%] 27

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% [5.2%, 5.2%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.1% [-2.6%, -1.6%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [-2.6%, 5.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% [0.8%, 3.3%] 4
Improvements ✅
(primary)
-1.1% [-1.1%, -1.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.1% [-1.1%, -1.1%] 1

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.0% [0.0%, 0.1%] 27
Regressions ❌
(secondary)
0.0% [0.0%, 0.0%] 4
Improvements ✅
(primary)
-0.1% [-0.4%, -0.0%] 11
Improvements ✅
(secondary)
-0.0% [-0.0%, -0.0%] 34
All ❌✅ (primary) -0.0% [-0.4%, 0.1%] 38

Bootstrap: 677.239s -> 676.592s (-0.10%)
Artifact size: 315.99 MiB -> 315.99 MiB (-0.00%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Apr 14, 2024
@Mark-Simulacrum
Copy link
Member Author

Hard to say whether this is an improvement based on perf results, which seems pretty much as expected. A single, definitely-in-cache load is unlikely to be worth much to remove. I don't have a strong opinion on landing this vs. not, I'd probably bias slightly towards doing so since the load does mean more work for various parts of the pipeline even if it is cheap.

@jhpratt
Copy link
Member

jhpratt commented Apr 15, 2024

What could be causing the regressions here?

@Mark-Simulacrum
Copy link
Member Author

I looked at the regression in hyper-0.14.18 Opt IncrPatched, and it seems to be a little more time spent in LLVM optimizations. My guess is that LLVM is able to potentially benefit from this information and so spends a bit more time processing.

@jhpratt
Copy link
Member

jhpratt commented Apr 15, 2024

So the possibility for slightly better optimization. Given that this is trivially reverted if wanted, I'm going to go ahead and merge.

@bors r+ rollup=never

@bors
Copy link
Collaborator

bors commented Apr 15, 2024

📌 Commit 61ebcf4 has been approved by jhpratt

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 Apr 15, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 16, 2024
…, r=jhpratt

Tell LLVM Vec::len is invariant across growth

This allows LLVM to avoid re-loading it from memory.
@bors
Copy link
Collaborator

bors commented Apr 16, 2024

⌛ Testing commit 61ebcf4 with merge 73e117d...

@klensy
Copy link
Contributor

klensy commented Apr 16, 2024

This needs some test to prevent accidental regression?

@bors
Copy link
Collaborator

bors commented Apr 16, 2024

💥 Test timed out

@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 Apr 16, 2024
@RalfJung
Copy link
Member

@bors r-
(bors sync fixup)

@bors bors 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-review Status: Awaiting review from the assignee but also interested parties. labels Apr 17, 2024
@Mark-Simulacrum
Copy link
Member Author

@bors r=jhpratt

@bors
Copy link
Collaborator

bors commented Apr 20, 2024

📌 Commit a79d3cc has been approved by jhpratt

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 20, 2024
@bors
Copy link
Collaborator

bors commented Apr 21, 2024

⌛ Testing commit a79d3cc with merge 41fa2a0...

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 21, 2024
…, r=jhpratt

Tell LLVM Vec::len is invariant across growth

This allows LLVM to avoid re-loading it from memory.
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Apr 21, 2024

💔 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 Apr 21, 2024
This saves an extra load from memory.
@Mark-Simulacrum
Copy link
Member Author

@bors r=jhpratt

@bors
Copy link
Collaborator

bors commented Apr 21, 2024

📌 Commit f1ae531 has been approved by jhpratt

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 Apr 21, 2024
@bors
Copy link
Collaborator

bors commented Apr 21, 2024

⌛ Testing commit f1ae531 with merge 13eb8c7...

@bors
Copy link
Collaborator

bors commented Apr 21, 2024

☀️ Test successful - checks-actions
Approved by: jhpratt
Pushing 13eb8c7 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 21, 2024
@bors bors merged commit 13eb8c7 into rust-lang:master Apr 21, 2024
@rustbot rustbot added this to the 1.79.0 milestone Apr 21, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (13eb8c7): 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.1%, 1.6%] 7
Regressions ❌
(secondary)
0.3% [0.2%, 0.5%] 11
Improvements ✅
(primary)
-0.5% [-0.9%, -0.4%] 8
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.1%] 3
All ❌✅ (primary) -0.1% [-0.9%, 1.6%] 15

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% [5.1%, 5.1%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.5% [-4.1%, -1.7%] 4
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.0% [-4.1%, 5.1%] 5

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.5% [1.5%, 1.5%] 1
Regressions ❌
(secondary)
2.7% [2.2%, 3.3%] 4
Improvements ✅
(primary)
-0.8% [-0.8%, -0.8%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [-0.8%, 1.5%] 2

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.0% [0.0%, 0.1%] 31
Regressions ❌
(secondary)
0.0% [0.0%, 0.0%] 4
Improvements ✅
(primary)
-0.1% [-0.3%, -0.0%] 9
Improvements ✅
(secondary)
-0.0% [-0.0%, -0.0%] 34
All ❌✅ (primary) 0.0% [-0.3%, 0.1%] 40

Bootstrap: 673.693s -> 672.201s (-0.22%)
Artifact size: 315.30 MiB -> 315.29 MiB (-0.00%)

@Mark-Simulacrum Mark-Simulacrum deleted the vec-length-invariant branch April 21, 2024 12:49
@rylev
Copy link
Member

rylev commented Apr 23, 2024

@Mark-Simulacrum noted the regressions here as coming in LLVM, and it was deemed worth it given the possibility for LLVM to perform more optimization.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Apr 23, 2024
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-libs Relevant to the library 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