Skip to content

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Apr 27, 2025

Previously called sub_relations. We still only using them for diagnostics right now. This mostly reverts #119989. Necessary for type inference guidance due to not-yet defined opaque types, cc rust-lang/trait-system-refactor-initiative#182.

We could use them for cycle detection in generalization and it seems desirable to do so in the future. However, this is unsound with the old trait solver as its cache does not track these sub_unification_table in any way.

We now properly track the sub_unification_table when canonicalizing so using them in the new solver is totally sound and the performance impact is far more manageable than I thought back in #119989.

r? @compiler-errors

@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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Apr 27, 2025
@rust-cloud-vms rust-cloud-vms bot force-pushed the subrelations-infcx branch from cb71df2 to a0fef49 Compare April 28, 2025 18:29
@rust-log-analyzer

This comment has been minimized.

@rust-cloud-vms rust-cloud-vms bot force-pushed the subrelations-infcx branch from a0fef49 to 46487b0 Compare April 28, 2025 18:42
@rust-log-analyzer

This comment has been minimized.

@rust-cloud-vms rust-cloud-vms bot force-pushed the subrelations-infcx branch from 46487b0 to 54a32a1 Compare April 28, 2025 19:55
@lcnr
Copy link
Contributor Author

lcnr commented Apr 28, 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 28, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 28, 2025
eagerly compute `sub_relations` again

We still only using them for diagnostics with the old solver.

We could use them for cycle detection in generalization and it seems desirable to do so in the future. However, this is unsound with the old trait solver as its cache does not track these `sub_relations` in any way. We would also need to consider them when canonicalizing as otherwise instantiating the canonical response may fail.

Necessary for type inference guidance due to not-yet defined opaque types, cc rust-lang/trait-system-refactor-initiative#182.

r? `@compiler-errors`
@bors
Copy link
Collaborator

bors commented Apr 28, 2025

⌛ Trying commit 54a32a1 with merge 3c1d077...

@rust-cloud-vms rust-cloud-vms bot force-pushed the subrelations-infcx branch from 611d7ae to 26f4ee0 Compare April 28, 2025 20:22
@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Apr 29, 2025

⌛ Trying commit 26f4ee0 with merge e184142...

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 29, 2025
eagerly compute `sub_relations` again

We still only using them for diagnostics with the old solver.

We could use them for cycle detection in generalization and it seems desirable to do so in the future. However, this is unsound with the old trait solver as its cache does not track these `sub_relations` in any way. We would also need to consider them when canonicalizing as otherwise instantiating the canonical response may fail.

Necessary for type inference guidance due to not-yet defined opaque types, cc rust-lang/trait-system-refactor-initiative#182.

r? `@compiler-errors`
@bors
Copy link
Collaborator

bors commented Apr 29, 2025

☀️ Try build successful - checks-actions
Build commit: e184142 (e1841428183d264d2f48328b3de5c0f25654315a)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e184142): comparison URL.

Overall result: ❌ regressions - 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.4% [0.2%, 1.7%] 75
Regressions ❌
(secondary)
0.4% [0.2%, 0.7%] 48
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [0.2%, 1.7%] 75

Max RSS (memory usage)

Results (primary -0.6%, secondary -4.5%)

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.8% [0.8%, 0.8%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.7% [-1.1%, -0.4%] 12
Improvements ✅
(secondary)
-4.5% [-4.5%, -4.5%] 1
All ❌✅ (primary) -0.6% [-1.1%, 0.8%] 13

Cycles

Results (primary 0.0%, secondary -1.6%)

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.7% [0.5%, 0.9%] 3
Regressions ❌
(secondary)
2.2% [2.2%, 2.2%] 1
Improvements ✅
(primary)
-0.6% [-0.7%, -0.5%] 3
Improvements ✅
(secondary)
-2.6% [-2.8%, -2.1%] 4
All ❌✅ (primary) 0.0% [-0.7%, 0.9%] 6

Binary size

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

Bootstrap: 765.701s -> 765.069s (-0.08%)
Artifact size: 365.36 MiB -> 365.11 MiB (-0.07%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Apr 29, 2025
@rust-cloud-vms rust-cloud-vms bot force-pushed the subrelations-infcx branch from 26f4ee0 to c629527 Compare April 29, 2025 17:25
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Apr 29, 2025

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

@lcnr
Copy link
Contributor Author

lcnr commented Apr 29, 2025

see perf run in #140480 (comment)

@lcnr
Copy link
Contributor Author

lcnr commented Apr 29, 2025

comparing these two perf runs, tracking sub_relations in canonical inputs does slightly worsen performance: https://perf.rust-lang.org/compare.html?start=e1841428183d264d2f48328b3de5c0f25654315a&end=9613271ee15ea18ed41f396fc7aaf4c1f760410a&stat=instructions%3Au

@lcnr
Copy link
Contributor Author

lcnr commented Sep 8, 2025

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 8, 2025
@lcnr lcnr changed the title eagerly compute sub_relations again eagerly compute sub_unification_table again Sep 8, 2025
@lcnr lcnr force-pushed the subrelations-infcx branch 2 times, most recently from 1262693 to ad169c9 Compare September 8, 2025 12:12
@lcnr lcnr force-pushed the subrelations-infcx branch from ad169c9 to b51a3a5 Compare September 8, 2025 12:18
@rustbot
Copy link
Collaborator

rustbot commented Sep 8, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@lcnr
Copy link
Contributor Author

lcnr commented Sep 8, 2025

@bors r=BoxyUwU rollup=never

The small perf regression is expected as we're now tracking more information. Part of it is just losing the perf gains from #119989.

@bors
Copy link
Collaborator

bors commented Sep 8, 2025

📌 Commit b51a3a5 has been approved by BoxyUwU

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 Sep 8, 2025
@bors
Copy link
Collaborator

bors commented Sep 8, 2025

⌛ Testing commit b51a3a5 with merge 9c27f27...

@bors
Copy link
Collaborator

bors commented Sep 8, 2025

☀️ Test successful - checks-actions
Approved by: BoxyUwU
Pushing 9c27f27 to master...

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

github-actions bot commented Sep 8, 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 a78f9aa (parent) -> 9c27f27 (this PR)

Test differences

Show 20 test diffs

Stage 1

  • [ui] tests/ui/type-alias-impl-trait/fallback.rs: pass -> [missing] (J0)

Stage 2

  • [ui] tests/ui/type-alias-impl-trait/fallback.rs: pass -> [missing] (J1)

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

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 9c27f27ea3bab79a2fec827ef3ae0009959d60f4 --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-aarch64-linux: 6256.2s -> 8830.2s (41.1%)
  2. aarch64-apple: 6631.7s -> 5565.9s (-16.1%)
  3. pr-check-1: 1408.2s -> 1633.9s (16.0%)
  4. x86_64-gnu-llvm-19-2: 6726.2s -> 5969.6s (-11.2%)
  5. armhf-gnu: 4891.9s -> 5399.5s (10.4%)
  6. dist-ohos-x86_64: 4112.2s -> 4431.7s (7.8%)
  7. dist-aarch64-msvc: 5421.6s -> 5807.4s (7.1%)
  8. dist-arm-linux-gnueabi: 4814.8s -> 5129.5s (6.5%)
  9. i686-gnu-2: 5667.7s -> 6037.6s (6.5%)
  10. dist-ohos-aarch64: 4173.3s -> 4434.1s (6.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 (9c27f27): 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.3% [0.1%, 1.4%] 61
Regressions ❌
(secondary)
0.6% [0.1%, 2.7%] 71
Improvements ✅
(primary)
-0.4% [-0.8%, -0.1%] 3
Improvements ✅
(secondary)
-0.9% [-2.9%, -0.2%] 21
All ❌✅ (primary) 0.3% [-0.8%, 1.4%] 64

Max RSS (memory usage)

Results (primary -1.3%, secondary -0.9%)

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)
1.2% [0.8%, 1.6%] 2
Improvements ✅
(primary)
-1.3% [-1.3%, -1.3%] 1
Improvements ✅
(secondary)
-1.6% [-2.6%, -1.1%] 6
All ❌✅ (primary) -1.3% [-1.3%, -1.3%] 1

Cycles

Results (primary -3.0%, secondary -1.5%)

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.7% [1.9%, 3.9%] 6
Improvements ✅
(primary)
-3.0% [-3.8%, -2.3%] 7
Improvements ✅
(secondary)
-4.7% [-8.3%, -2.5%] 8
All ❌✅ (primary) -3.0% [-3.8%, -2.3%] 7

Binary size

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

Bootstrap: 466.425s -> 467.433s (0.22%)
Artifact size: 387.38 MiB -> 387.54 MiB (0.04%)

@lcnr
Copy link
Contributor Author

lcnr commented Sep 9, 2025

Unfortunately an expected perf regression, spent a while trying to reduce the impact. Necessary for the new solver

@lcnr lcnr deleted the subrelations-infcx branch September 9, 2025 12:29
@Kobzol
Copy link
Member

Kobzol commented Sep 9, 2025

Marking as triaged.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Sep 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.

9 participants