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

Avoid a branch on key being local for queries that use the same local and extern providers #85830

Merged
merged 2 commits into from
Oct 26, 2021

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented May 30, 2021

Currently based on #85810 as it slightly conflicts with it. Only the last two commits are new.

@bjorn3 bjorn3 added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) labels May 30, 2021
@rust-highfive
Copy link
Collaborator

Some changes occured to rustc_codegen_cranelift

cc @bjorn3

@rust-highfive
Copy link
Collaborator

r? @petrochenkov

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 30, 2021
@bjorn3
Copy link
Member Author

bjorn3 commented May 30, 2021

@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 30, 2021
@bors
Copy link
Contributor

bors commented May 30, 2021

⌛ Trying commit 97e68edf5733b98351d0e6d43dac872661409cc0 with merge 9de0e79ac427d1d61a6e91b5c8cf50f66526d1f4...

@bors
Copy link
Contributor

bors commented May 30, 2021

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

@rust-timer
Copy link
Collaborator

Queued 9de0e79ac427d1d61a6e91b5c8cf50f66526d1f4 with parent 2023cc3, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (9de0e79ac427d1d61a6e91b5c8cf50f66526d1f4): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 30, 2021
@bjorn3
Copy link
Member Author

bjorn3 commented May 30, 2021

On average this is an improvement, but there is also a non-trivial amount of regressions. Maybe different inlining? Alternatively it could also be because of #85810. I will do a perf run there.

@petrochenkov
Copy link
Contributor

r? @cjgillot

@rust-log-analyzer

This comment has been minimized.

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.

I am not convinced yet that removing one branch is worth the added complexity. The branch itself should be optimized out.

Can we ensure statically that Key::query_crate can only return non-LOCAL_CRATE when separate_provide_extern is set? Should we even?

@@ -140,11 +140,11 @@ macro_rules! is_eval_always_attr {
}

macro_rules! contains_anon_attr {
($($attr:ident $(($($attr_args:tt)*))* ),*) => ({$(is_anon_attr!($attr) | )* false});
Copy link
Contributor

Choose a reason for hiding this comment

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

Can all these macros be simplified now?

@@ -56,7 +56,7 @@ macro_rules! provide {
$compute
})*

*providers = Providers {
*providers = ExternProviders {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this provide exhaustive now? Should it be made so?

Copy link
Member Author

Choose a reason for hiding this comment

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

Due to macro implementation issues I am using () as type for queries that don't have a separate extern provider.

@bjorn3
Copy link
Member Author

bjorn3 commented Jun 8, 2021

I am not convinced yet that removing one branch is worth the added complexity. The branch itself should be optimized out.

It has a side effect of for the most part documenting which queries are directly calculated from HIR and whose calculated value may be stored in the crate metadata and which are calculated in the current compilation session from other queries and configuration options.

@bors
Copy link
Contributor

bors commented Jun 15, 2021

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

@JohnCSimon
Copy link
Member

@rustbot label: -S-waiting-on-review +S-waiting-on-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 Jul 5, 2021
@JohnCSimon
Copy link
Member

triage:
@bjorn3 -can you please resolve the merge conflict?

@JohnCSimon JohnCSimon added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Sep 20, 2021
Manishearth added a commit to Manishearth/rust that referenced this pull request Oct 5, 2021
…-obk

Fix bug with query modifier parsing

The previous macro_rules! parsers failed when an additional modifier was added
with ambiguity errors. The error is pretty unclear as to what exactly the cause
here is, but this change simplifies the argument parsing code such that the
error is avoided.

Extracted from other work, and somewhat duplicates 0358edeb5 from rust-lang#85830, but
this approach seems a little simpler to me. Not technically currently necessary but seems
like a good cleanup.
Manishearth added a commit to Manishearth/rust that referenced this pull request Oct 5, 2021
…-obk

Fix bug with query modifier parsing

The previous macro_rules! parsers failed when an additional modifier was added
with ambiguity errors. The error is pretty unclear as to what exactly the cause
here is, but this change simplifies the argument parsing code such that the
error is avoided.

Extracted from other work, and somewhat duplicates 0358edeb5 from rust-lang#85830, but
this approach seems a little simpler to me. Not technically currently necessary but seems
like a good cleanup.
Manishearth added a commit to Manishearth/rust that referenced this pull request Oct 5, 2021
…-obk

Fix bug with query modifier parsing

The previous macro_rules! parsers failed when an additional modifier was added
with ambiguity errors. The error is pretty unclear as to what exactly the cause
here is, but this change simplifies the argument parsing code such that the
error is avoided.

Extracted from other work, and somewhat duplicates 0358edeb5 from rust-lang#85830, but
this approach seems a little simpler to me. Not technically currently necessary but seems
like a good cleanup.
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Oct 5, 2021
…-obk

Fix bug with query modifier parsing

The previous macro_rules! parsers failed when an additional modifier was added
with ambiguity errors. The error is pretty unclear as to what exactly the cause
here is, but this change simplifies the argument parsing code such that the
error is avoided.

Extracted from other work, and somewhat duplicates 0358edeb5 from rust-lang#85830, but
this approach seems a little simpler to me. Not technically currently necessary but seems
like a good cleanup.
@camelid
Copy link
Member

camelid commented Oct 8, 2021

triage: What's the status of this PR?

@JohnCSimon
Copy link
Member

Ping from triage:
@bjorn3
What is the status of this PR?

@bjorn3
Copy link
Member Author

bjorn3 commented Oct 25, 2021

Rebased. This is waiting on a decision if it should be merged in the first place.

@rust-log-analyzer

This comment has been minimized.

@cjgillot
Copy link
Contributor

After consideration, I think this PR is an opportunity for an eventual project to integrate metadata and queries.
@bors r+

@bors
Copy link
Contributor

bors commented Oct 25, 2021

📌 Commit 13abc1a has been approved by cjgillot

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 25, 2021
@bors
Copy link
Contributor

bors commented Oct 26, 2021

⌛ Testing commit 13abc1a with merge 17e13b5...

@bors
Copy link
Contributor

bors commented Oct 26, 2021

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing 17e13b5 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 26, 2021
@bors bors merged commit 17e13b5 into rust-lang:master Oct 26, 2021
@rustbot rustbot added this to the 1.58.0 milestone Oct 26, 2021
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #85830!

Tested on commit 17e13b5.
Direct link to PR: #85830

💔 miri on windows: test-pass → build-fail (cc @RalfJung @eddyb @oli-obk).
💔 miri on linux: test-pass → build-fail (cc @RalfJung @eddyb @oli-obk).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Oct 26, 2021
Tested on commit rust-lang/rust@17e13b5.
Direct link to PR: <rust-lang/rust#85830>

💔 miri on windows: test-pass → build-fail (cc @RalfJung @eddyb @oli-obk).
💔 miri on linux: test-pass → build-fail (cc @RalfJung @eddyb @oli-obk).
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (17e13b5): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

@bjorn3 bjorn3 deleted the separate_provide_extern branch October 26, 2021 08:48
@bjorn3 bjorn3 mentioned this pull request Oct 26, 2021
bors added a commit to rust-lang/miri that referenced this pull request Oct 26, 2021
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.