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

Reduce the amount of untracked state in TyCtxt -- Take 2 #85941

Merged
merged 2 commits into from
Jul 11, 2021

Conversation

cjgillot
Copy link
Contributor

@cjgillot cjgillot commented Jun 2, 2021

Main part of #85153

The offending line (#85153 (comment)) is replaced by a FIXME until the possible bug and the perf concern are both resolved.

r? @Aaron1011

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 2, 2021
@cjgillot
Copy link
Contributor Author

cjgillot commented Jun 2, 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 Jun 2, 2021
@bors
Copy link
Contributor

bors commented Jun 2, 2021

⌛ Trying commit 609c07e5216722be1655706bb77620c4b20dfffd with merge c092198bf63a05c1b2a7a273c62471ced18e3d23...

@bors
Copy link
Contributor

bors commented Jun 2, 2021

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

@rust-timer
Copy link
Collaborator

Queued c092198bf63a05c1b2a7a273c62471ced18e3d23 with parent 2f601ef, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (c092198bf63a05c1b2a7a273c62471ced18e3d23): 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 Jun 2, 2021
@Aaron1011 Aaron1011 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 Jun 3, 2021
@cjgillot
Copy link
Contributor Author

cjgillot commented Jun 4, 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 Jun 4, 2021
@bors
Copy link
Contributor

bors commented Jun 4, 2021

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout qresolve (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self qresolve --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Auto-merging compiler/rustc_middle/src/ty/print/pretty.rs
Auto-merging compiler/rustc_middle/src/ty/mod.rs
Auto-merging compiler/rustc_middle/src/ty/context.rs
CONFLICT (content): Merge conflict in compiler/rustc_middle/src/ty/context.rs
Auto-merging compiler/rustc_middle/src/query/mod.rs
Auto-merging compiler/rustc_metadata/src/rmeta/encoder.rs
Automatic merge failed; fix conflicts and then commit the result.

@cjgillot
Copy link
Contributor Author

cjgillot commented Jun 4, 2021

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@bors
Copy link
Contributor

bors commented Jun 4, 2021

⌛ Trying commit 82d52a7d9e8f17d28a95794f1c5c4b0bec7ef01c with merge 4b9cc4f754d1397c1c39dcb1398f8d1d647bbf8d...

@bors
Copy link
Contributor

bors commented Jun 4, 2021

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

@rust-timer
Copy link
Collaborator

Queued 4b9cc4f754d1397c1c39dcb1398f8d1d647bbf8d with parent 595088d, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (4b9cc4f754d1397c1c39dcb1398f8d1d647bbf8d): 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 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jun 4, 2021
@Aaron1011
Copy link
Member

@cjgillot: Are you planning to work on improving the performance further, or do you think it's okay as-is? Seeing as the regressions are small, and this is correctness-related, I think either option would be fine.

@@ -932,9 +940,15 @@ impl<'hir> intravisit::Map<'hir> for Map<'hir> {
pub(super) fn index_hir<'tcx>(tcx: TyCtxt<'tcx>, (): ()) -> &'tcx IndexedHir<'tcx> {
let _prof_timer = tcx.sess.prof.generic_activity("build_hir_map");

// We can access untracked state since we are an eval_always query.
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be good to enforce this in a follow-up PR - for example, moving the 'untracked' fields behind methods, which debug-assert that we're in an eval_always query.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (3ee1084b77128fa4b2b0232a3ed1aec844cf55c6): 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 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jun 20, 2021
@Aaron1011
Copy link
Member

The performance regressions are unfortunate - however, they're mostly small, and we were previously skipping necessary work.

@michaelwoerister Does this look good to you?

@cjgillot cjgillot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 22, 2021
@bors
Copy link
Contributor

bors commented Jun 30, 2021

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

@michaelwoerister
Copy link
Member

I'll take a look shortly.

@bors
Copy link
Contributor

bors commented Jul 6, 2021

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

@michaelwoerister
Copy link
Member

Yes, this looks correct to me. At some point I'd like to come up with a better argument than

// Accessing the DefPath is ok, since it is part of DefPathHash.

You can either belief that or not :)

I'm wondering if this interacts with rust-lang/compiler-team#437 (cc @jyn514).

Regarding the performance regressions: removing the eval_always attribute from many of those smaller queries might affect performance because (IIRC) we don't add dependency edges to eval_always since they would never be used anyway. You could try adding back eval_always (with a comment that it's a performance optimization) and do another perf run to find out.

@jyn514
Copy link
Member

jyn514 commented Jul 6, 2021

@michaelwoerister It would actually make it a good deal easier I think - it makes everything a lot more granular instead of needing access to the full definitions every time.

Note that MCP still isn't accepted :/ and I'm not sure it will be until the resolver is tracked by incremental, which I think is still a long way off.

@Aaron1011
Copy link
Member

r=me unless you want to try @michaelwoerister's suggestion of adding back eval_always.

@cjgillot
Copy link
Contributor Author

r=me unless you want to try @michaelwoerister's suggestion of adding back eval_always.

Overall, I am more inclined to remove eval_always rather than adding them.
@bors r=Aaron1011

@bors
Copy link
Contributor

bors commented Jul 11, 2021

📌 Commit 9f6d7e7 has been approved by Aaron1011

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

bors commented Jul 11, 2021

⌛ Testing commit 9f6d7e7 with merge 7256855...

@bors
Copy link
Contributor

bors commented Jul 11, 2021

☀️ Test successful - checks-actions
Approved by: Aaron1011
Pushing 7256855 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 11, 2021
@bors bors merged commit 7256855 into rust-lang:master Jul 11, 2021
@rustbot rustbot added this to the 1.55.0 milestone Jul 11, 2021
@cjgillot cjgillot deleted the qresolve branch July 11, 2021 19:15
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants