Skip to content

Remove legacy data structure rr_node_indices from DeviceContext #1828

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 3 commits into from
Aug 27, 2021

Conversation

tangxifan
Copy link
Contributor

@tangxifan tangxifan commented Aug 16, 2021

Description

This PR focuses on updating routing resource graph builder functions, where we use the refactored data structure RRGraphBuilder to replace the legacy data structure rr_node_indices.
This PR aims to fully deprecate the direct use of the legacy data structure rr_node_indices in builder as well as client functions.

After this PR, the rr_node_indices data structure is fully shadowed and encapsulated in the refactored data structure RRGraphBuilder.

This is the first milestone achieved in the refactoring effort on routing resource graph data structures.

Checklist:

  • Removed the legacy data structure rr_node_indices from DeviceContext
  • Reworked the function verify_rr_node_indices() to use RRGraphBuilder rather than rr_node_indices
  • Added new APIs clear() to data structures RRGraphBuilder and RRSpatialLookup to reset the data storage; As a result, the free_rr_graph() is reworked to use the new API.
  • Added a new API reorder() to RRSpatialLookup to support graph reordering. As a result, the reordering algorithm is reworked to use the new API.

TODO: May consider to implement the API reorder() in RRGraphBuilder so that the current reordering function can be fully internal.

Related Issue

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

Motivation and Context

After the previous PR #1805 , 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:

./route/rr_graph2.cpp
./route/rr_graph2.h
./base/vpr_context.h

This PR will remove the use in
./route/rr_graph.cpp
./route/rr_graph2.cpp
./base/vpr_context.h

How Has This Been Tested?

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

… in place of the legacy data structure ``rr_node_indices``
…eContext, as it is now fully shadowed by the data structure ``RRSpatialLookup``
@github-actions github-actions bot added the VPR VPR FPGA Placement & Routing Tool label Aug 16, 2021
@tangxifan
Copy link
Contributor Author

tangxifan commented Aug 20, 2021

As required for QoR checks, I finished the QoR runs on the

  • Basic sanity test

    • peak memory usage +2% on average
  • vtr_reg_qor_chain_depop test

    • flow run time +2% on average. However, most contributions are from ODIN2 (+23%) and packer (+2%), which are not under refactoring
    • No changes on critical path delay and peak memory usage
  • titan_quick_qor test:

    • flow run time +4% on average. However, most contributions are from packer (+3%), which are not under refactoring
    • No changes on critical path delay
    • Peak memory usage -1% on average

Attached spreadsheet for the detailed QoR of each test:

vtr_reg_basic_timing_sanity_comp.xlsx
vtr_reg_titan_quick_qor_comp.xlsx
vtr_reg_qor_chain_depop_comp.xlsx

@tangxifan
Copy link
Contributor Author

@vaughnbetz @hzeller This pull request is ready for your review. QoR results updated and CI is green.

@tangxifan tangxifan mentioned this pull request Aug 24, 2021
7 tasks
Copy link
Contributor

@hzeller hzeller left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -17,7 +18,7 @@ class RRSpatialLookup {
/* -- Constructors -- */
public:
/* Explicitly define the only way to create an object */
explicit RRSpatialLookup(t_rr_node_indices& rr_node_indices);
explicit RRSpatialLookup();
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we don't take a parameter anymore, the explicit is not needed anymore.
The explicit is only needed to tell the compiler to not consider this constructor in an automatic type-conversion, but if there are zero parameters, that is not an issue anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make sense to me. Will remove it.

@@ -273,3 +272,26 @@ void RRSpatialLookup::resize_nodes(int x,
std::max(rr_node_indices_[type].dim_size(2), size_t(side) + 1)});
}
}

void RRSpatialLookup::reorder(const vtr::vector<RRNodeId, RRNodeId> dest_order) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd expect some sort of unit-test for this method ?
(I know it is moved from some other place without change, so ok not adding a test for now; but now, it is actually a nicely testable functionality)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. This feature is already under testing in one of the test case in vtr_reg_basic:

script_params_list_add = --reorder_rr_graph_nodes_algorithm random_shuffle

I am not sure if this can be categorized as a unit-test. If not, we should think about it once we can extract the RRGraphBuilder and RRGraphView as an independent library.
Let me know what you think. I think unit test is a good idea.

@tangxifan tangxifan removed the VPR VPR FPGA Placement & Routing Tool label Aug 27, 2021
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.

Looks good to me. A few suggestions for commenting improvements, which could be done after merge if more convenient then.

@@ -63,7 +65,7 @@ class RRGraphBuilder {
/* node-level storage including edge storages */
t_rr_graph_storage& node_storage_;
/* Fast look-up for rr nodes */
RRSpatialLookup& node_lookup_;
RRSpatialLookup node_lookup_;
};

Copy link
Contributor

Choose a reason for hiding this comment

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

Now that we have the RRGraphView and RRGraphBuilder APIs, we should make doxygen documentation for them. Best done as a follow-up issue, so I'll file an issue for that (make doxygen-compatible comments, and add to the VPR API on the read-the-docs page).

* If pointers are used, it may cause many codes in client functions
* or inside the data structures to be changed later.
* That explains why the reference is used here temporarily
*/
/* Fast look-up: TODO: Should rework the data type. Currently it is based on a 3-dimensional arrqay mater where some dimensions must always be accessed with a specific index. Such limitation should be overcome */
Copy link
Contributor

Choose a reason for hiding this comment

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

typo to fix: 3-dimensional array matrix

@vaughnbetz
Copy link
Contributor

Merging since CI is green, but please see the commenting suggestions above (typo and doxygen) for a future PR.

@vaughnbetz vaughnbetz merged commit 5eb14aa into master Aug 27, 2021
@vaughnbetz vaughnbetz deleted the remove_rr_node_indices branch August 27, 2021 21:43
@tangxifan
Copy link
Contributor Author

Thanks @vaughnbetz I will create a follow-up pull request to address your comment today.

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.

4 participants