Skip to content

Commit d439ff8

Browse files
committed
vpr: place: base chanz_place_cost_fac on the average number of inter-die connections
1 parent 445e6d0 commit d439ff8

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

vpr/src/place/place.cpp

+11-7
Original file line numberDiff line numberDiff line change
@@ -4111,9 +4111,10 @@ static void alloc_and_load_for_fast_vertical_cost_update (float place_cost_exp)
41114111
const auto& device_ctx = g_vpr_ctx.device();
41124112
const auto& rr_graph = device_ctx.rr_graph;
41134113
const int num_tiles = device_ctx.grid.height() * device_ctx.grid.width();
4114-
vtr::NdMatrix<float, 3> tile_num_inter_die_conn({device_ctx.grid.width(),
4115-
device_ctx.grid.height(),
4116-
static_cast<size_t>(device_ctx.grid.get_num_layers())}, 0);
4114+
vtr::NdMatrix<float, 3> tile_num_inter_die_conn({static_cast<size_t>(device_ctx.grid.get_num_layers()),
4115+
device_ctx.grid.width(),
4116+
device_ctx.grid.height()}, 0);
4117+
int total_number_inter_die_conn = 0;
41174118

41184119
for (const auto& src_rr_node : rr_graph.nodes()) {
41194120
for (const auto& rr_edge_idx : rr_graph.configurable_edges(src_rr_node)) {
@@ -4124,7 +4125,8 @@ static void alloc_and_load_for_fast_vertical_cost_update (float place_cost_exp)
41244125
VTR_ASSERT(rr_graph.node_xlow(src_rr_node) == src_x && rr_graph.node_ylow(src_rr_node) == src_y);
41254126

41264127
int src_layer = rr_graph.node_layer(src_rr_node);
4127-
tile_num_inter_die_conn[src_x][src_y][src_layer]++;
4128+
tile_num_inter_die_conn[src_layer][src_x][src_y]++;
4129+
total_number_inter_die_conn++;
41284130
}
41294131
}
41304132

@@ -4136,12 +4138,14 @@ static void alloc_and_load_for_fast_vertical_cost_update (float place_cost_exp)
41364138
int src_y = rr_graph.node_yhigh(src_rr_node);
41374139
VTR_ASSERT(rr_graph.node_ylow(src_rr_node) == src_y && rr_graph.node_ylow(src_rr_node) == src_y);
41384140
int src_layer = rr_graph.node_layer(src_rr_node);
4139-
tile_num_inter_die_conn[src_x][src_y][src_layer]++;
4141+
tile_num_inter_die_conn[src_layer][src_x][src_y]++;
4142+
total_number_inter_die_conn++;
41404143
}
41414144
}
41424145
}
41434146

41444147
chanz_place_cost_fac[0][0][0][0][0][0] = tile_num_inter_die_conn[0][0][0];
4148+
float avg_num_inter_die_conn_per_tile = static_cast<float>(total_number_inter_die_conn) / num_tiles;
41454149

41464150
for (int layer_high_num = 1; layer_high_num < device_ctx.grid.get_num_layers(); layer_high_num++) {
41474151
for (int x_high = 1; x_high < (int)device_ctx.grid.width(); x_high++) {
@@ -4153,12 +4157,12 @@ static void alloc_and_load_for_fast_vertical_cost_update (float place_cost_exp)
41534157
for (int layer_num = layer_low_num; layer_num <= layer_high_num; layer_num++) {
41544158
for (int x = x_low; x <= x_high; x++) {
41554159
for (int y = y_low; y <= y_high; y++) {
4156-
num_inter_die_conn += tile_num_inter_die_conn[x][y][layer_num];
4160+
num_inter_die_conn += tile_num_inter_die_conn[layer_num][x][y];
41574161
}
41584162
}
41594163
}
41604164
chanz_place_cost_fac[layer_high_num][x_high][y_high][layer_low_num][x_low][y_low] =
4161-
(static_cast<float>(num_inter_die_conn) / num_tiles);
4165+
(avg_num_inter_die_conn_per_tile / num_inter_die_conn);
41624166

41634167
chanz_place_cost_fac[layer_high_num][x_high][y_high][layer_low_num][x_low][y_low] = pow(
41644168
(double)chanz_place_cost_fac[layer_high_num][x_high][y_high][layer_low_num][x_low][y_low],

0 commit comments

Comments
 (0)