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

Make local query providers receive local keys #109092

Merged
merged 6 commits into from
Mar 21, 2023

Conversation

compiler-errors
Copy link
Member

When a query is marked separate_provide_extern, we can map a query key to a "local" form of the key, e.g. DefId -> LocalDefId. This simplifies a ton of code which either has to assert or use something like expect_local to assert that the query key is local.

@rustbot
Copy link
Collaborator

rustbot commented Mar 13, 2023

r? @cjgillot

(rustbot has picked a reviewer for you, use r? to override)

@compiler-errors
Copy link
Member Author

@bors try @rust-timer queue

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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. labels Mar 13, 2023
@rust-timer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Mar 13, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

The Miri subtree was changed

cc @rust-lang/miri

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occured in rustc_ty_utils::consts.rs

cc @BoxyUwU

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 13, 2023
@bors
Copy link
Contributor

bors commented Mar 13, 2023

⌛ Trying commit 2a66c2b1ad8880024ad069b8c969102c23781708 with merge 0663769d33256fffe4d0e10d24119cb4cf2404be...

Copy link
Member

@Noratrieb Noratrieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! One small improvement

compiler/rustc_middle/src/query/keys.rs Outdated Show resolved Hide resolved
@compiler-errors
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Mar 13, 2023

⌛ Trying commit 9d2e1e07e89ebca3fe47fe9c5b742d789ff406ae with merge af096b934d3640666c1dcc82186802171479ffe0...

@compiler-errors
Copy link
Member Author

@bors try

sorry bors lol

@bors
Copy link
Contributor

bors commented Mar 13, 2023

⌛ Trying commit b3280e7dbaf7fb2950bc1fc51a6cd76e7c579e99 with merge ef8757fd3403378f1d31bbc8f9d428674b83ff13...

@bors
Copy link
Contributor

bors commented Mar 14, 2023

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ef8757fd3403378f1d31bbc8f9d428674b83ff13): comparison URL.

Overall result: ❌✅ regressions and improvements - 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)
0.5% [0.4%, 0.6%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.7% [-0.7%, -0.7%] 1
All ❌✅ (primary) 0.5% [0.4%, 0.6%] 3

Max RSS (memory usage)

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

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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.0% [-5.8%, -4.1%] 4
All ❌✅ (primary) - - 0

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 14, 2023
@compiler-errors
Copy link
Member Author

Noise? 🤔

Copy link
Contributor

@cjgillot cjgillot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a great cleanup!

compiler/rustc_middle/src/ty/query.rs Outdated Show resolved Hide resolved
@@ -45,14 +45,17 @@ pub trait Key: Sized {
}
}

pub trait AsLocalKey: Key {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a separate trait instead of your initial implementation using the Key trait?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that the as_local_key only has to be provided for the keys where we actually make use of it. This should make it a little easier to make sure that all of the impls are correct and not run into things like #109109 again.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, exactly what Nils said.

@cjgillot cjgillot 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 Mar 18, 2023
@bors
Copy link
Contributor

bors commented Mar 21, 2023

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

@cjgillot
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Mar 21, 2023

📌 Commit b1a957b has been approved by cjgillot

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 Mar 21, 2023
@bors
Copy link
Contributor

bors commented Mar 21, 2023

⌛ Testing commit b1a957b with merge 77d50a8...

@bors
Copy link
Contributor

bors commented Mar 21, 2023

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing 77d50a8 to master...

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (77d50a8): comparison URL.

Overall result: ✅ improvements - 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)
- - 0
Improvements ✅
(primary)
-0.5% [-0.6%, -0.4%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.5% [-0.6%, -0.4%] 2

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.1% [1.1%, 1.1%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.7% [-2.6%, -0.8%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.8% [-2.6%, 1.1%] 3

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants