Skip to content

eagerly compute sub_relations again #140375

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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Apr 27, 2025

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

@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

@bors
Copy link
Collaborator

bors commented May 6, 2025

⌛ Trying commit 8eb514a with merge 8b3ed20...

bors added a commit to rust-lang-ci/rust that referenced this pull request May 6, 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`
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented May 6, 2025

☀️ Try build successful - checks-actions
Build commit: 8b3ed20 (8b3ed207167564e3513248833d6bc40fb83a4b72)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (8b3ed20): 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.1%, 1.5%] 84
Regressions ❌
(secondary)
0.4% [0.2%, 0.8%] 51
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [0.1%, 1.5%] 84

Max RSS (memory usage)

Results (primary -0.1%, 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)
2.0% [0.6%, 3.2%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.7% [-1.7%, -0.4%] 10
Improvements ✅
(secondary)
-2.3% [-2.7%, -2.1%] 3
All ❌✅ (primary) -0.1% [-1.7%, 3.2%] 13

Cycles

Results (primary 0.4%)

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.4%, 1.9%] 25
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.5% [-0.7%, -0.4%] 11
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [-0.7%, 1.9%] 36

Binary size

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

Bootstrap: 769.964s -> 770.666s (0.09%)
Artifact size: 365.50 MiB -> 365.34 MiB (-0.04%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 7, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request May 7, 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#140711
- rust-lang#140713
- rust-lang#140712
- 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
- look into blanket impls for opaque type infer vars as well
- rust-lang#140496
- double recursion limit in the new solver

r? `@ghost`
@lcnr
Copy link
Contributor Author

lcnr commented May 7, 2025

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 7, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request May 7, 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 May 7, 2025

⌛ Trying commit 1bf7f04 with merge a3b1b7c...

bors added a commit to rust-lang-ci/rust that referenced this pull request May 7, 2025
[PERF] eagerly compute `sub_relations` again

perf run for rust-lang#140375

r? ghost
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented May 7, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 7, 2025
@rust-cloud-vms rust-cloud-vms bot force-pushed the subrelations-infcx branch from 1bf7f04 to 53c24cb Compare May 7, 2025 17:30
@lcnr
Copy link
Contributor Author

lcnr commented May 7, 2025

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

bors added a commit to rust-lang-ci/rust that referenced this pull request May 7, 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 May 7, 2025

⌛ Trying commit 53c24cb with merge d2329c5...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-19 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#18 exporting to docker image format
#18 sending tarball 20.0s done
#18 DONE 26.8s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-19]
[CI_JOB_NAME=x86_64-gnu-llvm-19]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-19', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'build.print-step-timings', '--enable-verbose-tests', '--set', 'build.metrics', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--set', 'gcc.download-ci-gcc=true', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-19/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
   2:     0x7f386476cae9 - <std[db91a6d99c7f1cf2]::sys::stdio::unix::Stderr as std[db91a6d99c7f1cf2]::io::Write>::write_fmt
   3:     0x7f3864778e92 - <std[db91a6d99c7f1cf2]::sys::backtrace::BacktraceLock>::print
   4:     0x7f386477d4f1 - std[db91a6d99c7f1cf2]::panicking::default_hook::{closure#0}
   5:     0x7f386477d287 - std[db91a6d99c7f1cf2]::panicking::default_hook
   6:     0x7f3860443da3 - <alloc[2bd2ac7d1b4d7344]::boxed::Box<rustc_driver_impl[6924dacfd6b30e16]::install_ice_hook::{closure#1}> as core[7cbf36d1a8e6186a]::ops::function::Fn<(&dyn for<'a, 'b> core[7cbf36d1a8e6186a]::ops::function::Fn<(&'a std[db91a6d99c7f1cf2]::panic::PanicHookInfo<'b>,), Output = ()> + core[7cbf36d1a8e6186a]::marker::Send + core[7cbf36d1a8e6186a]::marker::Sync, &std[db91a6d99c7f1cf2]::panic::PanicHookInfo)>>::call
   7:     0x7f386477e077 - std[db91a6d99c7f1cf2]::panicking::rust_panic_with_hook
   8:     0x7f386477dcac - std[db91a6d99c7f1cf2]::panicking::begin_panic_handler::{closure#0}
   9:     0x7f38647795f9 - std[db91a6d99c7f1cf2]::sys::backtrace::__rust_end_short_backtrace::<std[db91a6d99c7f1cf2]::panicking::begin_panic_handler::{closure#0}, !>
  10:     0x7f386477d896 - __rustc[ec7fb6ce294bfd5b]::rust_begin_unwind
  11:     0x7f38603d50b0 - core[7cbf36d1a8e6186a]::panicking::panic_fmt
  12:     0x7f38603d508b - core[7cbf36d1a8e6186a]::option::expect_failed
  13:     0x7f386329cd88 - <rustc_infer[d2cdb5cfe5c7cc0f]::infer::InferCtxt>::instantiate_nll_query_response_and_region_obligations::<alloc[2bd2ac7d1b4d7344]::vec::Vec<rustc_middle[c2b98c63db645f01]::traits::query::OutlivesBound>>
  14:     0x7f386338c583 - rustc_trait_selection[c96837a1beeb38bb]::traits::outlives_bounds::implied_outlives_bounds

@rust-log-analyzer
Copy link
Collaborator

The job dist-x86_64-linux failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
file:.git/config remote.origin.url=https://github.com/rust-lang-ci/rust
file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
file:.git/config gc.auto=0
file:.git/config http.https://github.com/.extraheader=AUTHORIZATION: basic ***
file:.git/config branch.try.remote=origin
file:.git/config branch.try.merge=refs/heads/try
file:.git/config submodule.library/backtrace.active=true
file:.git/config submodule.library/backtrace.url=https://github.com/rust-lang/backtrace-rs.git
file:.git/config submodule.library/stdarch.active=true
file:.git/config submodule.library/stdarch.url=https://github.com/rust-lang/stdarch.git
file:.git/config submodule.src/doc/book.active=true
---
[RUSTC-TIMING] fluent_langneg test:false 0.419
   3:     0x7f36dcbf9052 - std::sys::backtrace::BacktraceLock::print::he8180f7f55f3b842
   4:     0x7f36dcbfce1c - std::panicking::default_hook::{{closure}}::hc1b532ec2262b49b
   5:     0x7f36dcbfcc1f - std::panicking::default_hook::hc9e8cc08aa8a6867
   6:     0x7f36d9e890de - std[875ca2e4757441df]::panicking::update_hook::<alloc[4a17c0b16eaf1993]::boxed::Box<rustc_driver_impl[a5c31e31cf9aa58b]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7f36dcbfd983 - std::panicking::rust_panic_with_hook::ha1cd71477b593eb5
   8:     0x7f36dcbfd63a - std::panicking::begin_panic_handler::{{closure}}::h20531a25291496b6
   9:     0x7f36dcbf9709 - std::sys::backtrace::__rust_end_short_backtrace::h6dfbb58c4ae504f2
  10:     0x7f36dcbfd2cd - __rustc[ec7fb6ce294bfd5b]::rust_begin_unwind
  11:     0x7f36dcc43270 - core::panicking::panic_fmt::h18655c03ee1a104d
  12:     0x7f36dcc4313b - core::option::expect_failed::hc0caae72c7fccacb
  13:     0x7f36dbf37900 - rustc_trait_selection[607c9fdf1ec85bb]::traits::outlives_bounds::implied_outlives_bounds

@bors
Copy link
Collaborator

bors commented May 7, 2025

💔 Test failed - checks-actions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-perf Status: Waiting on a perf run to be completed. 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