From 3114118932f1cfb353a1410b57a80f4bb3106e4a Mon Sep 17 00:00:00 2001 From: hamzakhan-rs Date: Tue, 14 Sep 2021 16:53:57 +0500 Subject: [PATCH 1/5] adding api set_node_coordinate to rr_graph_builder.h/.cpp --- vpr/src/device/rr_graph_builder.cpp | 4 ++++ vpr/src/device/rr_graph_builder.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/vpr/src/device/rr_graph_builder.cpp b/vpr/src/device/rr_graph_builder.cpp index 6cf28ca276c..c658b91df23 100644 --- a/vpr/src/device/rr_graph_builder.cpp +++ b/vpr/src/device/rr_graph_builder.cpp @@ -50,3 +50,7 @@ void RRGraphBuilder::add_node_to_all_locs(RRNodeId node) { void RRGraphBuilder::clear() { node_lookup_.clear(); } + +void RRGraphBuilder::set_node_coordinates(RRNodeId id, short x1, short y1, short x2, short y2) { + node_storage_.set_node_coordinates(id, x1, y1, x2, y2); +} diff --git a/vpr/src/device/rr_graph_builder.h b/vpr/src/device/rr_graph_builder.h index fd722427521..e135e538ae2 100644 --- a/vpr/src/device/rr_graph_builder.h +++ b/vpr/src/device/rr_graph_builder.h @@ -55,6 +55,9 @@ class RRGraphBuilder { /** @brief Clear all the underlying data storage */ void clear(); + /** @brief Set the node coordinate */ + void set_node_coordinates(RRNodeId id, short x1, short y1, short x2, short y2); + /* -- Internal data storage -- */ private: /* TODO: When the refactoring effort finishes, From 5ffec55c66592017807f218b02202dc4a7e49b99 Mon Sep 17 00:00:00 2001 From: hamzakhan-rs Date: Wed, 15 Sep 2021 13:03:42 +0500 Subject: [PATCH 2/5] replace all the api set_node_coordinates usage in related .cpp/.h files --- vpr/src/route/clock_connection_builders.cpp | 3 ++- vpr/src/route/clock_network_builders.cpp | 10 ++++++---- vpr/src/route/rr_graph.cpp | 8 ++++---- vpr/src/route/rr_graph_uxsdcxx_serializer.h | 3 ++- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/vpr/src/route/clock_connection_builders.cpp b/vpr/src/route/clock_connection_builders.cpp index 48f9eb103eb..d6db4376c97 100644 --- a/vpr/src/route/clock_connection_builders.cpp +++ b/vpr/src/route/clock_connection_builders.cpp @@ -92,6 +92,7 @@ void RoutingToClockConnection::create_switches(const ClockRRGraphBuilder& clock_ RRNodeId RoutingToClockConnection::create_virtual_clock_network_sink_node(int x, int y) { auto& device_ctx = g_vpr_ctx.mutable_device(); auto& rr_graph = device_ctx.rr_nodes; + auto& rr_graph_builder = device_ctx.rr_graph_builder; auto& node_lookup = device_ctx.rr_graph_builder.node_lookup(); rr_graph.emplace_back(); RRNodeId node_index = RRNodeId(rr_graph.size() - 1); @@ -106,7 +107,7 @@ RRNodeId RoutingToClockConnection::create_virtual_clock_network_sink_node(int x, int ptc = max_ptc + 1; rr_graph.set_node_ptc_num(node_index, ptc); - rr_graph.set_node_coordinates(node_index, x, y, x, y); + rr_graph_builder.set_node_coordinates(node_index, x, y, x, y); rr_graph.set_node_capacity(node_index, 1); rr_graph.set_node_cost_index(node_index, SINK_COST_INDEX); rr_graph.set_node_type(node_index, SINK); diff --git a/vpr/src/route/clock_network_builders.cpp b/vpr/src/route/clock_network_builders.cpp index 5d26591faca..e782808ed3f 100644 --- a/vpr/src/route/clock_network_builders.cpp +++ b/vpr/src/route/clock_network_builders.cpp @@ -317,8 +317,9 @@ int ClockRib::create_chanx_wire(int x_start, rr_nodes->emplace_back(); auto node_index = rr_nodes->size() - 1; auto node = rr_nodes->back(); + RRNodeId chanx_node = RRNodeId(node_index); - node.set_coordinates(x_start, y, x_end, y); + rr_graph_builder.set_node_coordinates(chanx_node,x_start, y, x_end, y); node.set_type(CHANX); node.set_capacity(1); node.set_track_num(ptc_num); @@ -345,7 +346,7 @@ int ClockRib::create_chanx_wire(int x_start, /* Add the node to spatial lookup */ auto& rr_graph = (*rr_nodes); - RRNodeId chanx_node = RRNodeId(node_index); + /* TODO: Will replace these codes with an API add_node_to_all_locs() of RRGraphBuilder */ for (int ix = rr_graph.node_xlow(chanx_node); ix <= rr_graph.node_xhigh(chanx_node); ++ix) { for (int iy = rr_graph.node_ylow(chanx_node); iy <= rr_graph.node_yhigh(chanx_node); ++iy) { @@ -623,8 +624,9 @@ int ClockSpine::create_chany_wire(int y_start, rr_nodes->emplace_back(); auto node_index = rr_nodes->size() - 1; auto node = rr_nodes->back(); + RRNodeId chany_node = RRNodeId(node_index); - node.set_coordinates(x, y_start, x, y_end); + rr_graph_builder.set_node_coordinates(chany_node, x, y_start, x, y_end); node.set_type(CHANY); node.set_capacity(1); node.set_track_num(ptc_num); @@ -651,7 +653,7 @@ int ClockSpine::create_chany_wire(int y_start, /* Add the node to spatial lookup */ auto& rr_graph = (*rr_nodes); - RRNodeId chany_node = RRNodeId(node_index); + /* TODO: Will replace these codes with an API add_node_to_all_locs() of RRGraphBuilder */ for (int ix = rr_graph.node_xlow(chany_node); ix <= rr_graph.node_xhigh(chany_node); ++ix) { for (int iy = rr_graph.node_ylow(chany_node); iy <= rr_graph.node_yhigh(chany_node); ++iy) { diff --git a/vpr/src/route/rr_graph.cpp b/vpr/src/route/rr_graph.cpp index 35a0f23ebbb..7936afbe134 100644 --- a/vpr/src/route/rr_graph.cpp +++ b/vpr/src/route/rr_graph.cpp @@ -1429,7 +1429,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder, /* Things common to both SOURCEs and SINKs. */ L_rr_node.set_node_capacity(inode, class_inf[iclass].num_pins); - L_rr_node.set_node_coordinates(inode, i, j, i + type->width - 1, j + type->height - 1); + rr_graph_builder.set_node_coordinates(inode, i, j, i + type->width - 1, j + type->height - 1); float R = 0.; float C = 0.; L_rr_node.set_node_rc_index(inode, find_create_rr_rc_data(R, C)); @@ -1488,7 +1488,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder, //For those pins located on multiple sides, we save the rr node index //for the pin on all sides at which it exists //As such, multipler driver problem can be avoided. - L_rr_node.set_node_coordinates(inode, i + width_offset, j + height_offset, i + width_offset, j + height_offset); + rr_graph_builder.set_node_coordinates(inode, i + width_offset, j + height_offset, i + width_offset, j + height_offset); L_rr_node.add_node_side(inode, side); // Sanity check @@ -1660,10 +1660,10 @@ static void build_rr_chan(RRGraphBuilder& rr_graph_builder, L_rr_node.set_node_capacity(node, 1); /* GLOBAL routing handled elsewhere */ if (chan_type == CHANX) { - L_rr_node.set_node_coordinates(node, start, y_coord, end, y_coord); + rr_graph_builder.set_node_coordinates(node, start, y_coord, end, y_coord); } else { VTR_ASSERT(chan_type == CHANY); - L_rr_node.set_node_coordinates(node, x_coord, start, x_coord, end); + rr_graph_builder.set_node_coordinates(node, x_coord, start, x_coord, end); } int length = end - start + 1; diff --git a/vpr/src/route/rr_graph_uxsdcxx_serializer.h b/vpr/src/route/rr_graph_uxsdcxx_serializer.h index dcfdbbb5cd2..0876b8b6074 100644 --- a/vpr/src/route/rr_graph_uxsdcxx_serializer.h +++ b/vpr/src/route/rr_graph_uxsdcxx_serializer.h @@ -601,8 +601,9 @@ class RrGraphSerializer final : public uxsd::RrGraphBase { inline int init_node_loc(int& inode, int ptc, int xhigh, int xlow, int yhigh, int ylow) final { auto node = (*rr_nodes_)[inode]; + RRNodeId node_id = node.id(); - node.set_coordinates(xlow, ylow, xhigh, yhigh); + rr_graph_builder_->set_node_coordinates(node_id, xlow, ylow, xhigh, yhigh); node.set_ptc_num(ptc); return inode; } From 8eb33a765e87493b3f84bf37033d84dfb120dfec Mon Sep 17 00:00:00 2001 From: hamzakhan-rs Date: Wed, 15 Sep 2021 15:03:48 +0500 Subject: [PATCH 3/5] replace all the api set_node_coordinates usage in related .cpp/.h files --- vpr/src/route/clock_network_builders.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vpr/src/route/clock_network_builders.cpp b/vpr/src/route/clock_network_builders.cpp index e782808ed3f..be84daef20c 100644 --- a/vpr/src/route/clock_network_builders.cpp +++ b/vpr/src/route/clock_network_builders.cpp @@ -319,7 +319,7 @@ int ClockRib::create_chanx_wire(int x_start, auto node = rr_nodes->back(); RRNodeId chanx_node = RRNodeId(node_index); - rr_graph_builder.set_node_coordinates(chanx_node,x_start, y, x_end, y); + rr_graph_builder.set_node_coordinates(chanx_node, x_start, y, x_end, y); node.set_type(CHANX); node.set_capacity(1); node.set_track_num(ptc_num); @@ -653,7 +653,7 @@ int ClockSpine::create_chany_wire(int y_start, /* Add the node to spatial lookup */ auto& rr_graph = (*rr_nodes); - + /* TODO: Will replace these codes with an API add_node_to_all_locs() of RRGraphBuilder */ for (int ix = rr_graph.node_xlow(chany_node); ix <= rr_graph.node_xhigh(chany_node); ++ix) { for (int iy = rr_graph.node_ylow(chany_node); iy <= rr_graph.node_yhigh(chany_node); ++iy) { From cd66efd9881e0bc1750a8a3a86faabd1609f6c49 Mon Sep 17 00:00:00 2001 From: hamzakhan-rs Date: Wed, 15 Sep 2021 15:10:21 +0500 Subject: [PATCH 4/5] remove old api set_coordinates from rr_node.cpp/.h files --- vpr/src/route/rr_node.cpp | 8 -------- vpr/src/route/rr_node.h | 2 -- 2 files changed, 10 deletions(-) diff --git a/vpr/src/route/rr_node.cpp b/vpr/src/route/rr_node.cpp index b13ad34e3fe..f31c8c701ac 100644 --- a/vpr/src/route/rr_node.cpp +++ b/vpr/src/route/rr_node.cpp @@ -55,14 +55,6 @@ void t_rr_node::set_type(t_rr_type new_type) { storage_->set_node_type(id_, new_type); } -/* - * Pass in two coordinate variables describing location of node. - * They do not have to be in any particular order. - */ -void t_rr_node::set_coordinates(short x1, short y1, short x2, short y2) { - storage_->set_node_coordinates(id_, x1, y1, x2, y2); -} - void t_rr_node::set_ptc_num(short new_ptc_num) { storage_->set_node_ptc_num(id_, new_ptc_num); } diff --git a/vpr/src/route/rr_node.h b/vpr/src/route/rr_node.h index e4ed1fd4e15..23fc2acd558 100644 --- a/vpr/src/route/rr_node.h +++ b/vpr/src/route/rr_node.h @@ -110,8 +110,6 @@ class t_rr_node { public: //Mutators void set_type(t_rr_type new_type); - void set_coordinates(short x1, short y1, short x2, short y2); - void set_capacity(short); void set_ptc_num(short); From 37547b39a41ee0b9882bea4ccf983f6197919d71 Mon Sep 17 00:00:00 2001 From: hamzakhan-rs Date: Wed, 15 Sep 2021 17:59:30 +0500 Subject: [PATCH 5/5] remove old api set_coordinates from rr_node.cpp/.h files --- vpr/src/route/clock_network_builders.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vpr/src/route/clock_network_builders.cpp b/vpr/src/route/clock_network_builders.cpp index be84daef20c..2ea41e09370 100644 --- a/vpr/src/route/clock_network_builders.cpp +++ b/vpr/src/route/clock_network_builders.cpp @@ -346,7 +346,7 @@ int ClockRib::create_chanx_wire(int x_start, /* Add the node to spatial lookup */ auto& rr_graph = (*rr_nodes); - + /* TODO: Will replace these codes with an API add_node_to_all_locs() of RRGraphBuilder */ for (int ix = rr_graph.node_xlow(chanx_node); ix <= rr_graph.node_xhigh(chanx_node); ++ix) { for (int iy = rr_graph.node_ylow(chanx_node); iy <= rr_graph.node_yhigh(chanx_node); ++iy) {