Skip to content

Do not gather local all together at the beginning of typeck #140561

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
May 6, 2025

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented May 1, 2025

r? lcnr

@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 1, 2025
@compiler-errors
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 1, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request May 1, 2025
… r=<try>

Do not gather local all together at the beginning of typeck

r? lcnr
@bors
Copy link
Collaborator

bors commented May 1, 2025

⌛ Trying commit fc8f9a4 with merge 154b8c2...

@bors
Copy link
Collaborator

bors commented May 1, 2025

☀️ Try build successful - checks-actions
Build commit: 154b8c2 (154b8c2f37d3dea13f53c27255d91094e5044378)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (154b8c2): 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 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.2% [0.2%, 0.2%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.0% [-22.4%, -0.2%] 60
Improvements ✅
(secondary)
-0.8% [-1.9%, -0.1%] 12
All ❌✅ (primary) -2.0% [-22.4%, 0.2%] 61

Max RSS (memory usage)

Results (primary -0.8%, secondary -0.2%)

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.6% [0.4%, 0.9%] 6
Regressions ❌
(secondary)
3.4% [2.0%, 4.8%] 2
Improvements ✅
(primary)
-1.1% [-3.5%, -0.4%] 25
Improvements ✅
(secondary)
-3.8% [-3.8%, -3.8%] 2
All ❌✅ (primary) -0.8% [-3.5%, 0.9%] 31

Cycles

Results (primary -1.6%, 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)
0.6% [0.5%, 0.7%] 4
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.9% [-11.4%, -0.4%] 40
Improvements ✅
(secondary)
-1.7% [-1.7%, -1.7%] 1
All ❌✅ (primary) -1.6% [-11.4%, 0.7%] 44

Binary size

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

Bootstrap: 768.358s -> 767.967s (-0.05%)
Artifact size: 365.48 MiB -> 365.38 MiB (-0.03%)

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

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

small nits, otherwise r=me

the perf impact is wild :o

@compiler-errors compiler-errors marked this pull request as ready for review May 5, 2025 14:26
@lcnr
Copy link
Contributor

lcnr commented May 5, 2025

r=me after nit

@compiler-errors
Copy link
Member Author

@bors r=lcnr rollup=never

@bors
Copy link
Collaborator

bors commented May 5, 2025

📌 Commit 45598de has been approved by lcnr

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 May 5, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request May 5, 2025
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

~~`./x.py b --stage 2` passes 🎉~~

`try` builds succeed 🎉 🎉 🎉

[first perf run](rust-lang#133502 (comment)) 👻

### crater

This does not detect hangs or memory issues.

| date | #crates | #regressions |
| ---- | ------- | ------------ |
| 2025.04.11 | 100 | 2 |
| 2025.04.11 | 1000 | 27 |
| 2025.04.17 | 10000 | 456 |
| 2025.04.18 | 10000 | 437 |
| 2025.04.24 | 10000 | 164 |
| 2025.04.26 | 10000 | 108 |
| 2025.04.28 | 10000 | 91 |
| 2025.05.01 | 10000 | 145 woops |
| 2025.05.03 | 624228[^1] |  1585 |
| 2025.05.05 | 8964[^2] | 931 |

[^1]: a complete crater run
[^2]: only testing crates which may have regressed from the above run

### in-flight changes

- rust-lang#140561
- rust-lang#140672
- rust-lang#140678
- rust-lang#136997
- rust-lang#139587
- rust-lang#140497
- rust-lang#124852, unsure whether I actually want to land this PR for now
- https://github.com/lcnr/rust/tree/opaque-type-method-call
- rust-lang#140260
- rust-lang#140375
- rust-lang#140405
- rust-lang#140496
- double recursion limit in the new solver

r? `@ghost`
@bors
Copy link
Collaborator

bors commented May 6, 2025

⌛ Testing commit 45598de with merge f5d3fe2...

@bors
Copy link
Collaborator

bors commented May 6, 2025

☀️ Test successful - checks-actions
Approved by: lcnr
Pushing f5d3fe2 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 6, 2025
@bors bors merged commit f5d3fe2 into rust-lang:master May 6, 2025
1 check passed
@rustbot rustbot added this to the 1.88.0 milestone May 6, 2025
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling diff v0.1.13
   Compiling glob-match v0.2.1
   Compiling citool v0.1.0 (/home/runner/work/rust/rust/src/ci/citool)
    Finished `release` profile [optimized] target(s) in 37.82s
     Running `target/release/citool post-merge-report 651e9cf327358b28db7e37a2ae61727f4a2ef232 f5d3fe273b8b9e7125bf8856d44793b6cc4b6735`
Downloading metrics of job aarch64-gnu
Downloading metrics of job aarch64-gnu-debug
Downloading metrics of job arm-android
Downloading metrics of job armhf-gnu
Downloading metrics of job dist-aarch64-linux
Downloading metrics of job dist-android
Downloading metrics of job dist-arm-linux
Downloading metrics of job dist-armhf-linux
Downloading metrics of job dist-armv7-linux
Downloading metrics of job dist-i586-gnu-i586-i686-musl
Downloading metrics of job dist-i686-linux
Downloading metrics of job dist-loongarch64-linux
Downloading metrics of job dist-loongarch64-musl
Downloading metrics of job dist-ohos
Downloading metrics of job dist-powerpc-linux
Downloading metrics of job dist-powerpc64-linux
Downloading metrics of job dist-powerpc64le-linux
Downloading metrics of job dist-riscv64-linux
Downloading metrics of job dist-s390x-linux
Downloading metrics of job dist-various-1
Downloading metrics of job dist-various-2
Downloading metrics of job dist-x86_64-freebsd
Downloading metrics of job dist-x86_64-illumos
Downloading metrics of job dist-x86_64-linux
Downloading metrics of job dist-x86_64-linux-alt
Downloading metrics of job dist-x86_64-musl
Downloading metrics of job dist-x86_64-netbsd
Downloading metrics of job i686-gnu-1
Downloading metrics of job i686-gnu-2
Downloading metrics of job i686-gnu-nopt-1
Downloading metrics of job i686-gnu-nopt-2
Downloading metrics of job mingw-check
Downloading metrics of job test-various
Downloading metrics of job x86_64-rust-for-linux
Downloading metrics of job x86_64-gnu
Downloading metrics of job x86_64-gnu-stable
Downloading metrics of job x86_64-gnu-aux
Downloading metrics of job x86_64-gnu-debug
Downloading metrics of job x86_64-gnu-distcheck
Downloading metrics of job x86_64-gnu-llvm-20-1
Downloading metrics of job x86_64-gnu-llvm-20-2
Downloading metrics of job x86_64-gnu-llvm-20-3
Downloading metrics of job x86_64-gnu-llvm-19-1
Downloading metrics of job x86_64-gnu-llvm-19-2
Downloading metrics of job x86_64-gnu-llvm-19-3
Downloading metrics of job x86_64-gnu-nopt
Downloading metrics of job x86_64-gnu-tools
Downloading metrics of job dist-x86_64-apple
Downloading metrics of job dist-apple-various
Downloading metrics of job x86_64-apple-1
Downloading metrics of job x86_64-apple-2
Downloading metrics of job dist-aarch64-apple
Downloading metrics of job aarch64-apple
Downloading metrics of job x86_64-msvc-1
Downloading metrics of job x86_64-msvc-2
Downloading metrics of job i686-msvc-1
Downloading metrics of job i686-msvc-2
Downloading metrics of job x86_64-msvc-ext1
Downloading metrics of job x86_64-msvc-ext2
Downloading metrics of job x86_64-msvc-ext3
Downloading metrics of job x86_64-mingw-1
Downloading metrics of job x86_64-mingw-2
Downloading metrics of job dist-x86_64-msvc
Downloading metrics of job dist-i686-msvc
Downloading metrics of job dist-aarch64-msvc
Downloading metrics of job dist-i686-mingw
Downloading metrics of job dist-x86_64-mingw
Downloading metrics of job dist-x86_64-msvc-alt
<details>
<summary>What is this?</summary>
This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.
</details>


Comparing 651e9cf327358b28db7e37a2ae61727f4a2ef232 (parent) -> f5d3fe273b8b9e7125bf8856d44793b6cc4b6735 (this PR)

# Test differences
<details>
<summary>Show 7 test diffs
</summary>


7 doctest diffs were found. These are ignored, as they are noisy.
</details>

<details>
<summary>Test dashboard</summary>

Run

```bash
cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard f5d3fe273b8b9e7125bf8856d44793b6cc4b6735 --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. aarch64-apple: 4201.4s -> 3643.9s (-13.3%)
  2. dist-x86_64-apple: 7884.2s -> 8887.1s (12.7%)
  3. x86_64-apple-1: 8180.6s -> 9156.9s (11.9%)
  4. dist-x86_64-freebsd: 4900.8s -> 5478.5s (11.8%)
  5. dist-apple-various: 7467.3s -> 6786.8s (-9.1%)
  6. x86_64-gnu-llvm-20-3: 7060.5s -> 6744.6s (-4.5%)
  7. dist-aarch64-apple: 5424.5s -> 5665.6s (4.4%)
  8. x86_64-mingw-2: 7233.5s -> 6919.6s (-4.3%)
  9. dist-s390x-linux: 5479.2s -> 5245.3s (-4.3%)
  10. x86_64-msvc-ext2: 5939.8s -> 5714.8s (-3.8%)
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.

no pull requests found for branch "master"
##[error]Process completed with exit code 1.
Post job cleanup.


</details>

@lqd
Copy link
Member

lqd commented May 6, 2025

cc @Kobzol on that post merge job failure

@compiler-errors compiler-errors deleted the gather-fewer-locals branch May 6, 2025 13:55
@Kobzol
Copy link
Contributor

Kobzol commented May 6, 2025

Thanks! #140703 should hopefully help.

bors added a commit to rust-lang-ci/rust that referenced this pull request May 6, 2025
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

~~`./x.py b --stage 2` passes 🎉~~

`try` builds succeed 🎉 🎉 🎉

[first perf run](rust-lang#133502 (comment)) 👻

### crater

This does not detect hangs or memory issues.

| date | #crates | #regressions |
| ---- | ------- | ------------ |
| 2025.04.11 | 100 | 2 |
| 2025.04.11 | 1000 | 27 |
| 2025.04.17 | 10000 | 456 |
| 2025.04.18 | 10000 | 437 |
| 2025.04.24 | 10000 | 164 |
| 2025.04.26 | 10000 | 108 |
| 2025.04.28 | 10000 | 91 |
| 2025.05.01 | 10000 | 145 woops |
| 2025.05.03 | 624228[^1] |  1585 |
| 2025.05.05 | 8964[^2] | 931 |

[^1]: a complete crater run
[^2]: only testing crates which may have regressed from the above run

### in-flight changes

- rust-lang#140561
- rust-lang#140672
- rust-lang#140678
- rust-lang#136997
- rust-lang#139587
- rust-lang#140497
- rust-lang#124852, unsure whether I actually want to land this PR for now
- https://github.com/lcnr/rust/tree/opaque-type-method-call
- rust-lang#140260
- rust-lang#140375
- rust-lang#140405
- rust-lang#140496
- double recursion limit in the new solver

r? `@ghost`
bors added a commit to rust-lang-ci/rust that referenced this pull request May 6, 2025
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

~~`./x.py b --stage 2` passes 🎉~~

`try` builds succeed 🎉 🎉 🎉

[first perf run](rust-lang#133502 (comment)) 👻

### crater

This does not detect hangs or memory issues.

| date | #crates | #regressions |
| ---- | ------- | ------------ |
| 2025.04.11 | 100 | 2 |
| 2025.04.11 | 1000 | 27 |
| 2025.04.17 | 10000 | 456 |
| 2025.04.18 | 10000 | 437 |
| 2025.04.24 | 10000 | 164 |
| 2025.04.26 | 10000 | 108 |
| 2025.04.28 | 10000 | 91 |
| 2025.05.01 | 10000 | 145 woops |
| 2025.05.03 | 624228[^1] |  1585 |
| 2025.05.05 | 8964[^2] | 931 |
| 2025.05.06 | 4401[^2] | 726 |

[^1]: a complete crater run
[^2]: only testing crates which may have regressed from the above run

### in-flight changes

- rust-lang#140561
- rust-lang#140672
- rust-lang#140678
- rust-lang#136997
- rust-lang#139587
- rust-lang#140497
- rust-lang#124852, unsure whether I actually want to land this PR for now
- https://github.com/lcnr/rust/tree/opaque-type-method-call
- rust-lang#140260
- rust-lang#140375
- rust-lang#140405
- rust-lang#140496
- double recursion limit in the new solver

r? `@ghost`
bors added a commit to rust-lang-ci/rust that referenced this pull request May 6, 2025
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

~~`./x.py b --stage 2` passes 🎉~~

`try` builds succeed 🎉 🎉 🎉

[first perf run](rust-lang#133502 (comment)) 👻

### crater

This does not detect hangs or memory issues.

| date | #crates | #regressions |
| ---- | ------- | ------------ |
| 2025.04.11 | 100 | 2 |
| 2025.04.11 | 1000 | 27 |
| 2025.04.17 | 10000 | 456 |
| 2025.04.18 | 10000 | 437 |
| 2025.04.24 | 10000 | 164 |
| 2025.04.26 | 10000 | 108 |
| 2025.04.28 | 10000 | 91 |
| 2025.05.01 | 10000 | 145 woops |
| 2025.05.03 | 624228[^1] |  1585 |
| 2025.05.05 | 8964[^2] | 931 |
| 2025.05.06 | 4401[^2] | 726 |

[^1]: a complete crater run
[^2]: only testing crates which may have regressed from the above run

### in-flight changes

- rust-lang#140561
- rust-lang#140672
- rust-lang#140678
- rust-lang#136997
- rust-lang#139587
- rust-lang#140497
- rust-lang#124852, unsure whether I actually want to land this PR for now
- https://github.com/lcnr/rust/tree/opaque-type-method-call
- rust-lang#140260
- rust-lang#140375
- rust-lang#140405
- rust-lang#140496
- double recursion limit in the new solver

r? `@ghost`
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f5d3fe2): 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.4% [0.4%, 0.4%] 1
Regressions ❌
(secondary)
0.3% [0.2%, 0.4%] 3
Improvements ✅
(primary)
-1.8% [-22.4%, -0.1%] 73
Improvements ✅
(secondary)
-0.9% [-2.0%, -0.3%] 12
All ❌✅ (primary) -1.8% [-22.4%, 0.4%] 74

Max RSS (memory usage)

Results (primary -0.0%, secondary 4.1%)

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.2% [0.5%, 2.2%] 12
Regressions ❌
(secondary)
4.1% [4.1%, 4.1%] 1
Improvements ✅
(primary)
-0.9% [-2.2%, -0.4%] 16
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.0% [-2.2%, 2.2%] 28

Cycles

Results (primary -1.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)
1.0% [0.5%, 2.8%] 5
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.3% [-11.8%, -0.4%] 28
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.8% [-11.8%, 2.8%] 33

Binary size

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

Bootstrap: 771.17s -> 770.498s (-0.09%)
Artifact size: 365.44 MiB -> 365.48 MiB (0.01%)

@rustbot rustbot added the perf-regression Performance regression. label May 6, 2025
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request May 6, 2025
…oieni

Handle PR not found in post-merge workflow

Should hopefully fix errors like [these](rust-lang#140561 (comment)).

r? `@marcoieni`
@nnethercote
Copy link
Contributor

@compiler-errors: some amazing perf results there, well done. How did you find this/think of this?

@compiler-errors
Copy link
Member Author

@nnethercote: Gathering locals at the beginning of typeck ended up leading to a hang in the new solver (-Znext-solver) for tests/ui/issues/issue-29466.rs. Investigating it led to my solution to register locals more closely to the first chance of them being used, which I only really intended to fix the hang in the new solver.

I guess it coincidentally ended up also being positive perf-wise in the old solver, but I didn't look too closely into why. Probably has something to do with holding a ton of pending _: Sized goals in the fulfillment context, which get repeatedly checked if they're unstalled.

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 6, 2025
Rollup merge of rust-lang#140703 - Kobzol:post-merge-race-fix, r=marcoieni

Handle PR not found in post-merge workflow

Should hopefully fix errors like [these](rust-lang#140561 (comment)).

r? `@marcoieni`
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. 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.

9 participants