Skip to content
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

rustdoc: use the next solver for blanket impl synthesis #125907

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fmease
Copy link
Member

@fmease fmease commented Jun 3, 2024

Presumably due to better caching behavior, switching from the old to the next solver drastically improves the compile time on certain inputs. See #114891.
Fixes #114891.

Furthermore use an ObligationCtxt instead of operating on an InferCtxt directly and don't drop the obligations generated by the type relating.

For context, originally I just wanted to submit the infcx→ocx change. However, that regressed tests/rustdoc-ui/ice-blanket-impl-52873.rs (pass→overflow error) because with ocx.select_where_possible we would no longer suppress / defatalize (canonical) overflow errors. CC #54199 which introduced that special case. Obviously in the next solver overflows are non-fatal incl. ice-blanket-impl-52873.rs. Hence the switch now.

S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. on perf improvements for the next solver.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jun 3, 2024
@fmease fmease added the S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. label Jun 3, 2024
@fmease
Copy link
Member Author

fmease commented Jun 3, 2024

@bors try @rust-timer queue

@rust-timer

This comment was marked as resolved.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 3, 2024
@fmease
Copy link
Member Author

fmease commented Jun 3, 2024

I guess I'll also do a crater run 🤔? I don't want to accidentally make rustdoc hang or ice for half the ecosystem.

@fmease

This comment was marked as resolved.

@bors

This comment was marked as resolved.

@fmease
Copy link
Member Author

fmease commented Jun 3, 2024

Let's try again. Bors, please respond this time around!

@bors try @rust-timer queue

@rust-timer

This comment was marked as resolved.

@fmease

This comment was marked as resolved.

@bors

This comment was marked as resolved.

@fmease
Copy link
Member Author

fmease commented Jun 3, 2024

@bors try

@bors
Copy link
Contributor

bors commented Jun 3, 2024

⌛ Trying commit 737b8ac with merge dcbecf2...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 3, 2024
…t, r=<try>

rustdoc: use the next solver for blanket impl synthesis

Furthermore use an `ObligationCtxt` instead of operating on an `InferCtxt` directly and don't drop the obligations generated by the type relating (fixes a FIXME).

Originally I just wanted to submit the infcx→ocx change. However, that regressed `tests/rustdoc-ui/ice-blanket-impl-52873.rs` (pass→overflow error) because with `ocx.select_where_possible` we would no longer suppress / defatalize (canonical) overflow errors on the last obligation we register. CC rust-lang#54199 which introduced that special case. Obviously in the next solver overflows are non-fatal incl. `ice-blanket-impl-52873.rs`. Hence the switch now.

Note that I wanted to hold off on switching to the new solver since it makes rust-lang#114891 go from long I-compiletime to I-compilemem + I-hang + eventual death by the OOM killer. So I don't know maybe we should block this PR on me finding a rustc reproducer for the rustdoc issue rust-lang#114891 (this is on my agenda) to be able to properly investigate the underlying next-solver issue.
@bors
Copy link
Contributor

bors commented Jun 3, 2024

☀️ Try build successful - checks-actions
Build commit: dcbecf2 (dcbecf205cd3ecd75a91d7290ac77e62f9c4bad2)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (dcbecf2): comparison URL.

Overall result: ❌ regressions - 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.

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 a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
988.1% [0.6%, 18344.5%] 19
Regressions ❌
(secondary)
5.4% [1.0%, 11.2%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 988.1% [0.6%, 18344.5%] 19

Max RSS (memory usage)

Results (primary 23.3%, secondary 5.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)
23.3% [3.5%, 54.7%] 11
Regressions ❌
(secondary)
5.2% [4.4%, 6.1%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 23.3% [3.5%, 54.7%] 11

Cycles

Results (primary 824.6%, secondary 7.0%)

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)
824.6% [2.2%, 13651.3%] 17
Regressions ❌
(secondary)
11.5% [10.8%, 12.2%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.0% [-2.0%, -2.0%] 1
All ❌✅ (primary) 824.6% [2.2%, 13651.3%] 17

Binary size

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

Bootstrap: 667.872s -> 669.107s (0.18%)
Artifact size: 318.92 MiB -> 318.92 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 Jun 3, 2024
@fmease
Copy link
Member Author

fmease commented Jun 3, 2024

okay lol, that is crazy

jieyouxu added a commit to jieyouxu/rust that referenced this pull request Jun 3, 2024
…ket-impls, r=GuillaumeGomez

rustdoc: add a regression test for a former blanket impl synthesis ICE

Fixes rust-lang#119792 (also passes in rust-lang#125907 in case you were wondering).

r? rustdoc
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 3, 2024
…ket-impls, r=GuillaumeGomez

rustdoc: add a regression test for a former blanket impl synthesis ICE

Fixes rust-lang#119792 (also passes in rust-lang#125907 in case you were wondering).

r? rustdoc
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 3, 2024
…ket-impls, r=GuillaumeGomez

rustdoc: add a regression test for a former blanket impl synthesis ICE

Fixes rust-lang#119792 (also passes in rust-lang#125907 in case you were wondering).

r? rustdoc
Noratrieb added a commit to Noratrieb/rust that referenced this pull request Jun 4, 2024
…ket-impls, r=GuillaumeGomez

rustdoc: add a regression test for a former blanket impl synthesis ICE

Fixes rust-lang#119792 (also passes in rust-lang#125907 in case you were wondering).

r? rustdoc
Noratrieb added a commit to Noratrieb/rust that referenced this pull request Jun 4, 2024
…ket-impls, r=GuillaumeGomez

rustdoc: add a regression test for a former blanket impl synthesis ICE

Fixes rust-lang#119792 (also passes in rust-lang#125907 in case you were wondering).

r? rustdoc
@rust-log-analyzer

This comment has been minimized.

@fmease fmease added the rla-silenced Silences rust-log-analyzer postings to the PR it's added on. label Aug 15, 2024
@fmease fmease force-pushed the rustdoc-synth-blanket-ocx-next branch from 18b8f6b to e1e3180 Compare August 15, 2024 11:16
@fmease
Copy link
Member Author

fmease commented Aug 15, 2024

@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 Aug 15, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 15, 2024
…t, r=<try>

rustdoc: use the next solver for blanket impl synthesis

Furthermore use an `ObligationCtxt` instead of operating on an `InferCtxt` directly and don't drop the obligations generated by the type relating.

Originally I just wanted to submit the infcx→ocx change. However, that regressed `tests/rustdoc-ui/ice-blanket-impl-52873.rs` (pass→overflow error) because with `ocx.select_where_possible` we would no longer suppress / defatalize (canonical) overflow errors. CC rust-lang#54199 which introduced that special case. Obviously in the next solver overflows are non-fatal incl. `ice-blanket-impl-52873.rs`. Hence the switch now.

~~Note that I wanted to hold off on switching to the new solver since it makes rust-lang#114891 go from long I-compiletime to I-compilemem + I-hang + eventual death by the OOM killer. So I don't know maybe we should block this PR on me finding a rustc reproducer for the rustdoc issue rust-lang#114891 (this is on my agenda) to be able to properly investigate the underlying next-solver issue.~~

Fixes rust-lang#114891.
@bors
Copy link
Contributor

bors commented Aug 15, 2024

⌛ Trying commit e1e3180 with merge c9f5be2...

@bors
Copy link
Contributor

bors commented Aug 15, 2024

☀️ Try build successful - checks-actions
Build commit: c9f5be2 (c9f5be263f484d4930b7c37ef7bd737451891d8c)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c9f5be2): comparison URL.

Overall result: ❌ regressions - 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.

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 a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
9.7% [0.8%, 46.3%] 17
Regressions ❌
(secondary)
2.0% [0.4%, 5.1%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 9.7% [0.8%, 46.3%] 17

Max RSS (memory usage)

Results (primary 4.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)
4.9% [1.6%, 15.5%] 9
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 4.9% [1.6%, 15.5%] 9

Cycles

Results (primary 11.2%, secondary 4.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)
11.2% [2.3%, 33.7%] 12
Regressions ❌
(secondary)
4.3% [3.6%, 5.1%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 11.2% [2.3%, 33.7%] 12

Binary size

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

Bootstrap: 751.515s -> 752.426s (0.12%)
Artifact size: 339.18 MiB -> 339.16 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 15, 2024
@GuillaumeGomez
Copy link
Member

That's quite a big regression. Do you have ideas on how to limit it or is it not possible for the moment?

@lcnr
Copy link
Contributor

lcnr commented Aug 15, 2024

the following PRs will likely reduce the perf impact here:

@lcnr
Copy link
Contributor

lcnr commented Aug 15, 2024

That's quite a big regression. Do you have ideas on how to limit it or is it not possible for the moment?

we still haven't optimized the new solver at all really apart from making sure the architecture itself is able to be performant, so there are still a lot of low-hanging fruits in the new solver.

@GuillaumeGomez
Copy link
Member

Thanks for the information! Don't hesitate if there is anything I can help with.

@fmease fmease added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 21, 2024
@fmease fmease force-pushed the rustdoc-synth-blanket-ocx-next branch from e1e3180 to c32dd09 Compare October 16, 2024 12:18
@fmease
Copy link
Member Author

fmease commented Oct 16, 2024

@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 Oct 16, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 16, 2024
…t, r=<try>

rustdoc: use the next solver for blanket impl synthesis

Presumably due to better caching behavior, switching from the old to the next solver *drastically* improves the compile time on certain inputs. See rust-lang#114891.
Fixes rust-lang#114891.

Furthermore use an `ObligationCtxt` instead of operating on an `InferCtxt` directly and don't drop the obligations generated by the type relating.

For context, originally I just wanted to submit the infcx→ocx change. However, that regressed `tests/rustdoc-ui/ice-blanket-impl-52873.rs` (pass→overflow error) because with `ocx.select_where_possible` we would no longer suppress / defatalize (canonical) overflow errors. CC rust-lang#54199 which introduced that special case. Obviously in the next solver overflows are non-fatal incl. `ice-blanket-impl-52873.rs`. Hence the switch now.

https://github.com/rust-lang/rust/labels/S-blocked on perf improvements for the next solver.
@bors
Copy link
Contributor

bors commented Oct 16, 2024

⌛ Trying commit c32dd09 with merge 9daeecb...

@bors
Copy link
Contributor

bors commented Oct 16, 2024

☀️ Try build successful - checks-actions
Build commit: 9daeecb (9daeecbe7b57dd50c95c08cc8ea2ecdf72c1876e)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9daeecb): 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)
10.0% [0.3%, 59.6%] 19
Regressions ❌
(secondary)
2.3% [0.5%, 5.8%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.6% [-1.6%, -1.6%] 1
All ❌✅ (primary) 10.0% [0.3%, 59.6%] 19

Max RSS (memory usage)

Results (primary 5.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)
5.1% [1.6%, 15.0%] 12
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.3% [-2.4%, -2.1%] 2
All ❌✅ (primary) 5.1% [1.6%, 15.0%] 12

Cycles

Results (primary 9.6%, secondary 4.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)
9.6% [0.6%, 42.0%] 17
Regressions ❌
(secondary)
4.7% [4.4%, 4.9%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 9.6% [0.6%, 42.0%] 17

Binary size

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

Bootstrap: 780.385s -> 781.632s (0.16%)
Artifact size: 333.66 MiB -> 333.65 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. rla-silenced Silences rust-log-analyzer postings to the PR it's added on. S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
7 participants