-
Notifications
You must be signed in to change notification settings - Fork 397
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
RR graph edge storage refactoring #1079
Comments
FYI @vaughnbetz / @kmurray this is the issue we were talking about @tangxifan This is issue is relevant to your refactoring. @tangxifan in particular, your first iteration (https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/master/vpr/src/device/rr_graph_obj.h#L804-L808) preserves this same 1 allocation per rr node. I'm going to be making several further posts fleshing out my notes on this change. |
Current usage of the edge interfacesAll rr node edge access is controlled by the There are 3 classes of methods:
Methods: Get node to edge relationshipsThere are 6 methods in this category:
Usage:
Notes:
Conclusions:
|
Methods: Get data for an edgeThere are 2 methods in this category:
These methods are currently basically key'd as |
Methods: Node to edge mutationThere are 5 methods in this category:
Usage:
Notes:
Conclusions:
|
Proposed refactoringThere are several parts to this, but here is the key idea:
Implementation details (post-partitioning)The implementation details post-partitioning are likely the easiest to describe. Edge data will be key'd by During edge partitioning, the flat edge data array will be sorted by the To make this concrete in some pseudo-code:
|
There are effectively 3 edge mutation paths, and the confusing thing is that the RR clock graph generator is located in an odd place and does the graph mutation in a weird way. The 3 edge mutation implementations are:
In general the |
This all sounds good to me!
If we take this approach, we'll have to think carefully about how to handle the dummy. There are a number of places which do loops like:
which could be tripped up by the dummy at the end.
This is a pretty clever way to eliminate the storage of num_nodes in t_rr_node. However it has two drawbacks which will need to be addressed:
My thoughts on whether the
The issue of who actually owns the edge data, and where its located is another issue to consider as well. To be consistent as currently implemented, it would make to stick it along side This ownership issue was part of the original motivation for the RRGraph object refactoring, where the graph owns both the nodes and edges, and hides the details of the underlying data layout. |
I've side stepped this entire problem by implementing a flyweight RR node and an rr node storage class (see #1084) and then having the rr node storage class handle this gracefully (#1085) |
No question, I've attempted to take an approach to the rr graph refactoring that is more incremental and can allow comparisons to changes along the way. |
Thanks for point this out. If separated storage of |
@tangxifan: @litghost had another good point in a recent meeting; possibly has already been discussed with you or posted, but in case not: Your WIP rr-graph data structure refactoring proposal would result in one more level of indirection in going from a node to its outgoing edges (the key operation in the router). node->start_edge_index->edges vs. the current node->edges (variable names made up here, but hopefully they get across the point). |
Got it. Let me try to apply this to the RRGraph data structure. |
Proposed Behaviour
The edge storage should be optimized for router behavior, which is driven by two concerns:
The current allocation strategy has poor memory locality, and requires a pointer per node.
Current Behaviour
Currently rr graph edges are stored in per node allocations. This is a reasonable solution when edges are being mutated, but once edges are fixed (either after rr graph construction or if the rr graph is read from file) having one allocation be node is overly flexible.
Possible Solution
Assuming that during writing, node edges are only written and never read, and afterwards node edges are only read and never written, a two phase data structure can be used.
Context
The text was updated successfully, but these errors were encountered: