Skip to content

Allow GVN to produce places and not just locals. #139327

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 2 commits into from
Apr 9, 2025

Conversation

cjgillot
Copy link
Contributor

@cjgillot cjgillot commented Apr 3, 2025

That may be too big of a hammer, as we may introduce new deref projections (possible UB footgun + probably not good for perf).

The second commit opts out of introducing projections that don't have a stable offset, which is probably what we want. Hence no new Deref and no new Index projections.

Fixes #138936
cc @scottmcm @dianqk

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

rustbot commented Apr 3, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@cjgillot
Copy link
Contributor Author

cjgillot commented Apr 3, 2025

@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 3, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 3, 2025
Allow GVN to produce places and not just locals.

That may be too big of a hammer, as we may introduce new deref projections (possible UB footgun + probably not good for perf).

r? `@ghost` for perf

Fixes rust-lang#138936
cc `@scottmcm` `@dianqk`
@bors
Copy link
Collaborator

bors commented Apr 3, 2025

⌛ Trying commit 731a3e6 with merge 277319f...

@bors
Copy link
Collaborator

bors commented Apr 3, 2025

☀️ Try build successful - checks-actions
Build commit: 277319f (277319f2de9573bbed55fea209bcdaca385a235c)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (277319f): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

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 the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
0.6% [0.5%, 0.7%] 2
Regressions ❌
(secondary)
0.5% [0.1%, 1.1%] 22
Improvements ✅
(primary)
-0.4% [-0.9%, -0.2%] 7
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.2% [-0.9%, 0.7%] 9

Max RSS (memory usage)

Results (primary 0.2%, secondary -0.8%)

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.0% [1.5%, 2.3%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.5% [-2.8%, -2.2%] 2
Improvements ✅
(secondary)
-0.8% [-0.8%, -0.8%] 1
All ❌✅ (primary) 0.2% [-2.8%, 2.3%] 5

Cycles

Results (primary 0.9%, secondary 2.3%)

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.9% [0.9%, 0.9%] 1
Regressions ❌
(secondary)
2.3% [2.2%, 2.5%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.9% [0.9%, 0.9%] 1

Binary size

Results (primary -0.1%, secondary 0.0%)

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.2% [0.0%, 0.5%] 13
Regressions ❌
(secondary)
0.2% [0.2%, 0.4%] 39
Improvements ✅
(primary)
-0.2% [-0.4%, -0.0%] 41
Improvements ✅
(secondary)
-0.8% [-1.4%, -0.3%] 9
All ❌✅ (primary) -0.1% [-0.4%, 0.5%] 54

Bootstrap: 776.226s -> 778.039s (0.23%)
Artifact size: 365.90 MiB -> 365.88 MiB (-0.01%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Apr 4, 2025
@cjgillot
Copy link
Contributor Author

cjgillot commented Apr 4, 2025

@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 4, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 4, 2025
Allow GVN to produce places and not just locals.

That may be too big of a hammer, as we may introduce new deref projections (possible UB footgun + probably not good for perf).

r? `@ghost` for perf

Fixes rust-lang#138936
cc `@scottmcm` `@dianqk`
@bors
Copy link
Collaborator

bors commented Apr 4, 2025

⌛ Trying commit d9caf84 with merge 631e9e6...

@bors
Copy link
Collaborator

bors commented Apr 4, 2025

☀️ Try build successful - checks-actions
Build commit: 631e9e6 (631e9e60f5e36e847dd5dc1d5813c4a0f6960401)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (631e9e6): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

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 the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
0.5% [0.5%, 0.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.6% [-0.6%, -0.6%] 1
Improvements ✅
(secondary)
-0.8% [-0.9%, -0.2%] 7
All ❌✅ (primary) -0.0% [-0.6%, 0.5%] 2

Max RSS (memory usage)

Results (primary -1.3%)

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.7% [3.5%, 3.8%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.9% [-6.1%, -2.8%] 4
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.3% [-6.1%, 3.8%] 6

Cycles

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

Binary size

Results (primary 0.0%, secondary 0.0%)

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.2% [0.0%, 1.5%] 19
Regressions ❌
(secondary)
0.0% [0.0%, 0.0%] 4
Improvements ✅
(primary)
-0.3% [-0.6%, -0.0%] 11
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [-0.6%, 1.5%] 30

Bootstrap: 778.988s -> 778.401s (-0.08%)
Artifact size: 365.99 MiB -> 365.96 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 4, 2025
@cjgillot
Copy link
Contributor Author

cjgillot commented Apr 4, 2025

r? compiler

@oli-obk
Copy link
Contributor

oli-obk commented Apr 8, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 8, 2025

📌 Commit d9caf84 has been approved by oli-obk

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 8, 2025
@jieyouxu
Copy link
Member

jieyouxu commented Apr 8, 2025

@bors p=5 (rollup threading)

@bors
Copy link
Collaborator

bors commented Apr 9, 2025

⌛ Testing commit d9caf84 with merge f06e5c1...

@bors
Copy link
Collaborator

bors commented Apr 9, 2025

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 9, 2025
@bors bors merged commit f06e5c1 into rust-lang:master Apr 9, 2025
7 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 9, 2025
Copy link

github-actions bot commented Apr 9, 2025

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 97c966b (parent) -> f06e5c1 (this PR)

Test differences

Show 2 test diffs

Stage 1

  • [mir-opt] tests/mir-opt/gvn_copy_constant_projection.rs: [missing] -> pass (J1)

Stage 2

  • [mir-opt] tests/mir-opt/gvn_copy_constant_projection.rs: [missing] -> pass (J0)

Job group index

  • J0: aarch64-apple, aarch64-gnu, arm-android, armhf-gnu, dist-i586-gnu-i586-i686-musl, i686-gnu-1, i686-gnu-nopt-1, i686-msvc-1, test-various, x86_64-apple-1, x86_64-gnu, x86_64-gnu-llvm-19-1, x86_64-gnu-llvm-19-2, x86_64-gnu-nopt, x86_64-gnu-stable, x86_64-mingw-1, x86_64-msvc-1
  • J1: x86_64-gnu-llvm-19-3

Job duration changes

  1. aarch64-apple: 3676.7s -> 4495.6s (22.3%)
  2. dist-aarch64-apple: 4402.7s -> 5203.3s (18.2%)
  3. x86_64-apple-2: 4755.2s -> 5237.7s (10.1%)
  4. dist-apple-various: 5396.1s -> 5902.4s (9.4%)
  5. x86_64-gnu-stable: 6626.8s -> 6957.6s (5.0%)
  6. dist-x86_64-msvc: 5950.4s -> 6168.4s (3.7%)
  7. dist-x86_64-linux: 5463.5s -> 5633.8s (3.1%)
  8. x86_64-gnu: 6397.4s -> 6593.4s (3.1%)
  9. x86_64-gnu-nopt: 5564.0s -> 5728.7s (3.0%)
  10. dist-x86_64-illumos: 5667.0s -> 5816.0s (2.6%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f06e5c1): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

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

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
0.7% [0.7%, 0.7%] 1
Regressions ❌
(secondary)
0.7% [0.7%, 0.7%] 1
Improvements ✅
(primary)
-0.6% [-0.6%, -0.6%] 1
Improvements ✅
(secondary)
-0.6% [-0.9%, -0.2%] 10
All ❌✅ (primary) 0.0% [-0.6%, 0.7%] 2

Max RSS (memory usage)

Results (primary 5.0%, secondary 1.7%)

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)
6.6% [4.0%, 8.8%] 5
Regressions ❌
(secondary)
6.6% [6.6%, 6.6%] 1
Improvements ✅
(primary)
-2.9% [-2.9%, -2.9%] 1
Improvements ✅
(secondary)
-3.2% [-3.2%, -3.2%] 1
All ❌✅ (primary) 5.0% [-2.9%, 8.8%] 6

Cycles

Results (secondary 2.8%)

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

Binary size

Results (primary -0.0%, secondary 0.0%)

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.2% [0.0%, 1.5%] 15
Regressions ❌
(secondary)
0.0% [0.0%, 0.0%] 2
Improvements ✅
(primary)
-0.2% [-0.5%, -0.0%] 15
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.0% [-0.5%, 1.5%] 30

Bootstrap: 778.182s -> 779.721s (0.20%)
Artifact size: 366.15 MiB -> 366.13 MiB (-0.01%)

@cjgillot cjgillot deleted the gvn-place branch April 10, 2025 23:18
@Mark-Simulacrum Mark-Simulacrum added the perf-regression-triaged The performance regression has been triaged. label Apr 14, 2025
@Mark-Simulacrum
Copy link
Member

Regressions look plausibly real, but are limited (~2 scenarios) and outweighed by benefits. Marking as triaged.

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.

[mir-opt] avoid *& when reading primitive from slice
8 participants