Skip to content

Fast path for stalled obligations on self ty #141681

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

Conversation

compiler-errors
Copy link
Member

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

If we see that the self type of a goal is an infer var, then don't try to compute the goal at all, since we know that it'll be forced ambiguous.

This is currently only implemented when there are no opaques in the environment. We could extend it to check that the self type is not related to any already defined opaques via subtyping, but I'll leave that as a follow-up.


Also stall coerce and subtype predicates if both of their vars are not resolved to concrete types.


Also, we don't care if the goal is higher-ranked for the sized and copy/clone fast path. pulling this out into another PR.

r? lcnr

@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels May 28, 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 28, 2025
bors added a commit that referenced this pull request May 28, 2025
Fast path for stalled obligations on self ty

r? lcnr
@bors
Copy link
Collaborator

bors commented May 28, 2025

⌛ Trying commit fb285af with merge fa369e6...

@bors
Copy link
Collaborator

bors commented May 28, 2025

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (fa369e6): 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
Regressions ❌
(secondary)
0.5% [0.5%, 0.5%] 1
Improvements ✅
(primary)
-0.2% [-0.3%, -0.1%] 6
Improvements ✅
(secondary)
-7.8% [-29.0%, -0.1%] 15
All ❌✅ (primary) -0.2% [-0.3%, -0.1%] 6

Max RSS (memory usage)

Results (primary -1.0%, secondary -3.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)
1.8% [1.3%, 2.3%] 2
Improvements ✅
(primary)
-1.0% [-1.0%, -1.0%] 1
Improvements ✅
(secondary)
-5.7% [-8.7%, -4.7%] 6
All ❌✅ (primary) -1.0% [-1.0%, -1.0%] 1

Cycles

Results (secondary -12.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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-12.3% [-25.0%, -2.1%] 7
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 778.889s -> 779.678s (0.10%)
Artifact size: 368.42 MiB -> 366.35 MiB (-0.56%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels May 28, 2025
@compiler-errors compiler-errors marked this pull request as ready for review May 28, 2025 21:08
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 28, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 28, 2025

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

@bors
Copy link
Collaborator

bors commented Jun 1, 2025

☔ The latest upstream changes (presumably #141731) made this pull request unmergeable. Please resolve the merge conflicts.

@compiler-errors
Copy link
Member Author

@bors2 try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Jun 2, 2025

⌛ Trying commit 9899464 with merge 039888f

rust-bors bot added a commit that referenced this pull request Jun 2, 2025
Fast path for stalled obligations on self ty

If we see that the `self` type of a goal is an infer var, then don't try to compute the goal at all, since we know that it'll be forced ambiguous.

This is currently only implemented when there are no opaques in the environment. We could extend it to check that the self type is not related to any already defined opaques via subtyping, but I'll leave that as a follow-up.

---

Also stall coerce and subtype predicates if both of their vars are not resolved to concrete types.

---

~~Also, we don't care if the goal is higher-ranked for the sized and copy/clone fast path.~~ pulling this out into another PR.

r? lcnr
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 2, 2025
@rust-bors
Copy link

rust-bors bot commented Jun 2, 2025

☀️ Try build successful (CI)
Build commit: 039888f (039888fc2fe51ca95ed23c75d554793192d536e0)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (039888f): 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
Regressions ❌
(secondary)
0.3% [0.3%, 0.3%] 3
Improvements ✅
(primary)
-0.2% [-0.2%, -0.2%] 3
Improvements ✅
(secondary)
-9.0% [-50.3%, -0.2%] 20
All ❌✅ (primary) -0.2% [-0.2%, -0.2%] 3

Max RSS (memory usage)

Results (secondary 0.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
Regressions ❌
(secondary)
0.9% [0.4%, 1.6%] 13
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.4% [-0.5%, -0.4%] 3
All ❌✅ (primary) - - 0

Cycles

Results (secondary -7.9%)

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)
1.2% [0.7%, 1.7%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-9.1% [-43.1%, -0.4%] 16
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 743.192s -> 742.766s (-0.06%)
Artifact size: 372.27 MiB -> 372.37 MiB (0.03%)

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

lcnr commented Jun 3, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 3, 2025

📌 Commit 9899464 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 Jun 3, 2025
@bors
Copy link
Collaborator

bors commented Jun 6, 2025

⌛ Testing commit 9899464 with merge 9f0e5d9...

@bors
Copy link
Collaborator

bors commented Jun 6, 2025

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 6, 2025
@bors bors merged commit 9f0e5d9 into rust-lang:master Jun 6, 2025
11 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 6, 2025
Copy link
Contributor

github-actions bot commented Jun 6, 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 f315e61 (parent) -> 9f0e5d9 (this PR)

Test differences

No test diffs found

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 9f0e5d963d05ebcf7ae1ca1f4bda3668c702acda --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. x86_64-apple-1: 9670.2s -> 6827.2s (-29.4%)
  2. dist-apple-various: 7761.4s -> 6565.9s (-15.4%)
  3. dist-ohos-armv7: 3890.2s -> 4314.7s (10.9%)
  4. dist-ohos-aarch64: 4158.8s -> 4557.0s (9.6%)
  5. armhf-gnu: 4403.7s -> 4791.3s (8.8%)
  6. dist-s390x-linux: 4735.5s -> 5132.6s (8.4%)
  7. dist-powerpc64le-linux-musl: 4958.4s -> 5360.9s (8.1%)
  8. dist-x86_64-apple: 8356.1s -> 9021.1s (8.0%)
  9. i686-gnu-2: 5370.9s -> 5779.0s (7.6%)
  10. i686-gnu-nopt-1: 7161.2s -> 7676.4s (7.2%)
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 (9f0e5d9): 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.2% [0.2%, 0.2%] 1
Regressions ❌
(secondary)
0.6% [0.1%, 1.3%] 14
Improvements ✅
(primary)
-0.2% [-0.3%, -0.1%] 25
Improvements ✅
(secondary)
-4.3% [-50.3%, -0.0%] 43
All ❌✅ (primary) -0.2% [-0.3%, 0.2%] 26

Max RSS (memory usage)

Results (primary -2.5%, secondary 3.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
Regressions ❌
(secondary)
5.1% [4.7%, 5.9%] 3
Improvements ✅
(primary)
-2.5% [-2.5%, -2.5%] 1
Improvements ✅
(secondary)
-2.5% [-2.5%, -2.5%] 1
All ❌✅ (primary) -2.5% [-2.5%, -2.5%] 1

Cycles

Results (secondary -14.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)
- - 0
Regressions ❌
(secondary)
2.1% [2.1%, 2.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-15.9% [-42.9%, -0.9%] 9
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 751.682s -> 751.346s (-0.04%)
Artifact size: 371.84 MiB -> 372.49 MiB (0.17%)

@panstromek
Copy link
Contributor

perf triage:

Improvements outweigh regressions, those are mostly on stress tests. Some regressions also don't seem to be related, they just return back to state before #141652.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Jun 9, 2025
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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants