Skip to content

Commit df1318b

Browse files
init rr_switch_offset_inf_ when RR graph is read from a file
1 parent 417bf61 commit df1318b

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

libs/librrgraph/src/io/rr_graph_reader.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ void load_rr_file(RRGraphBuilder* rr_graph_builder,
8383
rr_graph_builder,
8484
rr_graph,
8585
&rr_graph_builder->rr_switch(),
86+
&rr_graph_builder->rr_switch_offset_inf(),
8687
rr_indexed_data,
8788
rr_rc_data,
8889
arch_switch_inf,

libs/librrgraph/src/io/rr_graph_uxsdcxx_serializer.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
285285
RRGraphBuilder* rr_graph_builder,
286286
RRGraphView* rr_graph,
287287
vtr::vector<RRSwitchId, t_rr_switch_inf>* rr_switch_inf,
288+
vtr::vector<RRSwitchOffsetInfoId, t_rr_switch_offset_inf>* rr_switch_offset_inf,
288289
vtr::vector<RRIndexedDataId, t_rr_indexed_data>* rr_indexed_data,
289290
std::vector<t_rr_rc_data>* rr_rc_data,
290291
const std::vector<t_arch_switch_inf>& arch_switch_inf,
@@ -302,6 +303,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
302303
, rr_graph_builder_(rr_graph_builder)
303304
, rr_graph_(rr_graph)
304305
, rr_switch_inf_(rr_switch_inf)
306+
, rr_switch_offset_inf_(rr_switch_offset_inf)
305307
, rr_indexed_data_(rr_indexed_data)
306308
, read_rr_graph_filename_(read_rr_graph_filename)
307309
, rr_rc_data_(rr_rc_data)
@@ -624,6 +626,13 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
624626
// If make_room_in_vector was used for allocation, this ensures that
625627
// the final storage has no overhead.
626628
rr_switch_inf_->shrink_to_fit();
629+
630+
rr_switch_offset_inf_->reserve(rr_switch_inf_->size());
631+
std::ranges::transform(*rr_switch_inf_,
632+
std::back_inserter(*rr_switch_offset_inf_),
633+
[](const t_rr_switch_inf& rr_sw) -> t_rr_switch_offset_inf {
634+
return t_rr_switch_offset_inf{rr_sw};
635+
});
627636
}
628637

629638
/** Generated for complex type "meta":
@@ -2160,6 +2169,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
21602169
RRGraphBuilder* rr_graph_builder_;
21612170
RRGraphView* rr_graph_;
21622171
vtr::vector<RRSwitchId, t_rr_switch_inf>* rr_switch_inf_;
2172+
vtr::vector<RRSwitchOffsetInfoId, t_rr_switch_offset_inf>* rr_switch_offset_inf_;
21632173
vtr::vector<RRIndexedDataId, t_rr_indexed_data>* rr_indexed_data_;
21642174
t_rr_node_indices* rr_node_indices_;
21652175
std::string* read_rr_graph_filename_;

0 commit comments

Comments
 (0)