diff --git a/vpr/src/device/rr_graph_builder.h b/vpr/src/device/rr_graph_builder.h index aa6fa17ea65..8b0efea358f 100644 --- a/vpr/src/device/rr_graph_builder.h +++ b/vpr/src/device/rr_graph_builder.h @@ -154,6 +154,16 @@ 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); + } + + /** @brief This function resize node storage to accomidate size RR nodes. */ + inline void resize_nodes(size_t size) { + node_storage_.resize(size); + } + /** brief Validate that edge data is partitioned correctly * @note This function is used to validate the correctness of the routing resource graph in terms * of graph attributes. Strongly recommend to call it when you finish the building a routing resource diff --git a/vpr/src/route/rr_graph.cpp b/vpr/src/route/rr_graph.cpp index b2758221276..5c41f1aac14 100644 --- a/vpr/src/route/rr_graph.cpp +++ b/vpr/src/route/rr_graph.cpp @@ -576,9 +576,9 @@ 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); + 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 diff --git a/vpr/src/route/rr_graph_uxsdcxx_serializer.h b/vpr/src/route/rr_graph_uxsdcxx_serializer.h index 5243ae0237b..1016fdf1ff4 100644 --- a/vpr/src/route/rr_graph_uxsdcxx_serializer.h +++ b/vpr/src/route/rr_graph_uxsdcxx_serializer.h @@ -755,7 +755,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