From 1c09683753feb2aa6f293eeb8a5e28c6c7df2567 Mon Sep 17 00:00:00 2001 From: Ethan Rogers Date: Wed, 2 Jun 2021 14:11:25 -0600 Subject: [PATCH 1/8] Added a markdown file to keep track of uses of xlow (for RRGraphView) Signed-off-by: Ethan Rogers --- doc/rr_graph_view/uses_of_xlow.md | 85 +++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 doc/rr_graph_view/uses_of_xlow.md diff --git a/doc/rr_graph_view/uses_of_xlow.md b/doc/rr_graph_view/uses_of_xlow.md new file mode 100644 index 00000000000..78f9fd52b8f --- /dev/null +++ b/doc/rr_graph_view/uses_of_xlow.md @@ -0,0 +1,85 @@ +## Uses of xlow, xhigh, ylow, yhigh + +| Function | Use Scenario | One Usage (Location) | Count | +| -- | -- | -- | -- | +| xlow | retrieve physical tile from device_ctx.grid | test_fasm.cpp:193 | 16 | +| xlow | Obtain length of wire | stats.cpp:313 | 3 | +| xlow | Determine switchpoint | draw.cpp:1475 | 1 | +| xlow | Draw from one edge to the other | draw.cpp:1934 | 1 | +| xlow | Create bounding box | draw.cpp:2083 | 1 | +| xlow | Check if nodes are adjacent | check_route.cpp:481 | 1 | +| xlow | Check if node is initialized | check_route.cpp:64 | 3 | +| xlow | Include x value in console output | check_route.cpp:258 | 5 | +| xlow | Create a serial num for the wire x value in console output | check_route.cpp:198 | 3 | +| xlow | Count cblocks | rr_graph_area.cpp:229 | 3 | +| xlow | Return the segment number (distance along the channel) of the connection box from from_rr_type (CHANX or CHANY) to to_node (IPIN) | rr_graph_util.cpp:21 | 1 | +| xlow | Check direction going from one node to another| rr_graph_util.cpp:45 | 1 | +| xlow | Write Coordinates | VprTimingGraphResolver.cpp:345 | 1 | +


+ +## Retrieve Physical Tile from device_ctx.grid +```cpp +static std::string get_pin_feature (size_t inode) { + auto& device_ctx = g_vpr_ctx.device(); + + // Get tile physical tile and the pin number + int ilow = device_ctx.rr_nodes[inode].xlow(); // <----------------------------- Use of xlow() + int jlow = device_ctx.rr_nodes[inode].ylow(); + auto physical_tile = device_ctx.grid[ilow][jlow].type; + int pin_num = device_ctx.rr_nodes[inode].ptc_num(); + + // Get the sub tile (type, not instance) and index of its pin that matches + // the node index. + const t_sub_tile* sub_tile_type = nullptr; + int sub_tile_pin = -1; + + for (auto& sub_tile : physical_tile->sub_tiles) { + auto max_inst_pins = sub_tile.num_phy_pins / sub_tile.capacity.total(); + for (int pin = 0; pin < sub_tile.num_phy_pins; pin++) { + if (sub_tile.sub_tile_to_tile_pin_indices[pin] == pin_num) { + sub_tile_type = &sub_tile; + sub_tile_pin = pin % max_inst_pins; + break; + } + } + + if (sub_tile_type != nullptr) { + break; + } + } +``` + +


+ +## Obtain length of wire +```cpp +while (tptr != nullptr) { + inode = tptr->index; + curr_type = device_ctx.rr_nodes[inode].type(); + + if (curr_type == SINK) { /* Starting a new segment */ + tptr = tptr->next; /* Link to existing path - don't add to len. */ + if (tptr == nullptr) + break; + + curr_type = device_ctx.rr_nodes[tptr->index].type(); + } + + else if (curr_type == CHANX || curr_type == CHANY) { + segments++; + length += 1 + device_ctx.rr_nodes[inode].xhigh() - device_ctx.rr_nodes[inode].xlow() // <----------------------------- Use of xlow() + + device_ctx.rr_nodes[inode].yhigh() - device_ctx.rr_nodes[inode].ylow(); + + if (curr_type != prev_type && (prev_type == CHANX || prev_type == CHANY)) + bends++; + } + + prev_type = curr_type; + tptr = tptr->next; + } + + *bends_ptr = bends; + *len_ptr = length; + *segments_ptr = segments; +} +``` \ No newline at end of file From 499042b56e1986411640d904fd40c29c6561d07f Mon Sep 17 00:00:00 2001 From: Ethan Rogers Date: Wed, 2 Jun 2021 14:14:28 -0600 Subject: [PATCH 2/8] Adjusted length of comment Signed-off-by: Ethan Rogers --- doc/rr_graph_view/uses_of_xlow.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/rr_graph_view/uses_of_xlow.md b/doc/rr_graph_view/uses_of_xlow.md index 78f9fd52b8f..bff2227e409 100644 --- a/doc/rr_graph_view/uses_of_xlow.md +++ b/doc/rr_graph_view/uses_of_xlow.md @@ -67,7 +67,7 @@ while (tptr != nullptr) { else if (curr_type == CHANX || curr_type == CHANY) { segments++; - length += 1 + device_ctx.rr_nodes[inode].xhigh() - device_ctx.rr_nodes[inode].xlow() // <----------------------------- Use of xlow() + length += 1 + device_ctx.rr_nodes[inode].xhigh() - device_ctx.rr_nodes[inode].xlow() // <-- Use of xlow() + device_ctx.rr_nodes[inode].yhigh() - device_ctx.rr_nodes[inode].ylow(); if (curr_type != prev_type && (prev_type == CHANX || prev_type == CHANY)) From 246158b3123122562310dea0c5a89ac25efdc6aa Mon Sep 17 00:00:00 2001 From: Ethan Rogers Date: Thu, 3 Jun 2021 09:54:57 -0600 Subject: [PATCH 3/8] Updated uses of xlow Signed-off-by: Ethan Rogers --- doc/rr_graph_view/uses_of_xlow.md | 46 ++++++++----------------------- 1 file changed, 11 insertions(+), 35 deletions(-) diff --git a/doc/rr_graph_view/uses_of_xlow.md b/doc/rr_graph_view/uses_of_xlow.md index bff2227e409..c980bae612f 100644 --- a/doc/rr_graph_view/uses_of_xlow.md +++ b/doc/rr_graph_view/uses_of_xlow.md @@ -1,4 +1,4 @@ -## Uses of xlow, xhigh, ylow, yhigh +# Uses of xlow, xhigh, ylow, yhigh | Function | Use Scenario | One Usage (Location) | Count | | -- | -- | -- | -- | @@ -14,20 +14,21 @@ | xlow | Count cblocks | rr_graph_area.cpp:229 | 3 | | xlow | Return the segment number (distance along the channel) of the connection box from from_rr_type (CHANX or CHANY) to to_node (IPIN) | rr_graph_util.cpp:21 | 1 | | xlow | Check direction going from one node to another| rr_graph_util.cpp:45 | 1 | -| xlow | Write Coordinates | VprTimingGraphResolver.cpp:345 | 1 | +| xlow | Write Coordinates | VprTimingGraphResolver.cpp:345 | 1 | +


-## Retrieve Physical Tile from device_ctx.grid -```cpp -static std::string get_pin_feature (size_t inode) { - auto& device_ctx = g_vpr_ctx.device(); +# Some snippets of code +## Retrieve Physical Tile from device_ctx.grid (`test_fasm.cpp:193`) +```cpp // Get tile physical tile and the pin number - int ilow = device_ctx.rr_nodes[inode].xlow(); // <----------------------------- Use of xlow() + int ilow = device_ctx.rr_nodes[inode].xlow(); // Use of xlow() int jlow = device_ctx.rr_nodes[inode].ylow(); - auto physical_tile = device_ctx.grid[ilow][jlow].type; + auto physical_tile = device_ctx.grid[ilow][jlow].type; // Accessing Physical Tile int pin_num = device_ctx.rr_nodes[inode].ptc_num(); + // Get the sub tile (type, not instance) and index of its pin that matches // the node index. const t_sub_tile* sub_tile_type = nullptr; @@ -51,35 +52,10 @@ static std::string get_pin_feature (size_t inode) {


-## Obtain length of wire +## Obtain length of wire (`stats.cpp:313`) ```cpp -while (tptr != nullptr) { - inode = tptr->index; - curr_type = device_ctx.rr_nodes[inode].type(); - - if (curr_type == SINK) { /* Starting a new segment */ - tptr = tptr->next; /* Link to existing path - don't add to len. */ - if (tptr == nullptr) - break; - - curr_type = device_ctx.rr_nodes[tptr->index].type(); - } - else if (curr_type == CHANX || curr_type == CHANY) { segments++; - length += 1 + device_ctx.rr_nodes[inode].xhigh() - device_ctx.rr_nodes[inode].xlow() // <-- Use of xlow() + length += 1 + device_ctx.rr_nodes[inode].xhigh() - device_ctx.rr_nodes[inode].xlow() + device_ctx.rr_nodes[inode].yhigh() - device_ctx.rr_nodes[inode].ylow(); - - if (curr_type != prev_type && (prev_type == CHANX || prev_type == CHANY)) - bends++; - } - - prev_type = curr_type; - tptr = tptr->next; - } - - *bends_ptr = bends; - *len_ptr = length; - *segments_ptr = segments; -} ``` \ No newline at end of file From 45ccff2d4d7e4502b58d75d486e7177808a4407b Mon Sep 17 00:00:00 2001 From: Ethan Rogers Date: Mon, 14 Jun 2021 14:47:01 -0600 Subject: [PATCH 4/8] Removed uses_of_xlow.md Signed-off-by: Ethan Rogers --- doc/rr_graph_view/uses_of_xlow.md | 61 ------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 doc/rr_graph_view/uses_of_xlow.md diff --git a/doc/rr_graph_view/uses_of_xlow.md b/doc/rr_graph_view/uses_of_xlow.md deleted file mode 100644 index c980bae612f..00000000000 --- a/doc/rr_graph_view/uses_of_xlow.md +++ /dev/null @@ -1,61 +0,0 @@ -# Uses of xlow, xhigh, ylow, yhigh - -| Function | Use Scenario | One Usage (Location) | Count | -| -- | -- | -- | -- | -| xlow | retrieve physical tile from device_ctx.grid | test_fasm.cpp:193 | 16 | -| xlow | Obtain length of wire | stats.cpp:313 | 3 | -| xlow | Determine switchpoint | draw.cpp:1475 | 1 | -| xlow | Draw from one edge to the other | draw.cpp:1934 | 1 | -| xlow | Create bounding box | draw.cpp:2083 | 1 | -| xlow | Check if nodes are adjacent | check_route.cpp:481 | 1 | -| xlow | Check if node is initialized | check_route.cpp:64 | 3 | -| xlow | Include x value in console output | check_route.cpp:258 | 5 | -| xlow | Create a serial num for the wire x value in console output | check_route.cpp:198 | 3 | -| xlow | Count cblocks | rr_graph_area.cpp:229 | 3 | -| xlow | Return the segment number (distance along the channel) of the connection box from from_rr_type (CHANX or CHANY) to to_node (IPIN) | rr_graph_util.cpp:21 | 1 | -| xlow | Check direction going from one node to another| rr_graph_util.cpp:45 | 1 | -| xlow | Write Coordinates | VprTimingGraphResolver.cpp:345 | 1 | - -


- -# Some snippets of code - -## Retrieve Physical Tile from device_ctx.grid (`test_fasm.cpp:193`) -```cpp - // Get tile physical tile and the pin number - int ilow = device_ctx.rr_nodes[inode].xlow(); // Use of xlow() - int jlow = device_ctx.rr_nodes[inode].ylow(); - auto physical_tile = device_ctx.grid[ilow][jlow].type; // Accessing Physical Tile - int pin_num = device_ctx.rr_nodes[inode].ptc_num(); - - - // Get the sub tile (type, not instance) and index of its pin that matches - // the node index. - const t_sub_tile* sub_tile_type = nullptr; - int sub_tile_pin = -1; - - for (auto& sub_tile : physical_tile->sub_tiles) { - auto max_inst_pins = sub_tile.num_phy_pins / sub_tile.capacity.total(); - for (int pin = 0; pin < sub_tile.num_phy_pins; pin++) { - if (sub_tile.sub_tile_to_tile_pin_indices[pin] == pin_num) { - sub_tile_type = &sub_tile; - sub_tile_pin = pin % max_inst_pins; - break; - } - } - - if (sub_tile_type != nullptr) { - break; - } - } -``` - -


