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

incr.comp.: Move task result fingerprinting into DepGraph. #44696

Merged
merged 5 commits into from
Sep 22, 2017

Conversation

michaelwoerister
Copy link
Member

This PR

  • makes the DepGraph store all Fingerprints of task results,
  • allows DepNode to be marked as input nodes,
  • makes HIR node hashing use the regular fingerprinting infrastructure,
  • removes the now unused IncrementalHashesMap, and
  • makes sure that traits_in_scope_map fingerprints are stable.

r? @nikomatsakis
cc @alexcrichton

@michaelwoerister michaelwoerister force-pushed the fingerprints-in-dep-graph-3 branch from 58ed8f0 to 5196547 Compare September 19, 2017 13:11
@arielb1 arielb1 added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 19, 2017
Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

r=me modulo nits

@@ -66,7 +66,7 @@ impl<'q> Predecessors<'q> {
// Reduce the graph to the most important nodes.
let compress::Reduction { graph, input_nodes } =
compress::reduce_graph(&query.graph,
|n| HashContext::is_hashable(tcx, n),
|n| n.kind.is_input(),
Copy link
Contributor

Choose a reason for hiding this comment

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

neat

@@ -26,7 +26,8 @@ use super::edges::{DepGraphEdges, DepNodeIndex};

#[derive(Clone)]
pub struct DepGraph {
data: Option<Rc<DepGraphData>>
data: Option<Rc<DepGraphData>>,
fingerprints: Rc<RefCell<FxHashMap<DepNode, Fingerprint>>>
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use a DepNodeIndex and make this a vector?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess not, because it is still used when incremental is disabled -- can you add some comments to that effect?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe we can at some point, but I didn't want to complicate things. Note that not all DepNode have an associated Fingerprint (e.g. anonymous nodes). Last time I checked, there where 15% anonymous nodes, which would result in an OK fill rate for a vector.

Anyway, I want to revisit this once we see how the rest of the system shakes out.

Copy link
Member Author

Choose a reason for hiding this comment

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

Plus I'll add a comment for the meantime :)

@bors
Copy link
Contributor

bors commented Sep 20, 2017

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

@michaelwoerister michaelwoerister force-pushed the fingerprints-in-dep-graph-3 branch from 5196547 to 9798a88 Compare September 20, 2017 09:34
@michaelwoerister
Copy link
Member Author

@bors r=nikomatsakis

Comment added.

@bors
Copy link
Contributor

bors commented Sep 20, 2017

📌 Commit 9798a88 has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Sep 22, 2017

⌛ Testing commit 9798a88 with merge 14039a4...

bors added a commit that referenced this pull request Sep 22, 2017
…r=nikomatsakis

incr.comp.: Move task result fingerprinting into DepGraph.

This PR
- makes the DepGraph store all `Fingerprints` of task results,
- allows `DepNode` to be marked as input nodes,
- makes HIR node hashing use the regular fingerprinting infrastructure,
- removes the now unused `IncrementalHashesMap`, and
- makes sure that `traits_in_scope_map` fingerprints are stable.

r? @nikomatsakis
cc @alexcrichton
@bors
Copy link
Contributor

bors commented Sep 22, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 14039a4 to master...

@bors bors merged commit 9798a88 into rust-lang:master Sep 22, 2017
@bors bors mentioned this pull request Sep 22, 2017
3 tasks
bors added a commit that referenced this pull request Sep 24, 2017
incr.comp.: Add new DepGraph implementation.

This commits does a few things:
1. It adds the new dep-graph implementation -- *in addition* to the old one. This way we can start testing the new implementation without switching all tests at once.
2. It persists the new dep-graph (which includes query result fingerprints) to the incr. comp. caching directory and also loads this data.
3. It removes support for loading fingerprints of metadata imported from other crates (except for when running autotests). This is not needed anymore with red/green. It could provide a performance advantage but that's yet to be determined. For now, as red/green is not fully implemented yet, the cross-crate incremental tests are disabled.

Note, this PR is based on top of soon-to-be-merged #44696 and only the last 4 commits are new:
```
- incr.comp.: Initial implemenation of append-only dep-graph. (c90147c)
- incr.comp.: Do some various cleanup. (8ce20c5)
- incr.comp.: Serialize and deserialize new DepGraph. (0e13c1a)
- incr.comp.: Remove support for loading metadata fingerprints. (270a134)
EDIT 2:
- incr.comp.: Make #[rustc_dirty/clean] test for fingerprint equality ... (d8f7ff9)
```
(EDIT: GH displays the commits in the wrong order for some reason)

Also note that this PR is expected to certainly result in performance regressions in the incr. comp. test cases, since we are adding quite a few things (a whole additional dep-graph, for example) without removing anything. End-to-end performance measurements will only make sense again after red/green is enabled and all the legacy tracking has been turned off.

EDIT 2: Pushed another commit that makes the `#[rustc_dirty]`/`#[rustc_clean]` based autotests compared query result fingerprints instead of testing `DepNode` existence.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants