-
Notifications
You must be signed in to change notification settings - Fork 416
rr_nodes: add fan-in list generator #1592
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_nodes: add fan-in list generator #1592
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just have a few suggestions (most important of which is a not-loaded check).
I think we should also add a test of this to a unit test if possible (I think we have some rr-graph unit tests already, which would make this pretty easy to add).
vpr/src/route/rr_graph_storage.h
Outdated
@@ -633,6 +645,9 @@ class t_rr_graph_storage { | |||
// Fan in counts for each RR node. | |||
vtr::vector<RRNodeId, t_edge_size> node_fan_in_; | |||
|
|||
// Fan in edges for each RR node. | |||
vtr::vector<RRNodeId, std::vector<RREdgeId>> node_fan_in_list_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's good to add a comment saying this data is only created on demand (not with the rest of the rr_graph) and can be destroyed on demand.
vpr/src/route/rr_graph_storage.h
Outdated
@@ -747,6 +764,11 @@ class t_rr_graph_view { | |||
return node_fan_in_[id]; | |||
} | |||
|
|||
/* Retrieve fan_in edges vector for RRNodeId. */ | |||
std::vector<RREdgeId> fan_in_list(RRNodeId id) const { | |||
return node_fan_in_list_[id]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should put a check for the fan_in_list not being loaded here (id out of vector range) with an error message saying it doesn't appear to be loaded.
vpr/src/route/rr_graph_storage.cpp
Outdated
node_fan_in_list_.shrink_to_fit(); | ||
|
||
//Walk the graph and increment fanin on all dwnstream nodes | ||
for (const auto& edge_id : edge_dest_node_.keys()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If node_fan_in (count of incoming edges) has already been loaded (should have been since we don't appear to have a separate free_ call for it) then you can make this a bit more memory-efficient by getting the right size of vector storage by doing something like the below before the main edge loop that loads the vectors.
for (const auto& edge_id : edge_dest_node_.keys()) {
node_fan_in_list_[edge_id].reserve(node_fan_in[edge_id];
}
vpr/src/route/rr_graph_storage.cpp
Outdated
@@ -393,6 +393,24 @@ void t_rr_graph_storage::init_fan_in() { | |||
} | |||
} | |||
|
|||
void t_rr_graph_storage::init_fan_in_list() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this can be computed using the public interface, just make this a utility class that lives outside of t_rr_graph_storage
completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think this can be computed using the public interface (unless I am missing something). This method requires the edge_dest_node_
vector, which is private to the graph storage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for_each_edge
should work here?
d1b53fc
to
8cea5b3
Compare
8cea5b3
to
1a7fd21
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Alessandro Comodi <[email protected]>
1a7fd21
to
73c5be9
Compare
Looks good to me. Merging. |
Signed-off-by: Alessandro Comodi [email protected]
Description
It might be useful to get only the fan-in edges of a certain destination node, and currently the RR graph APIs do not provide such a possibility.
This PR adds a fan-in list constructor and its destroyer so that the extra memory is freed once the purpose of the fan-in lists has been fulfilled.
Related Issue
Motivation and Context
How Has This Been Tested?
Types of changes
Checklist: