Make LinkedGraph modification order independent#151821
Open
zetanumbers wants to merge 6 commits intorust-lang:mainfrom
Open
Make LinkedGraph modification order independent#151821zetanumbers wants to merge 6 commits intorust-lang:mainfrom
zetanumbers wants to merge 6 commits intorust-lang:mainfrom
Conversation
Collaborator
This comment has been minimized.
This comment has been minimized.
Contributor
Author
|
Updated the issue's top comment to include detailed description of changes. |
f0938a3 to
1dd0c95
Compare
This comment has been minimized.
This comment has been minimized.
1dd0c95 to
264aa3a
Compare
Contributor
|
☔ The latest upstream changes (presumably #152156) made this pull request unmergeable. Please resolve the merge conflicts. |
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LinkedGraphis a graph data structure used byDepGraphQueryfor-Zquery-dep-graphand byRegionGraphfor lexical region resolution. CurrentDepGraphQueryimplementation is problematic for our parallel frontend as some edges could be added before their source or target nodes, which never happens in single-threaded mode. To solve this I've made two changes:DepGraphQuerylooks up its target node indep_index_to_indexto translate query system'sDepNodeIndexintoLinkedGraph's newtypeNodeIndexfor usize to index nodes. For bothDepGraphQueryandRegionGraphnodes correspond one-to-one toDepNodeIndex's andRegionVid's indices. Those types are defined by therustc_index::newtype_index!macro and implementIdxtrait, so instead of usingNodeIndexandVec<Node<N>>I've changed it to use a genericI: Idxtype andIndexVec<I, Node<N>>. Thus fielddep_index_to_indexis no longer required.LinkedGraphrequires its target and source nodes to already be present in the graph in order to construct a linked list of edge indices for fast iteration of edges. As such I've added code to postpone linked list construction in case source/target node was not present and countlinked_edgesup to now. Upon creation of anAdjacentEdgesiterator there's an assertion that every edge is linked.Fixes #142152