Skip to content

removing rr_graph indexed data computation dependency on lookahead type #2056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions vpr/src/base/vpr_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, ///<VPR's classic lookahead (assumes uniform wire types)
MAP, ///<Lookahead considering different wire types (see Oleg Petelin's MASc Thesis)
EXTENDED_MAP, ///<Lookahead with a more extensive node sampling method
NO_OP ///<A no-operation lookahead which always returns zero
CLASSIC, ///<VPR's classic lookahead (assumes uniform wire types)
MAP, ///<Lookahead considering different wire types (see Oleg Petelin's MASc Thesis)
EXTENDED_MAP, ///<Lookahead with a more extensive node sampling method
NO_OP ///<A no-operation lookahead which always returns zero
};

enum class e_route_bb_update {
Expand Down
13 changes: 4 additions & 9 deletions vpr/src/route/rr_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ static void rr_graph_externals(const std::vector<t_segment_inf>& segment_inf,
const std::vector<t_segment_inf>& segment_inf_x,
const std::vector<t_segment_inf>& 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);

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -1041,13 +1037,12 @@ static void rr_graph_externals(const std::vector<t_segment_inf>& segment_inf,
const std::vector<t_segment_inf>& segment_inf_x,
const std::vector<t_segment_inf>& 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());
}

Expand Down
28 changes: 16 additions & 12 deletions vpr/src/route/rr_graph_indexed_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ void alloc_and_load_rr_indexed_data(const std::vector<t_segment_inf>& segment_in
const std::vector<t_segment_inf>& segment_inf_x,
const std::vector<t_segment_inf>& 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;
Expand Down Expand Up @@ -87,19 +86,24 @@ void alloc_and_load_rr_indexed_data(const std::vector<t_segment_inf>& 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<int> 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<int> x_costs(segment_inf_x.size(), CHANX_COST_INDEX_START + segment_inf_x.size());
std::vector<int> 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<int> x_costs(segment_inf_x.size(), CHANX_COST_INDEX_START + segment_inf_x.size());
* std::vector<int> 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;

Expand All @@ -116,7 +120,7 @@ void alloc_and_load_rr_indexed_data(const std::vector<t_segment_inf>& 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;
Expand Down
3 changes: 1 addition & 2 deletions vpr/src/route/rr_graph_indexed_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ void alloc_and_load_rr_indexed_data(const std::vector<t_segment_inf>& segment_in
const std::vector<t_segment_inf>& segment_inf_x,
const std::vector<t_segment_inf>& 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);

Expand Down
4 changes: 3 additions & 1 deletion vpr/src/route/rr_graph_sbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ vtr::NdMatrix<std::vector<int>, 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,
Expand Down
5 changes: 1 addition & 4 deletions vpr/src/route/rr_graph_uxsdcxx_serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -1568,15 +1568,12 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
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) {
Expand Down