- -## Obtain length of wire (`stats.cpp:313`) -```cpp - else if (curr_type == CHANX || curr_type == CHANY) { - segments++; - length += 1 + device_ctx.rr_nodes[inode].xhigh() - device_ctx.rr_nodes[inode].xlow() - + device_ctx.rr_nodes[inode].yhigh() - device_ctx.rr_nodes[inode].ylow(); -``` \ No newline at end of file From 93ec8141cf4dca13b2c8f924b0a4756b796f401c Mon Sep 17 00:00:00 2001 From: Ethan Rogers Date: Tue, 15 Jun 2021 14:23:03 -0600 Subject: [PATCH 5/8] First pass through for RRGraphView::node_capacity Signed-off-by: Ethan Rogers --- utils/route_diag/src/main.cpp | 3 ++- vpr/src/device/rr_graph_view.h | 5 +++++ vpr/src/draw/draw.cpp | 8 ++++---- vpr/src/route/check_rr_graph.cpp | 2 +- vpr/src/route/overuse_report.cpp | 6 ++++-- vpr/src/route/route_common.cpp | 20 +++++++++++++------- vpr/src/route/route_common.h | 6 ++++-- vpr/src/route/route_timing.cpp | 7 ++++--- vpr/src/route/route_tree_timing.cpp | 13 ++++++++----- vpr/src/route/router_delay_profiling.cpp | 3 ++- vpr/src/route/segment_stats.cpp | 6 +++--- 11 files changed, 50 insertions(+), 29 deletions(-) diff --git a/utils/route_diag/src/main.cpp b/utils/route_diag/src/main.cpp index a30bec137b1..fbb06cf7764 100644 --- a/utils/route_diag/src/main.cpp +++ b/utils/route_diag/src/main.cpp @@ -67,6 +67,7 @@ static void do_one_route(int source_node, int sink_node, * to route this net, even ignoring congestion, it returns false. In this * * case the rr_graph is disconnected and you can give up. */ auto& device_ctx = g_vpr_ctx.device(); + const auto& rr_graph = device_ctx.rr_graph; auto& route_ctx = g_vpr_ctx.routing(); t_rt_node* rt_root = init_route_tree_to_source_no_net(source_node); @@ -123,7 +124,7 @@ static void do_one_route(int source_node, int sink_node, print_route_tree(rt_root); VTR_LOG("\n"); - VTR_ASSERT_MSG(route_ctx.rr_node_route_inf[rt_root->inode].occ() <= device_ctx.rr_nodes[rt_root->inode].capacity(), "SOURCE should never be congested"); + VTR_ASSERT_MSG(route_ctx.rr_node_route_inf[rt_root->inode].occ() <= rr_graph.node_capacity(RRNodeId(rt_root->inode)), "SOURCE should never be congested"); free_route_tree(rt_root); } else { VTR_LOG("Routed failed"); diff --git a/vpr/src/device/rr_graph_view.h b/vpr/src/device/rr_graph_view.h index d5842e1127c..672e5ed77a3 100644 --- a/vpr/src/device/rr_graph_view.h +++ b/vpr/src/device/rr_graph_view.h @@ -57,6 +57,11 @@ class RRGraphView { return node_storage_.node_type(node); } + /* Get the capacity of a routing resource node. This function is inlined for runtime optimization. */ + inline short node_capacity(RRNodeId node) const { + return node_storage_.node_capacity(node); + } + /* Return the fast look-up data structure for queries from client functions */ const RRSpatialLookup& node_lookup() const { return node_lookup_; diff --git a/vpr/src/draw/draw.cpp b/vpr/src/draw/draw.cpp index 3b9dc04f5c5..f1fc2af17c2 100644 --- a/vpr/src/draw/draw.cpp +++ b/vpr/src/draw/draw.cpp @@ -1111,7 +1111,7 @@ static void draw_congestion(ezgl::renderer* g) { std::vector congested_rr_nodes = collect_congested_rr_nodes(); for (int inode : congested_rr_nodes) { short occ = route_ctx.rr_node_route_inf[inode].occ(); - short capacity = device_ctx.rr_nodes[inode].capacity(); + short capacity = rr_graph.node_capacity(RRNodeId(inode)); float congestion_ratio = float(occ) / capacity; @@ -1133,10 +1133,10 @@ static void draw_congestion(ezgl::renderer* g) { //valued nodes are not overdrawn by lower value ones (e.g-> when zoomed-out far) auto cmp_ascending_acc_cost = [&](int lhs_node, int rhs_node) { short lhs_occ = route_ctx.rr_node_route_inf[lhs_node].occ(); - short lhs_capacity = device_ctx.rr_nodes[lhs_node].capacity(); + short lhs_capacity = rr_graph.node_capacity(RRNodeId(lhs_node)); short rhs_occ = route_ctx.rr_node_route_inf[rhs_node].occ(); - short rhs_capacity = device_ctx.rr_nodes[rhs_node].capacity(); + short rhs_capacity = rr_graph.node_capacity(RRNodeId(rhs_node)); float lhs_cong_ratio = float(lhs_occ) / lhs_capacity; float rhs_cong_ratio = float(rhs_occ) / rhs_capacity; @@ -1170,7 +1170,7 @@ static void draw_congestion(ezgl::renderer* g) { //Draw each congested node for (int inode : congested_rr_nodes) { short occ = route_ctx.rr_node_route_inf[inode].occ(); - short capacity = device_ctx.rr_nodes[inode].capacity(); + short capacity = rr_graph.node_capacity(RRNodeId(inode)); float congestion_ratio = float(occ) / capacity; diff --git a/vpr/src/route/check_rr_graph.cpp b/vpr/src/route/check_rr_graph.cpp index e095444e9a5..e3acb0e3e8e 100644 --- a/vpr/src/route/check_rr_graph.cpp +++ b/vpr/src/route/check_rr_graph.cpp @@ -305,7 +305,7 @@ void check_rr_node(int inode, enum e_route_type route_type, const DeviceContext& ylow = device_ctx.rr_nodes[inode].ylow(); yhigh = device_ctx.rr_nodes[inode].yhigh(); ptc_num = device_ctx.rr_nodes[inode].ptc_num(); - capacity = device_ctx.rr_nodes[inode].capacity(); + capacity = rr_graph.node_capacity(RRNodeId(inode)); cost_index = device_ctx.rr_nodes[inode].cost_index(); type = nullptr; diff --git a/vpr/src/route/overuse_report.cpp b/vpr/src/route/overuse_report.cpp index 01a01ce7997..6bb1e033b4a 100644 --- a/vpr/src/route/overuse_report.cpp +++ b/vpr/src/route/overuse_report.cpp @@ -28,6 +28,7 @@ static void log_single_overused_node_status(int overuse_index, RRNodeId inode); */ void log_overused_nodes_status(int max_logged_overused_rr_nodes) { const auto& device_ctx = g_vpr_ctx.device(); + const auto& rr_graph = device_ctx.rr_graph; const auto& route_ctx = g_vpr_ctx.routing(); //Print overuse info header @@ -36,7 +37,7 @@ void log_overused_nodes_status(int max_logged_overused_rr_nodes) { //Print overuse info body int overuse_index = 0; for (size_t inode = 0; inode < device_ctx.rr_nodes.size(); inode++) { - int overuse = route_ctx.rr_node_route_inf[inode].occ() - device_ctx.rr_nodes[inode].capacity(); + int overuse = route_ctx.rr_node_route_inf[inode].occ() - rr_graph.node_capacity(RRNodeId(inode)); if (overuse > 0) { log_single_overused_node_status(overuse_index, RRNodeId(inode)); @@ -130,6 +131,7 @@ void report_overused_nodes() { */ void generate_overused_nodes_to_congested_net_lookup(std::map>& nodes_to_nets_lookup) { const auto& device_ctx = g_vpr_ctx.device(); + const auto& rr_graph = device_ctx.rr_graph; const auto& route_ctx = g_vpr_ctx.routing(); const auto& cluster_ctx = g_vpr_ctx.clustering(); @@ -139,7 +141,7 @@ void generate_overused_nodes_to_congested_net_lookup(std::mapnext) { int inode = tptr->index; - int overuse = route_ctx.rr_node_route_inf[inode].occ() - device_ctx.rr_nodes[inode].capacity(); + int overuse = route_ctx.rr_node_route_inf[inode].occ() - rr_graph.node_capacity(RRNodeId(inode)); if (overuse > 0) { nodes_to_nets_lookup[RRNodeId(inode)].insert(net_id); } diff --git a/vpr/src/route/route_common.cpp b/vpr/src/route/route_common.cpp index d8499ea4c70..8dcb0cf60ac 100644 --- a/vpr/src/route/route_common.cpp +++ b/vpr/src/route/route_common.cpp @@ -325,10 +325,11 @@ bool feasible_routing() { * that the occupancy arrays are up to date when it is called. */ auto& device_ctx = g_vpr_ctx.device(); + const auto& rr_graph = device_ctx.rr_graph; auto& route_ctx = g_vpr_ctx.routing(); for (size_t inode = 0; inode < device_ctx.rr_nodes.size(); inode++) { - if (route_ctx.rr_node_route_inf[inode].occ() > device_ctx.rr_nodes[inode].capacity()) { + if (route_ctx.rr_node_route_inf[inode].occ() > rr_graph.node_capacity(RRNodeId(inode))) { return (false); } } @@ -339,12 +340,13 @@ bool feasible_routing() { //Returns all RR nodes in the current routing which are congested std::vector collect_congested_rr_nodes() { auto& device_ctx = g_vpr_ctx.device(); + const auto& rr_graph = device_ctx.rr_graph; auto& route_ctx = g_vpr_ctx.routing(); std::vector congested_rr_nodes; for (size_t inode = 0; inode < device_ctx.rr_nodes.size(); inode++) { short occ = route_ctx.rr_node_route_inf[inode].occ(); - short capacity = device_ctx.rr_nodes[inode].capacity(); + short capacity = rr_graph.node_capacity(RRNodeId(inode)); if (occ > capacity) { congested_rr_nodes.push_back(inode); @@ -424,11 +426,12 @@ void pathfinder_update_acc_cost_and_overuse_info(float acc_fac, OveruseInfo& ove * This routine also creates a new overuse info for the current routing iteration. */ auto& device_ctx = g_vpr_ctx.device(); + const auto& rr_graph = device_ctx.rr_graph; auto& route_ctx = g_vpr_ctx.mutable_routing(); size_t overused_nodes = 0, total_overuse = 0, worst_overuse = 0; for (size_t inode = 0; inode < device_ctx.rr_nodes.size(); inode++) { - int overuse = route_ctx.rr_node_route_inf[inode].occ() - device_ctx.rr_nodes[inode].capacity(); + int overuse = route_ctx.rr_node_route_inf[inode].occ() - rr_graph.node_capacity(RRNodeId(inode)); // If overused, update the acc_cost and add this node to the overuse info // If not, do nothing @@ -1453,9 +1456,10 @@ static void adjust_one_rr_occ_and_acc_cost(int inode, int add_or_sub, float acc_ auto& route_ctx = g_vpr_ctx.mutable_routing(); auto& device_ctx = g_vpr_ctx.device(); + const auto& rr_graph = device_ctx.rr_graph; int new_occ = route_ctx.rr_node_route_inf[inode].occ() + add_or_sub; - int capacity = device_ctx.rr_nodes[inode].capacity(); + int capacity = rr_graph.node_capacity(RRNodeId(inode)); route_ctx.rr_node_route_inf[inode].set_occ(new_occ); if (new_occ < capacity) { @@ -1512,7 +1516,7 @@ void print_traceback(const t_trace* trace) { VTR_LOG("*"); //Reached non-configurably } - if (route_ctx.rr_node_route_inf[inode].occ() > device_ctx.rr_nodes[inode].capacity()) { + if (route_ctx.rr_node_route_inf[inode].occ() > rr_graph.node_capacity(RRNodeId(inode))) { VTR_LOG(" x"); //Overused } VTR_LOG("\n"); @@ -1587,6 +1591,7 @@ bool validate_traceback_recurr(t_trace* trace, std::set& seen_rr_nodes) { //Print information about an invalid routing, caused by overused routing resources void print_invalid_routing_info() { auto& device_ctx = g_vpr_ctx.device(); + const auto& rr_graph = device_ctx.rr_graph; auto& cluster_ctx = g_vpr_ctx.clustering(); auto& route_ctx = g_vpr_ctx.routing(); @@ -1604,7 +1609,7 @@ void print_invalid_routing_info() { for (size_t inode = 0; inode < device_ctx.rr_nodes.size(); inode++) { int occ = route_ctx.rr_node_route_inf[inode].occ(); - int cap = device_ctx.rr_nodes[inode].capacity(); + int cap = rr_graph.node_capacity(RRNodeId(inode)); if (occ > cap) { VTR_LOG(" %s is overused (occ=%d capacity=%d)\n", describe_rr_node(inode).c_str(), occ, cap); @@ -1641,13 +1646,14 @@ void print_rr_node_route_inf() { void print_rr_node_route_inf_dot() { auto& route_ctx = g_vpr_ctx.routing(); auto& device_ctx = g_vpr_ctx.device(); + const auto& rr_graph = device_ctx.rr_graph; VTR_LOG("digraph G {\n"); VTR_LOG("\tnode[shape=record]\n"); for (size_t inode = 0; inode < route_ctx.rr_node_route_inf.size(); ++inode) { if (!std::isinf(route_ctx.rr_node_route_inf[inode].path_cost)) { VTR_LOG("\tnode%zu[label=\"{%zu (%s)", inode, inode, device_ctx.rr_nodes[inode].type_string()); - if (route_ctx.rr_node_route_inf[inode].occ() > device_ctx.rr_nodes[inode].capacity()) { + if (route_ctx.rr_node_route_inf[inode].occ() > rr_graph.node_capacity(RRNodeId(inode))) { VTR_LOG(" x"); } VTR_LOG("}\"]\n"); diff --git a/vpr/src/route/route_common.h b/vpr/src/route/route_common.h index 2453a3f54e3..a7b0893fd0c 100644 --- a/vpr/src/route/route_common.h +++ b/vpr/src/route/route_common.h @@ -49,10 +49,11 @@ inline float get_single_rr_cong_acc_cost(int inode) { /* Returns the present congestion cost of using this rr_node */ inline float get_single_rr_cong_pres_cost(int inode, float pres_fac) { auto& device_ctx = g_vpr_ctx.device(); + const auto& rr_graph = device_ctx.rr_graph; auto& route_ctx = g_vpr_ctx.routing(); int occ = route_ctx.rr_node_route_inf[inode].occ(); - int capacity = device_ctx.rr_nodes[inode].capacity(); + int capacity = rr_graph.node_capacity(RRNodeId(inode)); if (occ >= capacity) { return (1. + pres_fac * (occ + 1 - capacity)); @@ -65,10 +66,11 @@ inline float get_single_rr_cong_pres_cost(int inode, float pres_fac) { * *ignoring* non-configurable edges */ inline float get_single_rr_cong_cost(int inode, float pres_fac) { auto& device_ctx = g_vpr_ctx.device(); + const auto& rr_graph = device_ctx.rr_graph; auto& route_ctx = g_vpr_ctx.routing(); float pres_cost; - int overuse = route_ctx.rr_node_route_inf[inode].occ() - device_ctx.rr_nodes[inode].capacity(); + int overuse = route_ctx.rr_node_route_inf[inode].occ() - rr_graph.node_capacity(RRNodeId(inode)); if (overuse >= 0) { pres_cost = (1. + pres_fac * (overuse + 1)); diff --git a/vpr/src/route/route_timing.cpp b/vpr/src/route/route_timing.cpp index a4d155e7631..e443b3cdb76 100644 --- a/vpr/src/route/route_timing.cpp +++ b/vpr/src/route/route_timing.cpp @@ -1163,7 +1163,7 @@ bool timing_driven_route_net(ConnectionRouter& router, } } } - VTR_ASSERT_MSG(route_ctx.rr_node_route_inf[rt_root->inode].occ() <= device_ctx.rr_nodes[rt_root->inode].capacity(), "SOURCE should never be congested"); + VTR_ASSERT_MSG(route_ctx.rr_node_route_inf[rt_root->inode].occ() <= rr_graph.node_capacity(RRNodeId(rt_root->inode)), "SOURCE should never be congested"); // route tree is not kept persistent since building it from the traceback the next iteration takes almost 0 time VTR_LOGV_DEBUG(f_router_debug, "Routed Net %zu (%zu sinks)\n", size_t(net_id), num_sinks); @@ -1597,6 +1597,7 @@ static bool timing_driven_check_net_delays(ClbNetPinsMatrix& net_delay) { static bool should_route_net(ClusterNetId net_id, CBRR& connections_inf, bool if_force_reroute) { auto& route_ctx = g_vpr_ctx.routing(); auto& device_ctx = g_vpr_ctx.device(); + const auto& rr_graph = device_ctx.rr_graph; t_trace* tptr = route_ctx.trace[net_id].head; @@ -1608,7 +1609,7 @@ static bool should_route_net(ClusterNetId net_id, CBRR& connections_inf, bool if for (;;) { int inode = tptr->index; int occ = route_ctx.rr_node_route_inf[inode].occ(); - int capacity = device_ctx.rr_nodes[inode].capacity(); + int capacity = rr_graph.node_capacity(RRNodeId(inode)); if (occ > capacity) { return true; /* overuse detected */ @@ -1672,7 +1673,7 @@ static size_t calculate_wirelength_available() { size_t length_x = device_ctx.rr_nodes[i].xhigh() - device_ctx.rr_nodes[i].xlow(); size_t length_y = device_ctx.rr_nodes[i].yhigh() - device_ctx.rr_nodes[i].ylow(); - available_wirelength += device_ctx.rr_nodes[i].capacity() * (length_x + length_y + 1); + available_wirelength += rr_graph.node_capacity(RRNodeId(i)) * (length_x + length_y + 1); } } return available_wirelength; diff --git a/vpr/src/route/route_tree_timing.cpp b/vpr/src/route/route_tree_timing.cpp index ece1539ca52..f1350698679 100644 --- a/vpr/src/route/route_tree_timing.cpp +++ b/vpr/src/route/route_tree_timing.cpp @@ -686,6 +686,7 @@ void print_route_tree(const t_rt_node* rt_node, int depth) { } auto& device_ctx = g_vpr_ctx.device(); + const auto& rr_graph = device_ctx.rr_graph; VTR_LOG("%srt_node: %d (%s) \t ipin: %d \t R: %g \t C: %g \t delay: %g", indent.c_str(), rt_node->inode, device_ctx.rr_nodes[rt_node->inode].type_string(), rt_node->net_pin_index, rt_node->R_upstream, rt_node->C_downstream, rt_node->Tdel); @@ -697,7 +698,7 @@ void print_route_tree(const t_rt_node* rt_node, int depth) { } auto& route_ctx = g_vpr_ctx.routing(); - if (route_ctx.rr_node_route_inf[rt_node->inode].occ() > device_ctx.rr_nodes[rt_node->inode].capacity()) { + if (route_ctx.rr_node_route_inf[rt_node->inode].occ() > rr_graph.node_capacity(RRNodeId(rt_node->inode))) { VTR_LOG(" x"); } @@ -978,7 +979,7 @@ static t_rt_node* prune_route_tree_recurr(t_rt_node* node, CBRR& connections_inf auto& device_ctx = g_vpr_ctx.device(); const auto& rr_graph = device_ctx.rr_graph; auto& route_ctx = g_vpr_ctx.routing(); - bool congested = (route_ctx.rr_node_route_inf[node->inode].occ() > device_ctx.rr_nodes[node->inode].capacity()); + bool congested = (route_ctx.rr_node_route_inf[node->inode].occ() > rr_graph.node_capacity(RRNodeId(node->inode))); int node_set = -1; auto itr = device_ctx.rr_node_to_non_config_node_set.find(node->inode); if (itr != device_ctx.rr_node_to_non_config_node_set.end()) { @@ -1175,7 +1176,7 @@ t_rt_node* prune_route_tree(t_rt_node* rt_root, CBRR& connections_inf, std::vect VTR_ASSERT_MSG(rr_graph.node_type(RRNodeId(rt_root->inode)) == SOURCE, "Root of route tree must be SOURCE"); - VTR_ASSERT_MSG(route_ctx.rr_node_route_inf[rt_root->inode].occ() <= device_ctx.rr_nodes[rt_root->inode].capacity(), + VTR_ASSERT_MSG(route_ctx.rr_node_route_inf[rt_root->inode].occ() <= rr_graph.node_capacity(RRNodeId(rt_root->inode)), "Route tree root/SOURCE should never be congested"); return prune_route_tree_recurr(rt_root, connections_inf, false, non_config_node_set_usage); @@ -1359,6 +1360,7 @@ bool is_valid_skeleton_tree(const t_rt_node* root) { bool is_valid_route_tree(const t_rt_node* root) { // check upstream resistance auto& device_ctx = g_vpr_ctx.device(); + const auto& rr_graph = device_ctx.rr_graph; auto& route_ctx = g_vpr_ctx.routing(); constexpr float CAP_REL_TOL = 1e-6; @@ -1393,7 +1395,7 @@ bool is_valid_route_tree(const t_rt_node* root) { // sink, must not be congested if (!edge) { int occ = route_ctx.rr_node_route_inf[inode].occ(); - int capacity = device_ctx.rr_nodes[inode].capacity(); + int capacity = rr_graph.node_capacity(RRNodeId(inode)); if (occ > capacity) { VTR_LOG("SINK %d occ %d > cap %d\n", inode, occ, capacity); return false; @@ -1437,9 +1439,10 @@ bool is_valid_route_tree(const t_rt_node* root) { bool is_uncongested_route_tree(const t_rt_node* root) { auto& route_ctx = g_vpr_ctx.routing(); auto& device_ctx = g_vpr_ctx.device(); + const auto& rr_graph = device_ctx.rr_graph; int inode = root->inode; - if (route_ctx.rr_node_route_inf[inode].occ() > device_ctx.rr_nodes[inode].capacity()) { + if (route_ctx.rr_node_route_inf[inode].occ() > rr_graph.node_capacity(RRNodeId(inode))) { //This node is congested return false; } diff --git a/vpr/src/route/router_delay_profiling.cpp b/vpr/src/route/router_delay_profiling.cpp index c54fc6646c7..4390b589b62 100644 --- a/vpr/src/route/router_delay_profiling.cpp +++ b/vpr/src/route/router_delay_profiling.cpp @@ -27,6 +27,7 @@ bool RouterDelayProfiler::calculate_delay(int source_node, int sink_node, const * to route this net, even ignoring congestion, it returns false. In this * * case the rr_graph is disconnected and you can give up. */ auto& device_ctx = g_vpr_ctx.device(); + const auto& rr_graph = device_ctx.rr_graph; auto& route_ctx = g_vpr_ctx.routing(); //vtr::ScopedStartFinishTimer t(vtr::string_fmt("Profiling Delay from %s at %d,%d (%s) to %s at %d,%d (%s)", @@ -79,7 +80,7 @@ bool RouterDelayProfiler::calculate_delay(int source_node, int sink_node, const //find delay *net_delay = rt_node_of_sink->Tdel; - VTR_ASSERT_MSG(route_ctx.rr_node_route_inf[rt_root->inode].occ() <= device_ctx.rr_nodes[rt_root->inode].capacity(), "SOURCE should never be congested"); + VTR_ASSERT_MSG(route_ctx.rr_node_route_inf[rt_root->inode].occ() <= rr_graph.node_capacity(RRNodeId(rt_root->inode)), "SOURCE should never be congested"); free_route_tree(rt_root); } diff --git a/vpr/src/route/segment_stats.cpp b/vpr/src/route/segment_stats.cpp index 41a9f1210d3..425814ba19d 100644 --- a/vpr/src/route/segment_stats.cpp +++ b/vpr/src/route/segment_stats.cpp @@ -57,11 +57,11 @@ void get_segment_usage_stats(std::vector& segment_inf) { length = segment_inf[seg_type].length; else length = LONGLINE; - + const short& inode_capacity = rr_graph.node_capacity(RRNodeId(inode)); seg_occ_by_length[length] += route_ctx.rr_node_route_inf[inode].occ(); - seg_cap_by_length[length] += device_ctx.rr_nodes[inode].capacity(); + seg_cap_by_length[length] += inode_capacity; seg_occ_by_type[seg_type] += route_ctx.rr_node_route_inf[inode].occ(); - seg_cap_by_type[seg_type] += device_ctx.rr_nodes[inode].capacity(); + seg_cap_by_type[seg_type] += inode_capacity; } } From 890865511e0032fc6e1469c90b9b2f29cdfa75d4 Mon Sep 17 00:00:00 2001 From: Ethan Rogers Date: Tue, 15 Jun 2021 16:39:39 -0600 Subject: [PATCH 6/8] Replaced calls to node.capacity() with rr_graph.node_capacity(RRNodeId(inode)) Signed-off-by: Ethan Rogers --- vpr/src/route/route_tree_timing.cpp | 5 +++-- vpr/src/route/route_util.cpp | 5 +++-- vpr/src/route/router_lookahead_sampling.cpp | 4 ++-- vpr/src/route/rr_graph.cpp | 2 +- vpr/src/route/rr_graph_uxsdcxx_serializer.h | 3 ++- vpr/src/route/rr_node.h | 2 +- vpr/src/route/rr_node_impl.h | 4 ++-- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/vpr/src/route/route_tree_timing.cpp b/vpr/src/route/route_tree_timing.cpp index f1350698679..16f03469b4e 100644 --- a/vpr/src/route/route_tree_timing.cpp +++ b/vpr/src/route/route_tree_timing.cpp @@ -1276,13 +1276,14 @@ static void print_node_inf(const t_rt_node* rt_node) { static void print_node_congestion(const t_rt_node* rt_node) { auto& device_ctx = g_vpr_ctx.device(); + const auto& rr_graph = device_ctx.rr_graph; auto& route_ctx = g_vpr_ctx.routing(); int inode = rt_node->inode; const auto& node_inf = route_ctx.rr_node_route_inf[inode]; - const auto& node = device_ctx.rr_nodes[inode]; + const short& node_capacity = rr_graph.node_capacity(RRNodeId(inode)); VTR_LOG("%2d %2d|%-6d-> ", node_inf.acc_cost, rt_node->Tdel, - node_inf.occ(), node.capacity(), inode); + node_inf.occ(), node_capacity, inode); } void print_route_tree_inf(const t_rt_node* rt_root) { diff --git a/vpr/src/route/route_util.cpp b/vpr/src/route/route_util.cpp index 3deea8586e1..a92034735ee 100644 --- a/vpr/src/route/route_util.cpp +++ b/vpr/src/route/route_util.cpp @@ -61,6 +61,7 @@ vtr::Matrix calculate_routing_avail(t_rr_type rr_type) { vtr::Matrix avail({{device_ctx.grid.width(), device_ctx.grid.height()}}, 0.); for (size_t inode = 0; inode < device_ctx.rr_nodes.size(); ++inode) { auto& rr_node = device_ctx.rr_nodes[inode]; + const short& rr_node_capacity = rr_graph.node_capacity(RRNodeId(inode)); if (rr_graph.node_type(RRNodeId(inode)) == CHANX && rr_type == CHANX) { VTR_ASSERT(rr_graph.node_type(RRNodeId(inode)) == CHANX); @@ -68,7 +69,7 @@ vtr::Matrix calculate_routing_avail(t_rr_type rr_type) { int y = rr_node.ylow(); for (int x = rr_node.xlow(); x <= rr_node.xhigh(); ++x) { - avail[x][y] += rr_node.capacity(); + avail[x][y] += rr_node_capacity; } } else if (rr_graph.node_type(RRNodeId(inode)) == CHANY && rr_type == CHANY) { VTR_ASSERT(rr_graph.node_type(RRNodeId(inode)) == CHANY); @@ -76,7 +77,7 @@ vtr::Matrix calculate_routing_avail(t_rr_type rr_type) { int x = rr_node.xlow(); for (int y = rr_node.ylow(); y <= rr_node.yhigh(); ++y) { - avail[x][y] += rr_node.capacity(); + avail[x][y] += rr_node_capacity; } } } diff --git a/vpr/src/route/router_lookahead_sampling.cpp b/vpr/src/route/router_lookahead_sampling.cpp index d35b067eafc..df286417baa 100644 --- a/vpr/src/route/router_lookahead_sampling.cpp +++ b/vpr/src/route/router_lookahead_sampling.cpp @@ -134,7 +134,7 @@ static std::tuple get_node_info(const t_rr_node& node, int num_se return std::tuple(OPEN, OPEN, OPEN); } - if (node.capacity() == 0 || node.num_edges() == 0) { + if (rr_graph.node_capacity(node.id()) == 0 || node.num_edges() == 0) { return std::tuple(OPEN, OPEN, OPEN); } @@ -205,7 +205,7 @@ std::vector find_sample_regions(int num_segments) { std::vector> bounding_box_for_segment(num_segments, vtr::Rect()); for (auto& node : rr_nodes) { if (rr_graph.node_type(node.id()) != CHANX && rr_graph.node_type(node.id()) != CHANY) continue; - if (node.capacity() == 0 || node.num_edges() == 0) continue; + if (rr_graph.node_capacity(node.id()) == 0 || node.num_edges() == 0) continue; int seg_index = device_ctx.rr_indexed_data[node.cost_index()].seg_index; VTR_ASSERT(seg_index != OPEN); diff --git a/vpr/src/route/rr_graph.cpp b/vpr/src/route/rr_graph.cpp index 03c96393427..bf9fb73cd8b 100644 --- a/vpr/src/route/rr_graph.cpp +++ b/vpr/src/route/rr_graph.cpp @@ -2483,7 +2483,7 @@ std::string describe_rr_node(int inode) { msg += vtr::string_fmt(" class: %d", rr_node.class_num()); } - msg += vtr::string_fmt(" capacity: %d", rr_node.capacity()); + msg += vtr::string_fmt(" capacity: %d", rr_graph.node_capacity(RRNodeId(inode))); msg += vtr::string_fmt(" fan-in: %d", rr_node.fan_in()); msg += vtr::string_fmt(" fan-out: %d", rr_node.num_edges()); diff --git a/vpr/src/route/rr_graph_uxsdcxx_serializer.h b/vpr/src/route/rr_graph_uxsdcxx_serializer.h index 40603f86116..f48e4c77ff3 100644 --- a/vpr/src/route/rr_graph_uxsdcxx_serializer.h +++ b/vpr/src/route/rr_graph_uxsdcxx_serializer.h @@ -801,7 +801,8 @@ class RrGraphSerializer final : public uxsd::RrGraphBase { } inline unsigned int get_node_capacity(const t_rr_node& node) final { - return node.capacity(); + const auto& rr_graph = (*rr_graph_); + return rr_graph.node_capacity(node.id()); } inline unsigned int get_node_id(const t_rr_node& node) final { return size_t(node.id()); diff --git a/vpr/src/route/rr_node.h b/vpr/src/route/rr_node.h index b0ee57e9068..69c84de5c15 100644 --- a/vpr/src/route/rr_node.h +++ b/vpr/src/route/rr_node.h @@ -100,7 +100,7 @@ class t_rr_node { short yhigh() const; signed short length() const; - short capacity() const; + //short capacity() const; // ESR API This function has been replaced by RRGraphView::node_capacity() short ptc_num() const; short pin_num() const; //Same as ptc_num() but checks that type() is consistent diff --git a/vpr/src/route/rr_node_impl.h b/vpr/src/route/rr_node_impl.h index 61fb01f8baf..e863d942cf7 100644 --- a/vpr/src/route/rr_node_impl.h +++ b/vpr/src/route/rr_node_impl.h @@ -123,9 +123,9 @@ inline short t_rr_node::yhigh() const { return storage_->node_yhigh(id_); } -inline short t_rr_node::capacity() const { +/*inline short t_rr_node::capacity() const { // no longer used return storage_->node_capacity(id_); -} +}*/ inline short t_rr_node::ptc_num() const { return storage_->node_ptc_num(id_); From 93dc1a5720f86b3932e6d226f5b297e15f427f29 Mon Sep 17 00:00:00 2001 From: Ethan Rogers Date: Thu, 17 Jun 2021 19:39:52 -0600 Subject: [PATCH 7/8] Removed some commented out code and also the get_node_capacity() function; Signed-off-by: Ethan Rogers --- vpr/src/route/gen/rr_graph_uxsdcxx.h | 4 +++- vpr/src/route/gen/rr_graph_uxsdcxx_capnp.h | 4 +++- vpr/src/route/gen/rr_graph_uxsdcxx_interface.h | 1 - vpr/src/route/rr_graph_uxsdcxx_serializer.h | 4 ---- vpr/src/route/rr_node.h | 2 -- vpr/src/route/rr_node_impl.h | 8 -------- 6 files changed, 6 insertions(+), 17 deletions(-) diff --git a/vpr/src/route/gen/rr_graph_uxsdcxx.h b/vpr/src/route/gen/rr_graph_uxsdcxx.h index b9ce441ae76..b70d1b01d67 100644 --- a/vpr/src/route/gen/rr_graph_uxsdcxx.h +++ b/vpr/src/route/gen/rr_graph_uxsdcxx.h @@ -23,6 +23,7 @@ #include #include #include "pugixml.hpp" +#include "globals.h" #include "rr_graph_uxsdcxx_interface.h" /* All uxsdcxx functions and structs live in this namespace. */ @@ -4282,10 +4283,11 @@ inline void write_rr_nodes(T& in, std::ostream& os, Context& context) { (void)os; (void)context; { + const auto& rr_graph = g_vpr_ctx.device().rr_graph; for (size_t i = 0, n = in.num_rr_nodes_node(context); i < n; i++) { auto child_context = in.get_rr_nodes_node(i, context); os << " #include #include "capnp/serialize.h" +#include "globals.h" #include "rr_graph_uxsdcxx.capnp.h" #include "rr_graph_uxsdcxx_interface.h" @@ -1182,7 +1183,8 @@ inline void write_rr_nodes_capnp_type(T& in, ucap::RrNodes::Builder& root, Conte for (size_t i = 0; i < num_rr_nodes_nodes; i++) { auto rr_nodes_node = rr_nodes_nodes[i]; auto child_context = in.get_rr_nodes_node(i, context); - rr_nodes_node.setCapacity(in.get_node_capacity(child_context)); + const auto& rr_graph = g_vpr_ctx.device().rr_graph; + rr_nodes_node.setCapacity(rr_graph.node_capacity(child_context.id())); if ((bool)in.get_node_direction(child_context)) rr_nodes_node.setDirection(conv_to_enum_node_direction(in.get_node_direction(child_context))); rr_nodes_node.setId(in.get_node_id(child_context)); diff --git a/vpr/src/route/gen/rr_graph_uxsdcxx_interface.h b/vpr/src/route/gen/rr_graph_uxsdcxx_interface.h index 56f8aa8f56d..3e3669b9972 100644 --- a/vpr/src/route/gen/rr_graph_uxsdcxx_interface.h +++ b/vpr/src/route/gen/rr_graph_uxsdcxx_interface.h @@ -462,7 +462,6 @@ class RrGraphBase { * * */ - virtual inline unsigned int get_node_capacity(typename ContextTypes::NodeReadContext& ctx) = 0; virtual inline enum_node_direction get_node_direction(typename ContextTypes::NodeReadContext& ctx) = 0; virtual inline void set_node_direction(enum_node_direction direction, typename ContextTypes::NodeWriteContext& ctx) = 0; virtual inline unsigned int get_node_id(typename ContextTypes::NodeReadContext& ctx) = 0; diff --git a/vpr/src/route/rr_graph_uxsdcxx_serializer.h b/vpr/src/route/rr_graph_uxsdcxx_serializer.h index f48e4c77ff3..1204b7fa519 100644 --- a/vpr/src/route/rr_graph_uxsdcxx_serializer.h +++ b/vpr/src/route/rr_graph_uxsdcxx_serializer.h @@ -800,10 +800,6 @@ class RrGraphSerializer final : public uxsd::RrGraphBase { return (*rr_nodes_)[n]; } - inline unsigned int get_node_capacity(const t_rr_node& node) final { - const auto& rr_graph = (*rr_graph_); - return rr_graph.node_capacity(node.id()); - } inline unsigned int get_node_id(const t_rr_node& node) final { return size_t(node.id()); } diff --git a/vpr/src/route/rr_node.h b/vpr/src/route/rr_node.h index 69c84de5c15..c269885c30c 100644 --- a/vpr/src/route/rr_node.h +++ b/vpr/src/route/rr_node.h @@ -100,8 +100,6 @@ class t_rr_node { short yhigh() const; signed short length() const; - //short capacity() const; // ESR API This function has been replaced by RRGraphView::node_capacity() - short ptc_num() const; short pin_num() const; //Same as ptc_num() but checks that type() is consistent short track_num() const; //Same as ptc_num() but checks that type() is consistent diff --git a/vpr/src/route/rr_node_impl.h b/vpr/src/route/rr_node_impl.h index e863d942cf7..eab3a5aa97a 100644 --- a/vpr/src/route/rr_node_impl.h +++ b/vpr/src/route/rr_node_impl.h @@ -71,10 +71,6 @@ inline t_rr_node t_rr_graph_storage::back() { return t_rr_node(this, RRNodeId(size() - 1)); } -/*inline t_rr_type t_rr_node::type() const { // No longer used - return storage_->node_type(id_); -}*/ - inline t_edge_size t_rr_node::num_edges() const { return storage_->num_edges(id_); } @@ -123,10 +119,6 @@ inline short t_rr_node::yhigh() const { return storage_->node_yhigh(id_); } -/*inline short t_rr_node::capacity() const { // no longer used - return storage_->node_capacity(id_); -}*/ - inline short t_rr_node::ptc_num() const { return storage_->node_ptc_num(id_); } From b3ea4b3a1263a2cb1bb062fc5c0e1e57d5eff994 Mon Sep 17 00:00:00 2001 From: Ethan Rogers Date: Fri, 18 Jun 2021 11:11:45 -0600 Subject: [PATCH 8/8] Added back in get_node_capacity() function. Signed-off-by: Ethan Rogers --- vpr/src/route/gen/rr_graph_uxsdcxx.h | 4 +--- vpr/src/route/gen/rr_graph_uxsdcxx_capnp.h | 4 +--- vpr/src/route/gen/rr_graph_uxsdcxx_interface.h | 1 + vpr/src/route/rr_graph_uxsdcxx_serializer.h | 5 +++++ 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/vpr/src/route/gen/rr_graph_uxsdcxx.h b/vpr/src/route/gen/rr_graph_uxsdcxx.h index b70d1b01d67..b9ce441ae76 100644 --- a/vpr/src/route/gen/rr_graph_uxsdcxx.h +++ b/vpr/src/route/gen/rr_graph_uxsdcxx.h @@ -23,7 +23,6 @@ #include #include #include "pugixml.hpp" -#include "globals.h" #include "rr_graph_uxsdcxx_interface.h" /* All uxsdcxx functions and structs live in this namespace. */ @@ -4283,11 +4282,10 @@ inline void write_rr_nodes(T& in, std::ostream& os, Context& context) { (void)os; (void)context; { - const auto& rr_graph = g_vpr_ctx.device().rr_graph; for (size_t i = 0, n = in.num_rr_nodes_node(context); i < n; i++) { auto child_context = in.get_rr_nodes_node(i, context); os << " #include #include "capnp/serialize.h" -#include "globals.h" #include "rr_graph_uxsdcxx.capnp.h" #include "rr_graph_uxsdcxx_interface.h" @@ -1183,8 +1182,7 @@ inline void write_rr_nodes_capnp_type(T& in, ucap::RrNodes::Builder& root, Conte for (size_t i = 0; i < num_rr_nodes_nodes; i++) { auto rr_nodes_node = rr_nodes_nodes[i]; auto child_context = in.get_rr_nodes_node(i, context); - const auto& rr_graph = g_vpr_ctx.device().rr_graph; - rr_nodes_node.setCapacity(rr_graph.node_capacity(child_context.id())); + rr_nodes_node.setCapacity(in.get_node_capacity(child_context)); if ((bool)in.get_node_direction(child_context)) rr_nodes_node.setDirection(conv_to_enum_node_direction(in.get_node_direction(child_context))); rr_nodes_node.setId(in.get_node_id(child_context)); diff --git a/vpr/src/route/gen/rr_graph_uxsdcxx_interface.h b/vpr/src/route/gen/rr_graph_uxsdcxx_interface.h index 3e3669b9972..56f8aa8f56d 100644 --- a/vpr/src/route/gen/rr_graph_uxsdcxx_interface.h +++ b/vpr/src/route/gen/rr_graph_uxsdcxx_interface.h @@ -462,6 +462,7 @@ class RrGraphBase { * * */ + virtual inline unsigned int get_node_capacity(typename ContextTypes::NodeReadContext& ctx) = 0; virtual inline enum_node_direction get_node_direction(typename ContextTypes::NodeReadContext& ctx) = 0; virtual inline void set_node_direction(enum_node_direction direction, typename ContextTypes::NodeWriteContext& ctx) = 0; virtual inline unsigned int get_node_id(typename ContextTypes::NodeReadContext& ctx) = 0; diff --git a/vpr/src/route/rr_graph_uxsdcxx_serializer.h b/vpr/src/route/rr_graph_uxsdcxx_serializer.h index 1204b7fa519..468d5364837 100644 --- a/vpr/src/route/rr_graph_uxsdcxx_serializer.h +++ b/vpr/src/route/rr_graph_uxsdcxx_serializer.h @@ -800,6 +800,11 @@ class RrGraphSerializer final : public uxsd::RrGraphBase { return (*rr_nodes_)[n]; } + inline unsigned int get_node_capacity(const t_rr_node& node) final { + const auto& rr_graph = (*rr_graph_); + return rr_graph.node_capacity(node.id()); + } + inline unsigned int get_node_id(const t_rr_node& node) final { return size_t(node.id()); }