From 7a6fcbb43af4d8a2e75139c3e02269ce8f61dc6f Mon Sep 17 00:00:00 2001 From: Arash Ahmadian Date: Wed, 8 Jun 2022 21:29:41 -0400 Subject: [PATCH] removing rr_graph indexed data computation dependency on lookahead type --- vpr/src/base/vpr_types.h | 9 +++---- vpr/src/route/rr_graph.cpp | 13 +++------- vpr/src/route/rr_graph_indexed_data.cpp | 28 ++++++++++++--------- vpr/src/route/rr_graph_indexed_data.h | 3 +-- vpr/src/route/rr_graph_sbox.cpp | 4 ++- vpr/src/route/rr_graph_uxsdcxx_serializer.h | 5 +--- 6 files changed, 29 insertions(+), 33 deletions(-) diff --git a/vpr/src/base/vpr_types.h b/vpr/src/base/vpr_types.h index 7c762dbee2c..584762da50c 100644 --- a/vpr/src/base/vpr_types.h +++ b/vpr/src/base/vpr_types.h @@ -109,11 +109,10 @@ constexpr auto INVALID_BLOCK_ID = ClusterBlockId(-2); #endif enum class e_router_lookahead { - DONT_CARE = -1, /// AA: Used for when we don't care about the lookahead type, e.g. when serializing the rr_graph. - CLASSIC, ///& segment_inf, const std::vector& segment_inf_x, const std::vector& segment_inf_y, int wire_to_rr_ipin_switch, - enum e_base_cost_type base_cost_type, - const enum e_router_lookahead lookahead_type); + enum e_base_cost_type base_cost_type); 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); @@ -299,7 +298,6 @@ static void build_rr_graph(const t_graph_type graph_type, const float R_minW_pmos, const enum e_base_cost_type base_cost_type, const enum e_clock_modeling clock_modeling, - const enum e_router_lookahead lookahead_type, const t_direct_inf* directs, const int num_directs, int* wire_to_rr_ipin_switch, @@ -362,7 +360,6 @@ void create_rr_graph(const t_graph_type graph_type, det_routing_arch->R_minW_pmos, router_opts.base_cost_type, router_opts.clock_modeling, - router_opts.lookahead_type, directs, num_directs, &det_routing_arch->wire_to_rr_ipin_switch, Warnings); @@ -429,7 +426,6 @@ static void build_rr_graph(const t_graph_type graph_type, const float R_minW_pmos, const enum e_base_cost_type base_cost_type, const enum e_clock_modeling clock_modeling, - const enum e_router_lookahead lookahead_type, const t_direct_inf* directs, const int num_directs, int* wire_to_rr_ipin_switch, @@ -834,7 +830,7 @@ static void build_rr_graph(const t_graph_type graph_type, //Save the channel widths for the newly constructed graph device_ctx.chan_width = nodes_per_chan; - rr_graph_externals(segment_inf, segment_inf_x, segment_inf_y, *wire_to_rr_ipin_switch, base_cost_type, lookahead_type); + rr_graph_externals(segment_inf, segment_inf_x, segment_inf_y, *wire_to_rr_ipin_switch, base_cost_type); check_rr_graph(graph_type, grid, types); @@ -1041,13 +1037,12 @@ static void rr_graph_externals(const std::vector& segment_inf, const std::vector& segment_inf_x, const std::vector& segment_inf_y, int wire_to_rr_ipin_switch, - enum e_base_cost_type base_cost_type, - const enum e_router_lookahead lookahead_type) { + enum e_base_cost_type base_cost_type) { auto& device_ctx = g_vpr_ctx.device(); const auto& rr_graph = device_ctx.rr_graph; add_rr_graph_C_from_switches(rr_graph.rr_switch_inf(RRSwitchId(wire_to_rr_ipin_switch)).Cin); alloc_and_load_rr_indexed_data(segment_inf, segment_inf_x, - segment_inf_y, wire_to_rr_ipin_switch, base_cost_type, lookahead_type); + segment_inf_y, wire_to_rr_ipin_switch, base_cost_type); //load_rr_index_segments(segment_inf.size()); } diff --git a/vpr/src/route/rr_graph_indexed_data.cpp b/vpr/src/route/rr_graph_indexed_data.cpp index be36789d14e..63f7646714d 100644 --- a/vpr/src/route/rr_graph_indexed_data.cpp +++ b/vpr/src/route/rr_graph_indexed_data.cpp @@ -58,8 +58,7 @@ void alloc_and_load_rr_indexed_data(const std::vector& segment_in const std::vector& segment_inf_x, const std::vector& segment_inf_y, int wire_to_ipin_switch, - enum e_base_cost_type base_cost_type, - enum e_router_lookahead lookahed_type) { + enum e_base_cost_type base_cost_type) { int length, i, index; (void)segment_inf; @@ -87,19 +86,24 @@ void alloc_and_load_rr_indexed_data(const std::vector& segment_in } device_ctx.rr_indexed_data[RRIndexedDataId(IPIN_COST_INDEX)].T_linear = rr_graph.rr_switch_inf(RRSwitchId(wire_to_ipin_switch)).Tdel; - /* X-directed segments*/ std::vector ortho_costs; - if (lookahed_type == e_router_lookahead::CLASSIC) { - ortho_costs = find_ortho_cost_index(segment_inf_x, segment_inf_y, X_AXIS); + ortho_costs = find_ortho_cost_index(segment_inf_x, segment_inf_y, X_AXIS); - } else { - std::vector x_costs(segment_inf_x.size(), CHANX_COST_INDEX_START + segment_inf_x.size()); - std::vector y_costs(segment_inf_y.size(), CHANX_COST_INDEX_START); + /* AA: The code below should replace find_ortho_cost_index call once we deprecate the CLASSIC lookahead as it is the only lookahead + * that actively uses the orthogonal cost indices. To avoid complicated dependencies with the rr_graph reader, regardless of the lookahead, + * we walk to the rr_graph edges to get these indices. */ + /* + * + * std::vector x_costs(segment_inf_x.size(), CHANX_COST_INDEX_START + segment_inf_x.size()); + * std::vector y_costs(segment_inf_y.size(), CHANX_COST_INDEX_START); + * + * std::move(x_costs.begin(), x_costs.end(), std::back_inserter(ortho_costs)); + * std::move(y_costs.begin(), y_costs.end(), std::back_inserter(ortho_costs)); + */ + + /* X-directed segments*/ - std::move(x_costs.begin(), x_costs.end(), std::back_inserter(ortho_costs)); - std::move(y_costs.begin(), y_costs.end(), std::back_inserter(ortho_costs)); - } for (size_t iseg = 0; iseg < segment_inf_x.size(); ++iseg) { index = iseg + CHANX_COST_INDEX_START; @@ -116,7 +120,7 @@ void alloc_and_load_rr_indexed_data(const std::vector& segment_in device_ctx.rr_indexed_data[RRIndexedDataId(index)].seg_index = segment_inf_x[iseg].seg_index; } - // Y-directed segments + /* Y-directed segments*/ for (size_t iseg = segment_inf_x.size(); iseg < ortho_costs.size(); ++iseg) { index = iseg + CHANX_COST_INDEX_START; diff --git a/vpr/src/route/rr_graph_indexed_data.h b/vpr/src/route/rr_graph_indexed_data.h index 4ff7b312d24..bd25949e644 100644 --- a/vpr/src/route/rr_graph_indexed_data.h +++ b/vpr/src/route/rr_graph_indexed_data.h @@ -6,8 +6,7 @@ void alloc_and_load_rr_indexed_data(const std::vector& segment_in const std::vector& segment_inf_x, const std::vector& segment_inf_y, int wire_to_ipin_switch, - enum e_base_cost_type base_cost_type, - const enum e_router_lookahead lookahead_type); + enum e_base_cost_type base_cost_type); void load_rr_index_segments(const int num_segment); diff --git a/vpr/src/route/rr_graph_sbox.cpp b/vpr/src/route/rr_graph_sbox.cpp index a4fe3058cd6..04830f78529 100644 --- a/vpr/src/route/rr_graph_sbox.cpp +++ b/vpr/src/route/rr_graph_sbox.cpp @@ -86,7 +86,9 @@ vtr::NdMatrix, 3> alloc_and_load_switch_block_conn(t_chan_width /* This routine permutes the track number to connect for topologies * SUBSET, UNIVERSAL, and WILTON. I added FULL (for fully flexible topology) * but the returned value is simply a dummy, since we don't need to permute - * what connections to make for FULL (connect to EVERYTHING) */ + * what connections to make for FULL (connect to EVERYTHING) + * */ + int get_simple_switch_block_track(const enum e_side from_side, const enum e_side to_side, const int from_track, diff --git a/vpr/src/route/rr_graph_uxsdcxx_serializer.h b/vpr/src/route/rr_graph_uxsdcxx_serializer.h index ee522731697..40608d52b73 100644 --- a/vpr/src/route/rr_graph_uxsdcxx_serializer.h +++ b/vpr/src/route/rr_graph_uxsdcxx_serializer.h @@ -1568,15 +1568,12 @@ class RrGraphSerializer final : public uxsd::RrGraphBase { auto segment_inf_x_ = get_parallel_segs(temp_rr_segs, seg_index_map, X_AXIS); auto segment_inf_y_ = get_parallel_segs(temp_rr_segs, seg_index_map, Y_AXIS); - /*AA: e_router_lookahead::DONT_CARE is used as a place holder. The lookahead type only has control over the orthocost indeces vector - * which is only relevant to the classic lookahead. */ alloc_and_load_rr_indexed_data( temp_rr_segs, segment_inf_x_, segment_inf_y_, *wire_to_rr_ipin_switch_, - base_cost_type_, - e_router_lookahead::DONT_CARE); + base_cost_type_); VTR_ASSERT(rr_indexed_data_->size() == seg_index_.size()); for (size_t i = 0; i < seg_index_.size(); ++i) {