2

Pass list of defineable opaque types into canonical queries by oli-obk · Pull Re...

 4 weeks ago
source link: https://github.com/rust-lang/rust/pull/122077
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Pass list of defineable opaque types into canonical queries #122077

Conversation

Contributor

This eliminates DefiningAnchor::Bubble for good and brings the old solver closer to the new one wrt cycles and nested obligations. At that point the difference between DefiningAnchor::Bind([]) and DefiningAnchor::Error was academic. We only used the difference for some sanity checks, which actually had to be worked around in places, so I just removed DefiningAnchor entirely and just stored the list of opaques that may be defined.

fixes #108498
fixes #116877

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

labels

Mar 6, 2024

This comment was marked as outdated.

This comment was marked as outdated.

rustbot

added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label

Mar 6, 2024

This comment was marked as outdated.

@@ -320,5 +320,6 @@ fn response_no_constraints_raw<'tcx>(

external_constraints: tcx.mk_external_constraints(ExternalConstraintsData::default()),

certainty,

},

defining_anchor: Default::default(),

Contributor

Author

This one is fishy, we can probably always pass in the anchor from the InferCtxt

let (infcx, key, canonical_inference_vars) = self

.with_opaque_type_inference(DefiningAnchor::Bubble)

.build_with_canonical(DUMMY_SP, canonical_key);

let (infcx, key, canonical_inference_vars) =

self.build_with_canonical(DUMMY_SP, canonical_key);

Contributor

Author

This is the core change of this PR. Canonical queries now always use the anchor of their caller

This comment was marked as resolved.

This comment was marked as resolved.

This comment has been minimized.

@@ -340,10 +340,10 @@ macro_rules! define_callbacks {

<$($K)* as keys::Key>::CacheSelector as CacheSelector<'tcx, Erase<$V>>

>::Cache;

// Ensure that keys grow no larger than 64 bytes

// Ensure that keys grow no larger than 72 bytes

Is this not a hard limit? Why was this added in the first place?

Contributor

Author

probably perf, but I'm trying to resolve it anyway before going out of draft. I looked up the original PR, and it was just for not accidentally growing

Contributor

Author

So I'm a bit stuck on CanonicalTypeOpAscribeUserTypeGoal. It's 8 bytes too large now, but there's also nothing that stands out as "this should be interned". Just moving something onto a TyCtxt arena doesn't really seem right to me, that's just avoiding the above size check without adhering to its spirit.

This comment was marked as outdated.

This comment has been minimized.

Contributor

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

Contributor

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

Contributor

Author

@bors try

Contributor

⌛ Trying commit cb7c75b with merge e34498b...

Contributor

Author

@bors r=lcnr rollup=never

Contributor

📌 Commit dc97b1e has been approved by lcnr

It is now in the queue for this repository.

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-author Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Apr 8, 2024

Contributor

⌛ Testing commit dc97b1e with merge b234e44...

Contributor

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

bors

added the merged-by-bors This PR was explicitly merged by bors. label

Apr 9, 2024

bors

merged commit b234e44 into

rust-lang:master

Apr 9, 2024

12 checks passed

rustbot

added this to the 1.79.0 milestone

Apr 9, 2024

Collaborator

Finished benchmarking commit (b234e44): comparison URL.

Overall result: ❌ regressions - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

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)
1.9% [0.2%, 5.4%] 101
Regressions ❌
(secondary)
2.3% [0.3%, 4.7%] 77
Improvements ✅
(primary)
-0.6% [-0.6%, -0.6%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.8% [-0.6%, 5.4%] 102

Max RSS (memory usage)

Results

Cycles

Results

Binary size

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

Bootstrap: 669.403s -> 674.046s (0.69%)
Artifact size: 318.50 MiB -> 318.46 MiB (-0.01%)

oli-obk

deleted the eager_opaque_checks4 branch

April 9, 2024 04:52

Contributor

Author

hmm weird, a previous perf run was clean. I must have changed something since then. I'll investigate.

Contributor

Author

Ah... dd72bf9

Scraping regions is expensive.

I'll implement an alternative. Let's not revert this PR, it's an important bugfix and blocker of a lot of follow up work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

compiler-errors

compiler-errors left review comments

aliemjay

aliemjay requested changes

lcnr

lcnr left review comments
Assignees

No one assigned

Labels
A-testsuite Area: The testsuite used to check the correctness of rustc disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. 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-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-types Relevant to the types team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative
Projects

None yet

Milestone

1.79.0

12 participants

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK