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

Add a query cache for dense local DefIds #69303

Closed
wants to merge 3 commits into from

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Feb 19, 2020

Waiting on #68988 to land for a perf run.

r? @eddyb

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 19, 2020
@Zoxc Zoxc force-pushed the query-caches-apply branch from e4a34ca to 948880c Compare February 20, 2020 11:00
@Zoxc
Copy link
Contributor Author

Zoxc commented Feb 20, 2020

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Feb 20, 2020

⌛ Trying commit 948880c95b0e5c8501c490bf18b5f06ea557acc7 with merge 26c75c5e3b892d085b4815677fd07f9f84583c4c...

@bors
Copy link
Contributor

bors commented Feb 20, 2020

☀️ Try build successful - checks-azure
Build commit: 26c75c5e3b892d085b4815677fd07f9f84583c4c (26c75c5e3b892d085b4815677fd07f9f84583c4c)

@rust-timer
Copy link
Collaborator

Queued 26c75c5e3b892d085b4815677fd07f9f84583c4c with parent de362d8, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 26c75c5e3b892d085b4815677fd07f9f84583c4c, comparison URL.

@Centril
Copy link
Contributor

Centril commented Mar 11, 2020

Looks like perf was regressed?

@Dylan-DPC-zz Dylan-DPC-zz 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 11, 2020
@Zoxc Zoxc force-pushed the query-caches-apply branch from 948880c to 9bac16a Compare March 16, 2020 09:22
@Zoxc
Copy link
Contributor Author

Zoxc commented Mar 16, 2020

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Mar 16, 2020

⌛ Trying commit 9bac16a with merge bbed581aa2e500028b8ff65f2f35aa8a64c00948...

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-7 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-03-16T09:23:02.1000826Z ========================== Starting Command Output ===========================
2020-03-16T09:23:02.1005073Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/a97f3e21-087c-44f0-b400-9445f7412c75.sh
2020-03-16T09:23:02.1005698Z 
2020-03-16T09:23:02.1010405Z ##[section]Finishing: Disable git automatic line ending conversion
2020-03-16T09:23:02.1030923Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69303/merge to s
2020-03-16T09:23:02.1034491Z Task         : Get sources
2020-03-16T09:23:02.1034816Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-16T09:23:02.1035132Z Version      : 1.0.0
2020-03-16T09:23:02.1035346Z Author       : Microsoft
---
2020-03-16T09:23:03.3028942Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-03-16T09:23:03.3043255Z ##[command]git config gc.auto 0
2020-03-16T09:23:03.3073297Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-03-16T09:23:03.3081111Z ##[command]git config --get-all http.proxy
2020-03-16T09:23:03.3092606Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/69303/merge:refs/remotes/pull/69303/merge
---
2020-03-16T09:59:53.9683560Z    Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
2020-03-16T09:59:55.4816292Z error: unnecessary parentheses around type
2020-03-16T09:59:55.4817705Z     --> src/librustc/query/mod.rs:78:20
2020-03-16T09:59:55.4818581Z      |
2020-03-16T09:59:55.4819520Z 38   | / rustc_queries! {
2020-03-16T09:59:55.4820644Z 39   | |     Other {
2020-03-16T09:59:55.4821927Z 40   | |         query trigger_delay_span_bug(key: DefId) -> () {
2020-03-16T09:59:55.4823357Z 41   | |             desc { "trigger a delay span bug" }
2020-03-16T09:59:55.4825131Z ...    |
2020-03-16T09:59:55.4826150Z 78   | |             storage(caches::LocalDenseDefIdCacheSelector<&'tcx HirOwner<'tcx>>)
2020-03-16T09:59:55.4828769Z ...    |
2020-03-16T09:59:55.4829543Z 1257 | |     }
2020-03-16T09:59:55.4830375Z 1258 | | }
2020-03-16T09:59:55.4830375Z 1258 | | }
2020-03-16T09:59:55.4836994Z      | |_- in this expansion of `rustc_query_append!`
2020-03-16T09:59:55.4838741Z     ::: src/librustc/ty/query/mod.rs:110:1
2020-03-16T09:59:55.4839403Z      |
2020-03-16T09:59:55.4839403Z      |
2020-03-16T09:59:55.4840152Z 110  |   rustc_query_append! { [define_queries!][<'tcx>] }
2020-03-16T09:59:55.4845195Z      |
2020-03-16T09:59:55.4845936Z      = note: `-D unused-parens` implied by `-D warnings`
2020-03-16T09:59:55.4853038Z 
2020-03-16T09:59:55.4881376Z error: unnecessary parentheses around type
2020-03-16T09:59:55.4881376Z error: unnecessary parentheses around type
2020-03-16T09:59:55.4882130Z     --> src/librustc/query/mod.rs:87:20
2020-03-16T09:59:55.4882743Z      |
2020-03-16T09:59:55.4883466Z 38   | / rustc_queries! {
2020-03-16T09:59:55.4884339Z 39   | |     Other {
2020-03-16T09:59:55.4885446Z 40   | |         query trigger_delay_span_bug(key: DefId) -> () {
2020-03-16T09:59:55.4886574Z 41   | |             desc { "trigger a delay span bug" }
2020-03-16T09:59:55.4887548Z ...    |
2020-03-16T09:59:55.4888661Z 87   | |             storage(caches::LocalDenseDefIdCacheSelector<&'tcx HirOwnerItems<'tcx>>)
2020-03-16T09:59:55.4891299Z ...    |
2020-03-16T09:59:55.4892052Z 1257 | |     }
2020-03-16T09:59:55.4893063Z 1258 | | }
2020-03-16T09:59:55.4893063Z 1258 | | }
2020-03-16T09:59:55.4894007Z      | |_- in this expansion of `rustc_query_append!`
2020-03-16T09:59:55.4895373Z     ::: src/librustc/ty/query/mod.rs:110:1
2020-03-16T09:59:55.4895962Z      |
2020-03-16T09:59:55.4895962Z      |
2020-03-16T09:59:55.4896733Z 110  |   rustc_query_append! { [define_queries!][<'tcx>] }
2020-03-16T09:59:55.4902303Z 
2020-03-16T10:00:11.0334921Z error: aborting due to 2 previous errors
2020-03-16T10:00:11.0335975Z 
2020-03-16T10:00:11.0336717Z error: could not compile `rustc`.
---
2020-03-16T10:00:29.0422398Z   local time: Mon Mar 16 10:00:29 UTC 2020
2020-03-16T10:00:29.5975731Z   network time: Mon, 16 Mar 2020 10:00:29 GMT
2020-03-16T10:00:29.5976335Z == end clock drift check ==
2020-03-16T10:00:30.1296762Z 
2020-03-16T10:00:30.1382695Z ##[error]Bash exited with code '1'.
2020-03-16T10:00:30.1399191Z ##[section]Finishing: Run build
2020-03-16T10:00:30.1519428Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69303/merge to s
2020-03-16T10:00:30.1525348Z Task         : Get sources
2020-03-16T10:00:30.1525762Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-16T10:00:30.1526128Z Version      : 1.0.0
2020-03-16T10:00:30.1526465Z Author       : Microsoft
2020-03-16T10:00:30.1526465Z Author       : Microsoft
2020-03-16T10:00:30.1526882Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-03-16T10:00:30.1527369Z ==============================================================================
2020-03-16T10:00:30.5460283Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-03-16T10:00:30.5537887Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/69303/merge to s
2020-03-16T10:00:30.5643817Z Cleaning up task key
2020-03-16T10:00:30.5645066Z Start cleaning up orphan processes.
2020-03-16T10:00:30.6947161Z Terminate orphan process: pid (3819) (python)
2020-03-16T10:00:30.7003760Z ##[section]Finishing: Finalize Job

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

@rust-highfive
Copy link
Collaborator

The job dist-x86_64-linux-alt of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-03-16T10:46:19.3153616Z    Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
2020-03-16T10:46:22.3793866Z error: unnecessary parentheses around type
2020-03-16T10:46:22.3795511Z     --> src/librustc/query/mod.rs:78:20
2020-03-16T10:46:22.3796198Z      |
2020-03-16T10:46:22.3796946Z 38   | / rustc_queries! {
2020-03-16T10:46:22.3797855Z 39   | |     Other {
2020-03-16T10:46:22.3799148Z 40   | |         query trigger_delay_span_bug(key: DefId) -> () {
2020-03-16T10:46:22.3800576Z 41   | |             desc { "trigger a delay span bug" }
2020-03-16T10:46:22.3801424Z ...    |
2020-03-16T10:46:22.3802461Z 78   | |             storage(caches::LocalDenseDefIdCacheSelector<&'tcx HirOwner<'tcx>>)
2020-03-16T10:46:22.3805077Z ...    |
2020-03-16T10:46:22.3805838Z 1257 | |     }
2020-03-16T10:46:22.3806692Z 1258 | | }
2020-03-16T10:46:22.3806692Z 1258 | | }
2020-03-16T10:46:22.3807639Z      | |_- in this expansion of `rustc_query_append!`
2020-03-16T10:46:22.3809013Z     ::: src/librustc/ty/query/mod.rs:110:1
2020-03-16T10:46:22.3809637Z      |
2020-03-16T10:46:22.3809637Z      |
2020-03-16T10:46:22.3810404Z 110  |   rustc_query_append! { [define_queries!][<'tcx>] }
2020-03-16T10:46:22.3812273Z      |
2020-03-16T10:46:22.3813031Z      = note: `-D unused-parens` implied by `-D warnings`
2020-03-16T10:46:22.3813412Z 
2020-03-16T10:46:22.3847681Z error: unnecessary parentheses around type
2020-03-16T10:46:22.3847681Z error: unnecessary parentheses around type
2020-03-16T10:46:22.3848561Z     --> src/librustc/query/mod.rs:87:20
2020-03-16T10:46:22.3849169Z      |
2020-03-16T10:46:22.3849932Z 38   | / rustc_queries! {
2020-03-16T10:46:22.3850831Z 39   | |     Other {
2020-03-16T10:46:22.3851914Z 40   | |         query trigger_delay_span_bug(key: DefId) -> () {
2020-03-16T10:46:22.3853094Z 41   | |             desc { "trigger a delay span bug" }
2020-03-16T10:46:22.3853892Z ...    |
2020-03-16T10:46:22.3854962Z 87   | |             storage(caches::LocalDenseDefIdCacheSelector<&'tcx HirOwnerItems<'tcx>>)
2020-03-16T10:46:22.3857875Z ...    |
2020-03-16T10:46:22.3858650Z 1257 | |     }
2020-03-16T10:46:22.3859497Z 1258 | | }
2020-03-16T10:46:22.3859497Z 1258 | | }
2020-03-16T10:46:22.3860521Z      | |_- in this expansion of `rustc_query_append!`
2020-03-16T10:46:22.3861979Z     ::: src/librustc/ty/query/mod.rs:110:1
2020-03-16T10:46:22.3862587Z      |
2020-03-16T10:46:22.3862587Z      |
2020-03-16T10:46:22.3863368Z 110  |   rustc_query_append! { [define_queries!][<'tcx>] }
2020-03-16T10:46:22.3864940Z 
2020-03-16T10:46:36.2374925Z error: aborting due to 2 previous errors
2020-03-16T10:46:36.2375218Z 
2020-03-16T10:46:42.4615748Z    Compiling rustc_ast_passes v0.0.0 (/checkout/src/librustc_ast_passes)
---
2020-03-16T10:47:07.3362261Z   local time: Mon Mar 16 10:47:07 UTC 2020
2020-03-16T10:47:07.9478792Z   network time: Mon, 16 Mar 2020 10:47:07 GMT
2020-03-16T10:47:07.9479250Z == end clock drift check ==
2020-03-16T10:47:08.5047517Z 
2020-03-16T10:47:08.5147377Z ##[error]Bash exited with code '1'.
2020-03-16T10:47:08.5238686Z ##[section]Starting: Checkout rust-lang/rust@try to s
2020-03-16T10:47:08.5244791Z ==============================================================================
2020-03-16T10:47:08.5245212Z Task         : Get sources
2020-03-16T10:47:08.5245649Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

@Zoxc
Copy link
Contributor Author

Zoxc commented Mar 16, 2020

@bors try

@bors
Copy link
Contributor

bors commented Mar 16, 2020

⌛ Trying commit 40567e6 with merge 62c144a0ca9aff8af0b2c73b944dd21cca2f0007...

}

#[derive(Default)]
pub struct DefaultCache;
pub struct DefaultCache<D>(PhantomData<D>);
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this generic parameter D do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Avoids compiler errors for the pub type LocalDenseDefIdCacheSelector<V> alias.

@bors
Copy link
Contributor

bors commented Mar 16, 2020

☀️ Try build successful - checks-azure
Build commit: 62c144a0ca9aff8af0b2c73b944dd21cca2f0007 (62c144a0ca9aff8af0b2c73b944dd21cca2f0007)

@rust-timer
Copy link
Collaborator

Queued 62c144a0ca9aff8af0b2c73b944dd21cca2f0007 with parent 97eda01, future comparison URL.

@joelpalmer joelpalmer 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 30, 2020
@joelpalmer joelpalmer 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 9, 2020
@Dylan-DPC-zz
Copy link

@Zoxc can you resolve conflicts? we can get this reviewed

@eddyb

This comment has been minimized.

@Zoxc
Copy link
Contributor Author

Zoxc commented Apr 9, 2020

@eddyb Is this not what you had in mind?

@eddyb
Copy link
Member

eddyb commented Apr 9, 2020

@Zoxc Oops, I failed to read which PR this was on, for some reason I thought this one landed.

@eddyb
Copy link
Member

eddyb commented Apr 9, 2020

r=me after rebase

@Zoxc
Copy link
Contributor Author

Zoxc commented Apr 9, 2020

Perf is still an issue with this one though =P

@@ -75,6 +75,7 @@ rustc_queries! {
// This can be conveniently accessed by methods on `tcx.hir()`.
// Avoid calling this query directly.
query hir_owner(key: DefId) -> &'tcx HirOwner<'tcx> {
Copy link
Member

Choose a reason for hiding this comment

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

Change the query keys to LocalDefId, then you won't have any is_local checks, maybe that helps?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are LocalDefId in master now. I don't expect removing a single branch to help much though.

@nikomatsakis
Copy link
Contributor

Closing this pull request as Zoxc is stepping back from compiler development; see rust-lang/team#316.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants