Skip to content

Commit 6c38ea7

Browse files
authored
Merge pull request #2056 from ArashAhmadian/ortho_cost_fixup
removing rr_graph indexed data computation dependency on lookahead type
2 parents 5a9f0cf + 7a6fcbb commit 6c38ea7

File tree

6 files changed

+29
-33
lines changed

6 files changed

+29
-33
lines changed

vpr/src/base/vpr_types.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,10 @@ constexpr auto INVALID_BLOCK_ID = ClusterBlockId(-2);
109109
#endif
110110

111111
enum class e_router_lookahead {
112-
DONT_CARE = -1, /// AA: Used for when we don't care about the lookahead type, e.g. when serializing the rr_graph.
113-
CLASSIC, ///<VPR's classic lookahead (assumes uniform wire types)
114-
MAP, ///<Lookahead considering different wire types (see Oleg Petelin's MASc Thesis)
115-
EXTENDED_MAP, ///<Lookahead with a more extensive node sampling method
116-
NO_OP ///<A no-operation lookahead which always returns zero
112+
CLASSIC, ///<VPR's classic lookahead (assumes uniform wire types)
113+
MAP, ///<Lookahead considering different wire types (see Oleg Petelin's MASc Thesis)
114+
EXTENDED_MAP, ///<Lookahead with a more extensive node sampling method
115+
NO_OP ///<A no-operation lookahead which always returns zero
117116
};
118117

119118
enum class e_route_bb_update {

vpr/src/route/rr_graph.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,7 @@ static void rr_graph_externals(const std::vector<t_segment_inf>& segment_inf,
260260
const std::vector<t_segment_inf>& segment_inf_x,
261261
const std::vector<t_segment_inf>& segment_inf_y,
262262
int wire_to_rr_ipin_switch,
263-
enum e_base_cost_type base_cost_type,
264-
const enum e_router_lookahead lookahead_type);
263+
enum e_base_cost_type base_cost_type);
265264

266265
static t_clb_to_clb_directs* alloc_and_load_clb_to_clb_directs(const t_direct_inf* directs, const int num_directs, const int delayless_switch);
267266

