Skip to content

Commit efbad52

Browse files
authored
Merge pull request #1905 from RapidSilicon/api_reserve_resize_nodes
Add a new APIs reserve_nodes() and resize_nodes to RRGraphBuilder
2 parents bbaefca + 99b0641 commit efbad52

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

vpr/src/device/rr_graph_builder.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,16 @@ class RRGraphBuilder {
154154
return node_storage_.count_rr_switches(num_arch_switches, arch_switch_inf, arch_switch_fanins);
155155
}
156156

157+
/** @brief This function reserve storage for RR nodes. */
158+
inline void reserve_nodes(size_t size) {
159+
node_storage_.reserve(size);
160+
}
161+
162+
/** @brief This function resize node storage to accomidate size RR nodes. */
163+
inline void resize_nodes(size_t size) {
164+
node_storage_.resize(size);
165+
}
166+
157167
/** brief Validate that edge data is partitioned correctly
158168
* @note This function is used to validate the correctness of the routing resource graph in terms
159169
* of graph attributes. Strongly recommend to call it when you finish the building a routing resource

vpr/src/route/rr_graph.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,9 +576,9 @@ static void build_rr_graph(const t_graph_type graph_type,
576576
size_t expected_node_count = num_rr_nodes;
577577
if (clock_modeling == DEDICATED_NETWORK) {
578578
expected_node_count += ClockRRGraphBuilder::estimate_additional_nodes(grid);
579-
device_ctx.rr_nodes.reserve(expected_node_count);
579+
device_ctx.rr_graph_builder.reserve_nodes(expected_node_count);
580580
}
581-
device_ctx.rr_nodes.resize(num_rr_nodes);
581+
device_ctx.rr_graph_builder.resize_nodes(num_rr_nodes);
582582

583583
/* These are data structures used by the the unidir opin mapping. They are used
584584
* to spread connections evenly for each segment type among the available

vpr/src/route/rr_graph_uxsdcxx_serializer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
755755
* </xs:complexType>
756756
*/
757757
inline void preallocate_rr_nodes_node(void*& /*ctx*/, size_t size) final {
758-
rr_nodes_->reserve(size);
758+
rr_graph_builder_->reserve_nodes(size);
759759
}
760760
inline int add_rr_nodes_node(void*& /*ctx*/, unsigned int capacity, unsigned int id, uxsd::enum_node_type type) final {
761761
// make_room_in_vector will not allocate if preallocate_rr_nodes_node

0 commit comments

Comments
 (0)