Skip to content

Commit 71258af

Browse files
author
Nathan Shreve
committed
Changing SINK locations creates bug when writing out the RR graph. So, only use this optimization if not writing out.
1 parent 7e61896 commit 71258af

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

libs/librrgraph/src/base/rr_graph_utils.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,6 @@ void set_sink_locs(const RRGraphView& rr_graph, RRGraphBuilder& rr_graph_builder
179179
auto x_avg = (short)round(std::accumulate(x_coords.begin(), x_coords.end(), 0.f) / (double)x_coords.size());
180180
auto y_avg = (short)round(std::accumulate(y_coords.begin(), y_coords.end(), 0.f) / (double)y_coords.size());
181181

182-
VTR_ASSERT(x_avg >= 0);
183-
VTR_ASSERT(y_avg >= 0);
184-
185182
RRNodeId node = node_pins.first;
186183
rr_graph_builder.set_node_coordinates(node, x_avg, y_avg, x_avg, y_avg);
187184
}

libs/librrgraph/src/base/rr_graph_utils.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,15 @@ vtr::vector<RRNodeId, std::vector<RREdgeId>> get_fan_in_list(const RRGraphView&
6363
* build_rr_graph() sets the location of SINK nodes to span the entire tile they are in. This function sets the location
6464
* of SINK nodes to be the average coordinate of the IPINs on their cluster block to which they are connected
6565
*
66-
* @note
67-
* This function only changes SINK locations in tiles which have dimensions greater than 1x1
66+
* @warning
67+
* 1. Do not call this function if the RR graph will be written out.<BR>
68+
* 2. If using flat routing, this function must be called before building the intra-cluster RR graph.
69+
*
70+
* @todo
71+
* Either when writing out the RR graph after this function has been called, or reading in an RR graph produced in VPR
72+
* after this function was called, an error occurs (many IPINs have no fanins). The reason for this error has not been
73+
* determined. However, this is quite a big issue, as choosing to write out the RR graph now significantly increases
74+
* runtime!
6875
*/
6976
void set_sink_locs(const RRGraphView& rr_graph, RRGraphBuilder& rr_graph_builder);
7077

terminal_out.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

vpr/src/route/rr_graph.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,8 @@ static void build_rr_graph(const t_graph_type graph_type,
643643
const int num_directs,
644644
int* wire_to_rr_ipin_switch,
645645
bool is_flat,
646-
int* Warnings);
646+
int* Warnings,
647+
bool writing_graph_out);
647648

648649
static void build_intra_cluster_rr_graph(const t_graph_type graph_type,
649650
const DeviceGrid& grid,
@@ -714,6 +715,9 @@ void create_rr_graph(const t_graph_type graph_type,
714715
router_opts.reorder_rr_graph_nodes_threshold,
715716
router_opts.reorder_rr_graph_nodes_seed);
716717
}
718+
719+
if (det_routing_arch->write_rr_graph_filename.empty())
720+
set_sink_locs(device_ctx.rr_graph, mutable_device_ctx.rr_graph_builder);
717721
}
718722
} else {
719723
free_rr_graph();
@@ -736,7 +740,8 @@ void create_rr_graph(const t_graph_type graph_type,
736740
directs, num_directs,
737741
&det_routing_arch->wire_to_rr_ipin_switch,
738742
is_flat,
739-
Warnings);
743+
Warnings,
744+
!det_routing_arch->write_rr_graph_filename.empty());
740745
}
741746
}
742747

@@ -957,7 +962,8 @@ static void build_rr_graph(const t_graph_type graph_type,
957962
const int num_directs,
958963
int* wire_to_rr_ipin_switch,
959964
bool is_flat,
960-
int* Warnings) {
965+
int* Warnings,
966+
bool writing_graph_out) {
961967
vtr::ScopedStartFinishTimer timer("Build routing resource graph");
962968

963969
/* Reset warning flag */
@@ -1438,7 +1444,9 @@ static void build_rr_graph(const t_graph_type graph_type,
14381444
}
14391445

14401446
// Get better locations for SINK nodes
1441-
set_sink_locs(rr_graph, device_ctx.rr_graph_builder);
1447+
// Note: this function is also called after load_rr_file() in create_rr_graph()
1448+
if (!writing_graph_out)
1449+
set_sink_locs(rr_graph, device_ctx.rr_graph_builder);
14421450

14431451
// We are done with building the RR Graph. Thus, we can clear the storages only used
14441452
// to build the RR Graph

0 commit comments

Comments
 (0)