Skip to content

Finish Up Driver Dependency Graph Serialization #455

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

Merged
merged 6 commits into from
Feb 1, 2021

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Feb 1, 2021

  • Serialize external dependencies
  • Serialize uses-by-defs

The hashable bound on both key and value for many of the maps implies a derivable Equatable instance that we can pick up.
Also fix a bug where the some fidelity of external dependency nodes was lost because the base name of the path was used instead of the full file path.
Now that we serialize dep graph nodes in one shot, we no longer need this carry-over state.
This completes the serialization of the dependency graph.

The idea is to notice that the dependency key for a def may not always appear in the node map, but its uses certainly will (there are scattered invariants, especially in the tracer, that this is true). That means we'll be redundantly serializing nodes if we just naively write out the contents of the uses-by-defs map. Therefore, we establish a linear ordering of dependency nodes - in this case, serialization order - and record memoized node IDs. These are recorded instead, saving 6x the space of a regular serialized node.
@CodaFi CodaFi requested a review from davidungar February 1, 2021 21:35
@CodaFi
Copy link
Contributor Author

CodaFi commented Feb 1, 2021

@swift-ci test

@CodaFi
Copy link
Contributor Author

CodaFi commented Feb 1, 2021

@davidungar I believe this supersedes #450

@CodaFi
Copy link
Contributor Author

CodaFi commented Feb 1, 2021

Now that we've got the internals nailed down, the remaining concerns I have revolve around serialization orders being run-dependent. I don't know how much it matters in practice yet since the legacy driver didn't really pay much mind here for source file dependency graphs.

Copy link
Contributor

@davidungar davidungar left a comment

Choose a reason for hiding this comment

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

I just gave it a quick look & it looks great! Glad to have it. Thanks.

@CodaFi
Copy link
Contributor Author

CodaFi commented Feb 1, 2021

@CodaFi CodaFi merged commit 34b5ff7 into swiftlang:main Feb 1, 2021
@CodaFi CodaFi deleted the spirograph branch February 1, 2021 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants