Skip to content

Commit 7c6a282

Browse files
rename device_ctx.read_rr_graph_filename to loaded_rr_graph_filename and pass the correct argument to load_rr_file
1 parent 3be8914 commit 7c6a282

File tree

5 files changed

+26
-20
lines changed

5 files changed

+26
-20
lines changed

libs/librrgraph/src/io/rr_graph_reader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void load_rr_file(RRGraphBuilder* rr_graph_builder,
5454
int* wire_to_rr_ipin_switch,
5555
int* wire_to_rr_ipin_switch_between_dice,
5656
const char* read_rr_graph_name,
57-
std::string* read_rr_graph_filename,
57+
std::string* loaded_rr_graph_filename,
5858
bool read_edge_metadata,
5959
bool do_check_rr_graph,
6060
bool echo_enabled,
@@ -75,7 +75,7 @@ void load_rr_file(RRGraphBuilder* rr_graph_builder,
7575
wire_to_rr_ipin_switch_between_dice,
7676
do_check_rr_graph,
7777
read_rr_graph_name,
78-
read_rr_graph_filename,
78+
loaded_rr_graph_filename,
7979
read_edge_metadata,
8080
echo_enabled,
8181
echo_file_name,

libs/librrgraph/src/io/rr_graph_reader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void load_rr_file(RRGraphBuilder* rr_graph_builder,
2828
int* wire_to_rr_ipin_switch,
2929
int* wire_to_rr_ipin_switch_between_dice,
3030
const char* read_rr_graph_name,
31-
std::string* read_rr_graph_filename,
31+
std::string* loaded_rr_graph_filename,
3232
bool read_edge_metadata,
3333
bool do_check_rr_graph,
3434
bool echo_enabled,

libs/librrgraph/src/io/rr_graph_uxsdcxx_serializer.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
276276
int* wire_to_rr_ipin_switch_between_dice,
277277
bool do_check_rr_graph,
278278
const char* read_rr_graph_name,
279-
std::string* read_rr_graph_filename,
279+
std::string* loaded_rr_graph_filename,
280280
bool read_edge_metadata,
281281
bool echo_enabled,
282282
const char* echo_file_name,
@@ -303,7 +303,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
303303
, rr_graph_(rr_graph)
304304
, rr_switch_inf_(rr_switch_inf)
305305
, rr_indexed_data_(rr_indexed_data)
306-
, read_rr_graph_filename_(read_rr_graph_filename)
306+
, loaded_rr_graph_filename_(loaded_rr_graph_filename)
307307
, rr_rc_data_(rr_rc_data)
308308
, graph_type_(graph_type)
309309
, base_cost_type_(base_cost_type)
@@ -1825,9 +1825,9 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
18251825
(*rr_indexed_data_)[RRIndexedDataId(i)].seg_index = seg_index_[RRIndexedDataId(i)];
18261826
}
18271827

1828-
VTR_ASSERT(read_rr_graph_filename_ != nullptr);
1828+
VTR_ASSERT(loaded_rr_graph_filename_ != nullptr);
18291829
VTR_ASSERT(read_rr_graph_name_ != nullptr);
1830-
read_rr_graph_filename_->assign(read_rr_graph_name_);
1830+
loaded_rr_graph_filename_->assign(read_rr_graph_name_);
18311831

18321832
if (do_check_rr_graph_) {
18331833
check_rr_graph(*rr_graph_,
@@ -2162,7 +2162,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
21622162
vtr::vector<RRSwitchId, t_rr_switch_inf>* rr_switch_inf_;
21632163
vtr::vector<RRIndexedDataId, t_rr_indexed_data>* rr_indexed_data_;
21642164
t_rr_node_indices* rr_node_indices_;
2165-
std::string* read_rr_graph_filename_;
2165+
std::string* loaded_rr_graph_filename_;
21662166
std::vector<t_rr_rc_data>* rr_rc_data_;
21672167

21682168
// Constant data for loads and writes.

vpr/src/base/vpr_context.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,13 @@ struct DeviceContext : public Context {
271271
********************************************************************/
272272
t_clock_arch* clock_arch;
273273

274-
/**
275-
* @brief Name of rrgraph file read (if any).
276-
*
277-
* Used to determine when reading rrgraph if file is already loaded.
278-
*/
279-
std::string read_rr_graph_filename;
280-
std::string read_rr_edge_override_filename;
274+
/// @brief Name of rrgraph file read (if any).
275+
/// Used to determine if the file is already loaded when reading rrgraph.
276+
std::string loaded_rr_graph_filename;
277+
278+
/// @brief Name of rrgraph edge override file read (if any).
279+
/// Used to determine if the file is already loaded when reading rrgraph edge overrides.
280+
std::string loaded_rr_edge_override_filename;
281281

282282
/*******************************************************************
283283
* Place Related

vpr/src/route/rr_graph.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ void create_rr_graph(const t_graph_type graph_type,
775775
}
776776
} else {
777777
if (load_rr_graph) {
778-
if (device_ctx.read_rr_graph_filename != det_routing_arch->read_rr_graph_filename) {
778+
if (device_ctx.loaded_rr_graph_filename != det_routing_arch->read_rr_graph_filename) {
779779
free_rr_graph();
780780

781781
load_rr_file(&mutable_device_ctx.rr_graph_builder,
@@ -793,7 +793,7 @@ void create_rr_graph(const t_graph_type graph_type,
793793
&det_routing_arch->wire_to_rr_ipin_switch,
794794
&det_routing_arch->wire_to_arch_ipin_switch_between_dice,
795795
det_routing_arch->read_rr_graph_filename.c_str(),
796-
&det_routing_arch->read_rr_graph_filename,
796+
&mutable_device_ctx.loaded_rr_graph_filename,
797797
router_opts.read_rr_edge_metadata,
798798
router_opts.do_check_rr_graph,
799799
echo_enabled,
@@ -831,11 +831,16 @@ void create_rr_graph(const t_graph_type graph_type,
831831
router_opts.route_verbosity);
832832
}
833833

834-
if (!det_routing_arch->read_rr_graph_filename.empty() &&
835-
det_routing_arch->read_rr_graph_filename != device_ctx.read_rr_graph_filename) {
834+
// Check if there is an edge override file to read and that it is not already loaded.
835+
if (!det_routing_arch->read_rr_edge_override_filename.empty() &&
836+
det_routing_arch->read_rr_edge_override_filename != device_ctx.loaded_rr_edge_override_filename) {
837+
836838
load_rr_edge_overrides(det_routing_arch->read_rr_edge_override_filename,
837839
mutable_device_ctx.rr_graph_builder,
838840
device_ctx.rr_graph);
841+
842+
// Remember the loaded filename to avoid reloading it before the RR graph is cleared.
843+
mutable_device_ctx.loaded_rr_edge_override_filename = det_routing_arch->read_rr_edge_override_filename;
839844
}
840845
}
841846

@@ -2787,7 +2792,8 @@ void free_rr_graph() {
27872792
* allocated, as ALL the chunk allocated data is already free! */
27882793
auto& device_ctx = g_vpr_ctx.mutable_device();
27892794

2790-
device_ctx.read_rr_graph_filename.clear();
2795+
device_ctx.loaded_rr_graph_filename.clear();
2796+
device_ctx.loaded_rr_edge_override_filename.clear();
27912797

27922798
device_ctx.rr_graph_builder.clear();
27932799

0 commit comments

Comments
 (0)