@@ -299,7 +298,6 @@ static void build_rr_graph(const t_graph_type graph_type,
299298
const float R_minW_pmos,
300299
const enum e_base_cost_type base_cost_type,
301300
const enum e_clock_modeling clock_modeling,
302-
const enum e_router_lookahead lookahead_type,
303301
const t_direct_inf* directs,
304302
const int num_directs,
305303
int* wire_to_rr_ipin_switch,
@@ -362,7 +360,6 @@ void create_rr_graph(const t_graph_type graph_type,
362360
det_routing_arch->R_minW_pmos,
363361
router_opts.base_cost_type,
364362
router_opts.clock_modeling,
365-
router_opts.lookahead_type,
366363
directs, num_directs,
367364
&det_routing_arch->wire_to_rr_ipin_switch,
368365
Warnings);
@@ -429,7 +426,6 @@ static void build_rr_graph(const t_graph_type graph_type,
429426
const float R_minW_pmos,
430427
const enum e_base_cost_type base_cost_type,
431428
const enum e_clock_modeling clock_modeling,
432-
const enum e_router_lookahead lookahead_type,
433429
const t_direct_inf* directs,
434430
const int num_directs,
435431
int* wire_to_rr_ipin_switch,
@@ -834,7 +830,7 @@ static void build_rr_graph(const t_graph_type graph_type,
834830
//Save the channel widths for the newly constructed graph
835831
device_ctx.chan_width = nodes_per_chan;
836832

837-
rr_graph_externals(segment_inf, segment_inf_x, segment_inf_y, *wire_to_rr_ipin_switch, base_cost_type, lookahead_type);
833+
rr_graph_externals(segment_inf, segment_inf_x, segment_inf_y, *wire_to_rr_ipin_switch, base_cost_type);
838834

839835
check_rr_graph(graph_type, grid, types);
840836

@@ -1041,13 +1037,12 @@ static void rr_graph_externals(const std::vector<t_segment_inf>& segment_inf,
10411037
const std::vector<t_segment_inf>& segment_inf_x,
10421038
const std::vector<t_segment_inf>& segment_inf_y,
10431039
int wire_to_rr_ipin_switch,
1044-
enum e_base_cost_type base_cost_type,
1045-
const enum e_router_lookahead lookahead_type) {
1040+
enum e_base_cost_type base_cost_type) {
10461041
auto& device_ctx = g_vpr_ctx.device();
10471042
const auto& rr_graph = device_ctx.rr_graph;
10481043
add_rr_graph_C_from_switches(rr_graph.rr_switch_inf(RRSwitchId(wire_to_rr_ipin_switch)).Cin);
10491044
alloc_and_load_rr_indexed_data(segment_inf, segment_inf_x,
1050-
segment_inf_y, wire_to_rr_ipin_switch, base_cost_type, lookahead_type);
1045+
segment_inf_y, wire_to_rr_ipin_switch, base_cost_type);
10511046
//load_rr_index_segments(segment_inf.size());
10521047
}
10531048

vpr/src/route/rr_graph_indexed_data.cpp

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ void alloc_and_load_rr_indexed_data(const std::vector<t_segment_inf>& segment_in
5858
const std::vector<t_segment_inf>& segment_inf_x,
5959
const std::vector<t_segment_inf>& segment_inf_y,
6060
int wire_to_ipin_switch,
61-
enum e_base_cost_type base_cost_type,
62-
enum e_router_lookahead lookahed_type) {
61+
enum e_base_cost_type base_cost_type) {
6362
int length, i, index;
6463

6564
(void)segment_inf;
@@ -87,19 +86,24 @@ void alloc_and_load_rr_indexed_data(const std::vector<t_segment_inf>& segment_in
8786
}
8887
device_ctx.rr_indexed_data[RRIndexedDataId(IPIN_COST_INDEX)].T_linear = rr_graph.rr_switch_inf(RRSwitchId(wire_to_ipin_switch)).Tdel;
8988

90-
/* X-directed segments*/
9189
std::vector<int> ortho_costs;
9290

93-
if (lookahed_type == e_router_lookahead::CLASSIC) {
94-
ortho_costs = find_ortho_cost_index(segment_inf_x, segment_inf_y, X_AXIS);
91+
ortho_costs = find_ortho_cost_index(segment_inf_x, segment_inf_y, X_AXIS);
9592

96-
} else {
97-
std::vector<int> x_costs(segment_inf_x.size(), CHANX_COST_INDEX_START + segment_inf_x.size());
98-
std::vector<int> y_costs(segment_inf_y.size(), CHANX_COST_INDEX_START);
93+
/* AA: The code below should replace find_ortho_cost_index call once we deprecate the CLASSIC lookahead as it is the only lookahead
94+
* that actively uses the orthogonal cost indices. To avoid complicated dependencies with the rr_graph reader, regardless of the lookahead,
95+
* we walk to the rr_graph edges to get these indices. */
96+
/*
97+
*
98+
* std::vector<int> x_costs(segment_inf_x.size(), CHANX_COST_INDEX_START + segment_inf_x.size());
99+
* std::vector<int> y_costs(segment_inf_y.size(), CHANX_COST_INDEX_START);
100+
*
101+
* std::move(x_costs.begin(), x_costs.end(), std::back_inserter(ortho_costs));
102+
* std::move(y_costs.begin(), y_costs.end(), std::back_inserter(ortho_costs));
103+
*/
104+
105+
/* X-directed segments*/
99106

100-
std::move(x_costs.begin(), x_costs.end(), std::back_inserter(ortho_costs));
101-
std::move(y_costs.begin(), y_costs.end(), std::back_inserter(ortho_costs));
102-
}
103107
for (size_t iseg = 0; iseg < segment_inf_x.size(); ++iseg) {
104108
index = iseg + CHANX_COST_INDEX_START;
105109

@@ -116,7 +120,7 @@ void alloc_and_load_rr_indexed_data(const std::vector<t_segment_inf>& segment_in
116120
device_ctx.rr_indexed_data[RRIndexedDataId(index)].seg_index = segment_inf_x[iseg].seg_index;
117121
}
118122

119-
// Y-directed segments
123+
/* Y-directed segments*/
120124

121125
for (size_t iseg = segment_inf_x.size(); iseg < ortho_costs.size(); ++iseg) {
122126
index = iseg + CHANX_COST_INDEX_START;

vpr/src/route/rr_graph_indexed_data.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ void alloc_and_load_rr_indexed_data(const std::vector<t_segment_inf>& segment_in
66
const std::vector<t_segment_inf>& segment_inf_x,
77
const std::vector<t_segment_inf>& segment_inf_y,
88
int wire_to_ipin_switch,
9-
enum e_base_cost_type base_cost_type,
10-
const enum e_router_lookahead lookahead_type);
9+
enum e_base_cost_type base_cost_type);
1110

1211
void load_rr_index_segments(const int num_segment);
1312

vpr/src/route/rr_graph_sbox.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ vtr::NdMatrix<std::vector<int>, 3> alloc_and_load_switch_block_conn(t_chan_width
8686
/* This routine permutes the track number to connect for topologies
8787
* SUBSET, UNIVERSAL, and WILTON. I added FULL (for fully flexible topology)
8888
* but the returned value is simply a dummy, since we don't need to permute
89-
* what connections to make for FULL (connect to EVERYTHING) */
89+
* what connections to make for FULL (connect to EVERYTHING)
90+
* */
91+
9092
int get_simple_switch_block_track(const enum e_side from_side,
9193
const enum e_side to_side,
9294
const int from_track,

vpr/src/route/rr_graph_uxsdcxx_serializer.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,15 +1568,12 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
15681568
auto segment_inf_x_ = get_parallel_segs(temp_rr_segs, seg_index_map, X_AXIS);
15691569
auto segment_inf_y_ = get_parallel_segs(temp_rr_segs, seg_index_map, Y_AXIS);
15701570

1571-
/*AA: e_router_lookahead::DONT_CARE is used as a place holder. The lookahead type only has control over the orthocost indeces vector
1572-
* which is only relevant to the classic lookahead. */
15731571
alloc_and_load_rr_indexed_data(
15741572
temp_rr_segs,
15751573
segment_inf_x_,
15761574
segment_inf_y_,
15771575
*wire_to_rr_ipin_switch_,
1578-
base_cost_type_,
1579-
e_router_lookahead::DONT_CARE);
1576+
base_cost_type_);
15801577

15811578
VTR_ASSERT(rr_indexed_data_->size() == seg_index_.size());
15821579
for (size_t i = 0; i < seg_index_.size(); ++i) {

0 commit comments

Comments
 (0)