Skip to content

Allow more MIR SROA #144543

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
Jul 28, 2025
Merged

Allow more MIR SROA #144543

merged 1 commit into from
Jul 28, 2025

Conversation

scottmcm
Copy link
Member

@scottmcm scottmcm commented Jul 27, 2025

This removes some guards on SROA that are no longer needed:

@rustbot
Copy link
Collaborator

rustbot commented Jul 27, 2025

r? @lcnr

rustbot has assigned @lcnr.
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-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 27, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 27, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@@ -64,9 +64,8 @@
+ let mut _45: &mut std::future::Ready<()>;
+ let mut _46: &mut std::pin::Pin<&mut std::future::Ready<()>>;
+ scope 14 (inlined <Pin<&mut std::future::Ready<()>> as DerefMut>::deref_mut) {
+ let mut _47: std::pin::Pin<&mut std::future::Ready<()>>;
Copy link
Member Author

Choose a reason for hiding this comment

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

annot: See how this Pin wrapper is now removed, when it previously couldn't be.

@scottmcm
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Jul 27, 2025
@rust-bors
Copy link

rust-bors bot commented Jul 27, 2025

⌛ Trying commit 47bfa84 with merge d7a058b

To cancel the try build, run the command @bors try cancel.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 27, 2025
@rust-bors
Copy link

rust-bors bot commented Jul 27, 2025

☀️ Try build successful (CI)
Build commit: d7a058b (d7a058b04fbf0f6a47f0680cd24eb12490080bd4, parent: 4b596bbd847672da87763b76171687d3544863c2)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d7a058b): comparison URL.

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

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.3% [0.1%, 0.8%] 6
Regressions ❌
(secondary)
0.3% [0.2%, 0.3%] 6
Improvements ✅
(primary)
-0.4% [-0.6%, -0.2%] 4
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 2
All ❌✅ (primary) 0.0% [-0.6%, 0.8%] 10

Max RSS (memory usage)

Results (primary 0.8%, secondary 2.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
4.1% [3.3%, 4.7%] 4
Regressions ❌
(secondary)
2.9% [2.3%, 3.9%] 3
Improvements ✅
(primary)
-3.7% [-5.5%, -2.1%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.8% [-5.5%, 4.7%] 7

Cycles

Results (primary -2.6%, secondary 2.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

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

Binary size

Results (primary -0.0%, secondary -0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.2% [0.1%, 0.7%] 9
Regressions ❌
(secondary)
0.2% [0.2%, 0.2%] 2
Improvements ✅
(primary)
-0.2% [-0.6%, -0.0%] 19
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.0%] 7
All ❌✅ (primary) -0.0% [-0.6%, 0.7%] 28

Bootstrap: 466.325s -> 466.887s (0.12%)
Artifact size: 376.81 MiB -> 376.81 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 Jul 28, 2025
@scottmcm
Copy link
Member Author

Looks like this permuted codegen schedules (as is common for MIR changes that downstream affect inlining), so it's expected that there'd be ups and downs from it.

For example, the reason image-opt-full looks like
image

Is due to the different CGUs
image

@cjgillot
Copy link
Contributor

Perf is neutral on average. I don't see many simplifications in the tests, but that may just be a lack of opportunities.

Still, I like having fewer special cases, so r=me if you want to go ahead as-is

@scottmcm
Copy link
Member Author

Yeah, I think that avoiding using layout here is a good reason to take it. Maybe's not that common to wrap niched scalars into transparent newtypes, but we clearly should be SRoAing those cases when they happen.

@bors r=cjgillot

@bors
Copy link
Collaborator

bors commented Jul 28, 2025

📌 Commit 47bfa84 has been approved by cjgillot

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 Jul 28, 2025
@lcnr lcnr assigned cjgillot and unassigned lcnr Jul 28, 2025
@bors
Copy link
Collaborator

bors commented Jul 28, 2025

⌛ Testing commit 47bfa84 with merge 9ba00e0...

@bors
Copy link
Collaborator

bors commented Jul 28, 2025

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing 9ba00e0 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 28, 2025
@bors bors merged commit 9ba00e0 into rust-lang:master Jul 28, 2025
12 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jul 28, 2025
Copy link
Contributor

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 65b6cdb (parent) -> 9ba00e0 (this PR)

Test differences

Show 3 test diffs

3 doctest diffs were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 9ba00e0f9e00990fb88c1beac7172afe93b15609 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-x86_64-apple: 8190.2s -> 11486.0s (40.2%)
  2. x86_64-apple-1: 7842.6s -> 6510.5s (-17.0%)
  3. pr-check-2: 2686.6s -> 2267.7s (-15.6%)
  4. x86_64-gnu-llvm-19: 2858.0s -> 2450.6s (-14.3%)
  5. x86_64-apple-2: 4791.6s -> 4118.0s (-14.1%)
  6. dist-aarch64-apple: 7587.6s -> 6553.4s (-13.6%)
  7. aarch64-gnu-llvm-19-2: 2596.5s -> 2285.8s (-12.0%)
  8. x86_64-rust-for-linux: 2974.3s -> 2624.6s (-11.8%)
  9. tidy: 114.4s -> 102.6s (-10.3%)
  10. i686-gnu-1: 8112.3s -> 7321.7s (-9.7%)
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 (9ba00e0): 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

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.5% [0.2%, 0.8%] 3
Regressions ❌
(secondary)
0.3% [0.2%, 0.3%] 6
Improvements ✅
(primary)
-0.4% [-0.6%, -0.2%] 3
Improvements ✅
(secondary)
-0.9% [-1.0%, -0.9%] 6
All ❌✅ (primary) 0.0% [-0.6%, 0.8%] 6

Max RSS (memory usage)

Results (primary 1.9%, secondary 4.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
4.0% [1.2%, 5.3%] 5
Regressions ❌
(secondary)
4.4% [4.4%, 4.4%] 1
Improvements ✅
(primary)
-3.3% [-4.2%, -2.3%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.9% [-4.2%, 5.3%] 7

Cycles

Results (primary 2.1%, secondary -2.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.1% [2.0%, 2.1%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.3% [-2.3%, -2.3%] 1
All ❌✅ (primary) 2.1% [2.0%, 2.1%] 2

Binary size

Results (primary -0.0%, secondary -0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.2% [0.1%, 0.7%] 9
Regressions ❌
(secondary)
0.1% [0.0%, 0.2%] 3
Improvements ✅
(primary)
-0.2% [-0.6%, -0.0%] 19
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.0%] 7
All ❌✅ (primary) -0.0% [-0.6%, 0.7%] 28

Bootstrap: 468.035s -> 468.487s (0.10%)
Artifact size: 376.82 MiB -> 376.81 MiB (-0.00%)

@lqd
Copy link
Member

lqd commented Jul 28, 2025

Neutral results, worthwhile simplification, marking triaged as per #144543 (comment)

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Jul 28, 2025
@lqd
Copy link
Member

lqd commented Jul 28, 2025

(for triagers) also: match-stress is currently noisy

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.

7 participants