Skip to content

Deploy RRGraphBuilder in RRGraph Reader and Writer to replace the use of rr_node_indices #1800

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 5 commits into from
Jul 18, 2021

Conversation

tangxifan
Copy link
Contributor

@tangxifan tangxifan commented Jul 14, 2021

Description

This PR focuses on updating RRGraph reader and writer functions, where we use the refactored data structure RRGraphBuilder to replace the legacy data structure rr_node_indices.
This PR aims to eliminate the use of rr_node_indices in the RRGraph reader and writer, as one step further in deprecating the legacy data structure.

Checklist:

  • Eliminate the use of rr_node_indices for RRGraph reader
  • Eliminate the use of rr_node_indices for RRGraph writer

Related Issue

Motivation and Context

This pull request is a follow-up PR on the routing resource graph refactoring effort #1779

After the previous PR #1779 , we start reworking all the source files that use the legacy data structure rr_node_indices in a high priority, in order to deprecate the legacy data structure as soon as possible.
Current statistics on the files that use rr_node_indices (in total there are 143 lines related):

  • ./route/clock_connection_builders.cpp
  • ./route/clock_network_builders.cpp
  • ./route/clock_network_builders.h
  • ./route/router_lookahead_map_utils.cpp
  • ./route/rr_graph.cpp
  • ./route/rr_graph2.cpp
  • ./route/rr_graph2.h
  • ./route/rr_graph_clock.cpp
  • ./route/rr_graph_clock.h
  • ./route/rr_graph_reader.cpp
  • ./route/rr_graph_util.cpp
  • ./route/rr_graph_uxsdcxx_serializer.h
  • ./route/rr_graph_writer.cpp

This PR will remove the use in

  • ./route/rr_graph_writer.cpp
  • ./route/rr_graph_uxsdcxx_serializer.h
  • ./route/rr_graph_reader.cpp

How Has This Been Tested?

Considering this is all about refactoring, this PR does not need to create new tests. Expect all the existing tests to pass.

Types of changes

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

…f rr_node_indices and deploy RRSpatialLookup API
@github-actions github-actions bot added the VPR VPR FPGA Placement & Routing Tool label Jul 14, 2021
@tangxifan tangxifan marked this pull request as ready for review July 14, 2021 20:26
@tangxifan tangxifan requested review from vaughnbetz and hzeller July 15, 2021 17:50
Copy link
Contributor

@vaughnbetz vaughnbetz left a comment

Choose a reason for hiding this comment

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

Generally looks fine, except it makes the case even more that we should have a utility function for adding a node to all the locations in the spatial lookup it touches, in the proper way for each type.

for (size_t inode = 0; inode < rr_nodes_->size(); inode++) {
auto node = (*rr_nodes_)[inode];
if (rr_graph.node_type(node.id()) == CHANX) {
for (int ix = node.xlow(); ix <= node.xhigh(); ix++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could all this be made a utility function in RRGraphBuilder (or a global utility function) and called in multiple places? This code would handle the 3 call sites with 2D loop nests in the clock rr-graph builder too. It seems like making this a general utility would be a good idea. Would be a function like: add_node_to_all_locs () or some such.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree. The node addition is very generic and applicable to all kinds of nodes. I think it should be an API of the RRGraphBuilder because it should be the only way to add an existing rr_node to RRSpatialLookup data structure.

@vaughnbetz
Copy link
Contributor

Note: single CI failure is unrelated/spurious.

@@ -37,6 +37,15 @@ class RRGraphBuilder {
t_rr_graph_storage& node_storage();
/* Return a writable object for update the fast look-up of rr_node */
RRSpatialLookup& node_lookup();
/* Add an existing rr_node in the node storage to the node look-up
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this comment should also say that the node will be added to the lookup for every side it is on (for OPINs and IPINs) and for every (x,y) location at which it exists (for wires that span more than one (x,y).

@vaughnbetz
Copy link
Contributor

The changes all look good; just suggesting one more comment addition. Merging this, but if you can add the comment in another PR that would be great.

@vaughnbetz vaughnbetz merged commit d3449e8 into master Jul 18, 2021
@vaughnbetz vaughnbetz deleted the rr_graph_reader_writer_refactor branch July 18, 2021 18:37
@tangxifan
Copy link
Contributor Author

The changes all look good; just suggesting one more comment addition. Merging this, but if you can add the comment in another PR that would be great.

Thanks @vaughnbetz I start working on the next PR. The comment will be first one to be applied in that PR.

@tangxifan tangxifan restored the rr_graph_reader_writer_refactor branch July 19, 2021 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VPR VPR FPGA Placement & Routing Tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants