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

new solver normalization improvements #117278

Merged
merged 6 commits into from
Nov 17, 2023
Merged

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Oct 27, 2023

cool beans

At the core of this PR is a try_normalize_ty which stops for rigid aliases by using commit_if_ok.

Reworks alias-relate to fully normalize both the lhs and rhs and then equate the resulting rigid (or inference) types. This fixes rust-lang/trait-system-refactor-initiative#68 by avoiding the exponential blowup. Also supersedes #116369 by only defining opaque types if the hidden type is rigid.

I removed the stability check in EvalCtxt::evaluate_goal due to rust-lang/trait-system-refactor-initiative#75. While I personally have opinions on how to fix it, that still requires further t-types/@nikomatsakis buy-in, so I removed that for now. Once we've decided on our approach there, we can revert this commit.

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 Oct 27, 2023
@lcnr lcnr force-pushed the try-normalize-ty branch from 275f894 to 2b2c4af Compare October 27, 2023 11:35
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr force-pushed the try-normalize-ty branch from 8315095 to c2c6400 Compare October 31, 2023 10:40
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 31, 2023
…er-errors

prepopulate opaque ty storage before using it

doesn't have any significant impact rn afaict, as we freely define new opaque types during MIR typeck.

It will be relevant with rust-lang#117278 and once we stop allowing the definition of new opaques in MIR typeck

r? `@compiler-errors`
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 1, 2023
Rollup merge of rust-lang#117439 - lcnr:prepopulate-earlier, r=compiler-errors

prepopulate opaque ty storage before using it

doesn't have any significant impact rn afaict, as we freely define new opaque types during MIR typeck.

It will be relevant with rust-lang#117278 and once we stop allowing the definition of new opaques in MIR typeck

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

bors commented Nov 1, 2023

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

@lcnr lcnr force-pushed the try-normalize-ty branch from e4a289b to f5f5ae0 Compare November 3, 2023 11:18
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr force-pushed the try-normalize-ty branch from f5f5ae0 to 51debd6 Compare November 3, 2023 13:37
@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member

still draft so marking author so it gets out of my review queue 😆

@rustbot author

@rustbot rustbot 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 Nov 6, 2023
@lcnr lcnr force-pushed the try-normalize-ty branch from d65c990 to d8b7f24 Compare November 9, 2023 10:21
@lcnr lcnr marked this pull request as ready for review November 9, 2023 10:21
@rustbot
Copy link
Collaborator

rustbot commented Nov 9, 2023

Some changes occurred to the core trait solver

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

@lcnr lcnr force-pushed the try-normalize-ty branch from d8b7f24 to 8ed725a Compare November 9, 2023 10:23
@lcnr lcnr force-pushed the try-normalize-ty branch from 8ed725a to fce71ad Compare November 9, 2023 10:33
@lcnr
Copy link
Contributor Author

lcnr commented Nov 10, 2023

@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 Nov 10, 2023
@compiler-errors
Copy link
Member

🆒 @bors r+

@bors
Copy link
Contributor

bors commented Nov 16, 2023

📌 Commit fce71ad has been approved by compiler-errors

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 Nov 16, 2023
@bors
Copy link
Contributor

bors commented Nov 17, 2023

⌛ Testing commit fce71ad with merge 78efca8...

@bors
Copy link
Contributor

bors commented Nov 17, 2023

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing 78efca8 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 17, 2023
@bors bors merged commit 78efca8 into rust-lang:master Nov 17, 2023
12 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Nov 17, 2023
@lcnr lcnr deleted the try-normalize-ty branch November 17, 2023 12:23
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (78efca8): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -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)
- - 0
Regressions ❌
(secondary)
1.5% [0.7%, 2.4%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

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.7% [1.0%, 2.3%] 2
Regressions ❌
(secondary)
1.4% [1.1%, 1.7%] 5
Improvements ✅
(primary)
-2.0% [-2.3%, -1.7%] 2
Improvements ✅
(secondary)
-2.9% [-2.9%, -2.9%] 1
All ❌✅ (primary) -0.2% [-2.3%, 2.3%] 4

Cycles

Results

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
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.8% [0.8%, 0.8%] 1

Binary size

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

Bootstrap: 675.386s -> 676.982s (0.24%)
Artifact size: 313.58 MiB -> 313.61 MiB (0.01%)

@lqd
Copy link
Member

lqd commented Nov 17, 2023

Note for next week's triage if it comes up in the results: deep-vector is currently noisy, and this PR basically only changes the new solver which is disabled by default.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 11, 2024
Add some comments, add `can_define_opaque_ty` check to `try_normalize_ty_recur`

Follow-up from rust-lang#117278, since I was recently re-reviewing this code.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 11, 2024
Rollup merge of rust-lang#118915 - compiler-errors:alias-nits, r=lcnr

Add some comments, add `can_define_opaque_ty` check to `try_normalize_ty_recur`

Follow-up from rust-lang#117278, since I was recently re-reviewing this code.
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. 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.

alias-relate results in exponential blowup
7 participants