From 65c089253b0bdf474209785bf1b270920fee907c Mon Sep 17 00:00:00 2001 From: Muhammad Haris Zafar Date: Mon, 1 Nov 2021 10:32:10 +0500 Subject: [PATCH 1/4] Adding api reserve_nodes in rr_graph_builder.h --- vpr/src/device/rr_graph_builder.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vpr/src/device/rr_graph_builder.h b/vpr/src/device/rr_graph_builder.h index b47ef698d31..1639a980862 100644 --- a/vpr/src/device/rr_graph_builder.h +++ b/vpr/src/device/rr_graph_builder.h @@ -122,6 +122,11 @@ class RRGraphBuilder { return node_storage_.count_rr_switches(num_arch_switches, arch_switch_inf, arch_switch_fanins); } + /** @brief This function reserve storage for RR nodes. */ + inline void reserve_nodes(size_t size) { + node_storage_.reserve(size); + } + /* -- Internal data storage -- */ private: /* TODO: When the refactoring effort finishes, From 5427bcd796351a6d44c2106ca673c28324b8ed99 Mon Sep 17 00:00:00 2001 From: Muhammad Haris Zafar Date: Mon, 1 Nov 2021 10:37:29 +0500 Subject: [PATCH 2/4] Replacing api reserve from respective .cpp/.h files --- vpr/src/route/rr_graph.cpp | 2 +- vpr/src/route/rr_graph_uxsdcxx_serializer.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vpr/src/route/rr_graph.cpp b/vpr/src/route/rr_graph.cpp index ec112a6345d..ac2df1a4164 100644 --- a/vpr/src/route/rr_graph.cpp +++ b/vpr/src/route/rr_graph.cpp @@ -577,7 +577,7 @@ static void build_rr_graph(const t_graph_type graph_type, size_t expected_node_count = num_rr_nodes; if (clock_modeling == DEDICATED_NETWORK) { expected_node_count += ClockRRGraphBuilder::estimate_additional_nodes(grid); - device_ctx.rr_nodes.reserve(expected_node_count); + device_ctx.rr_graph_builder.reserve_nodes(expected_node_count); } device_ctx.rr_nodes.resize(num_rr_nodes); diff --git a/vpr/src/route/rr_graph_uxsdcxx_serializer.h b/vpr/src/route/rr_graph_uxsdcxx_serializer.h index b5792630be0..c836e4f2e1c 100644 --- a/vpr/src/route/rr_graph_uxsdcxx_serializer.h +++ b/vpr/src/route/rr_graph_uxsdcxx_serializer.h @@ -753,7 +753,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase { * */ inline void preallocate_rr_nodes_node(void*& /*ctx*/, size_t size) final { - rr_nodes_->reserve(size); + rr_graph_builder_->reserve_nodes(size); } inline int add_rr_nodes_node(void*& /*ctx*/, unsigned int capacity, unsigned int id, uxsd::enum_node_type type) final { // make_room_in_vector will not allocate if preallocate_rr_nodes_node From 43f284446a532ab1d6fa8290b8acfc1049ae35c8 Mon Sep 17 00:00:00 2001 From: Muhammad Haris Zafar Date: Mon, 1 Nov 2021 10:43:47 +0500 Subject: [PATCH 3/4] Adding api resize_nodes to rr_graph_builder.h --- vpr/src/device/rr_graph_builder.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vpr/src/device/rr_graph_builder.h b/vpr/src/device/rr_graph_builder.h index 1639a980862..2ab5207afc4 100644 --- a/vpr/src/device/rr_graph_builder.h +++ b/vpr/src/device/rr_graph_builder.h @@ -127,6 +127,11 @@ class RRGraphBuilder { node_storage_.reserve(size); } + /** @brief This function resize node storage to accomidate size RR nodes. */ + inline void resize_nodes(size_t size) { + node_storage_.resize(size); + } + /* -- Internal data storage -- */ private: /* TODO: When the refactoring effort finishes, From a08bc733d51c1beb8b6e25f2da16a2a09e1d3403 Mon Sep 17 00:00:00 2001 From: Muhammad Haris Zafar Date: Mon, 1 Nov 2021 10:49:18 +0500 Subject: [PATCH 4/4] Replacing api resize from respective .cpp/.h files --- vpr/src/route/rr_graph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vpr/src/route/rr_graph.cpp b/vpr/src/route/rr_graph.cpp index ac2df1a4164..9b8f646e119 100644 --- a/vpr/src/route/rr_graph.cpp +++ b/vpr/src/route/rr_graph.cpp @@ -579,7 +579,7 @@ static void build_rr_graph(const t_graph_type graph_type, expected_node_count += ClockRRGraphBuilder::estimate_additional_nodes(grid); device_ctx.rr_graph_builder.reserve_nodes(expected_node_count); } - device_ctx.rr_nodes.resize(num_rr_nodes); + device_ctx.rr_graph_builder.resize_nodes(num_rr_nodes); /* These are data structures used by the the unidir opin mapping. They are used * to spread connections evenly for each segment type among the available