Skip to content

Commit 1a3e56d

Browse files
committed
[vpr][place][net_cost] remove chanz_place_cost_fac_ calculation
1 parent 736d826 commit 1a3e56d

File tree

1 file changed

+13
-35
lines changed

1 file changed

+13
-35
lines changed

vpr/src/place/net_cost_handler.cpp

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,11 @@ NetCostHandler::NetCostHandler(const t_placer_opts& placer_opts,
149149
* been recomputed. */
150150
bb_update_status_.resize(num_nets, NetUpdateState::NOT_UPDATED_YET);
151151

152-
alloc_and_load_chan_w_factors_for_place_cost_(placer_opts_.place_cost_exp);
152+
alloc_and_load_chan_w_factors_for_place_cost_();
153153
}
154154

155-
void NetCostHandler::alloc_and_load_chan_w_factors_for_place_cost_(float place_cost_exp) {
155+
void NetCostHandler::alloc_and_load_chan_w_factors_for_place_cost_() {
156+
float place_cost_exp = placer_opts_.place_cost_exp;
156157
auto& device_ctx = g_vpr_ctx.device();
157158

158159
const int grid_height = device_ctx.grid.height();
@@ -229,19 +230,19 @@ void NetCostHandler::alloc_and_load_chan_w_factors_for_place_cost_(float place_c
229230
}
230231

231232
if (device_ctx.grid.get_num_layers() > 1) {
232-
alloc_and_load_for_fast_vertical_cost_update_(place_cost_exp);
233+
alloc_and_load_for_fast_vertical_cost_update_();
233234
}
234235
}
235236

236-
void NetCostHandler::alloc_and_load_for_fast_vertical_cost_update_(float place_cost_exp) {
237+
void NetCostHandler::alloc_and_load_for_fast_vertical_cost_update_() {
237238
const auto& device_ctx = g_vpr_ctx.device();
238239
const auto& rr_graph = device_ctx.rr_graph;
239240

240241
const size_t grid_height = device_ctx.grid.height();
241242
const size_t grid_width = device_ctx.grid.width();
242243

243244

244-
chanz_place_cost_fac_ = vtr::NdMatrix<float, 4>({grid_width, grid_height, grid_width, grid_height}, 0.);
245+
acc_tile_num_inter_die_conn_ = vtr::NdMatrix<int, 2>({grid_width, grid_height}, 0.);
245246

246247
vtr::NdMatrix<float, 2> tile_num_inter_die_conn({grid_width, grid_height}, 0.);
247248

@@ -271,47 +272,24 @@ void NetCostHandler::alloc_and_load_for_fast_vertical_cost_update_(float place_c
271272
}
272273
}
273274

274-
vtr::NdMatrix<float, 2> acc_tile_num_inter_die_conn({grid_width, grid_height}, 0.);
275-
acc_tile_num_inter_die_conn[0][0] = tile_num_inter_die_conn[0][0];
275+
acc_tile_num_inter_die_conn_[0][0] = tile_num_inter_die_conn[0][0];
276276
// Initialize the first row and column
277277
for (size_t x = 1; x < device_ctx.grid.width(); x++) {
278-
acc_tile_num_inter_die_conn[x][0] = acc_tile_num_inter_die_conn[x-1][0] + \
278+
acc_tile_num_inter_die_conn_[x][0] = acc_tile_num_inter_die_conn_[x-1][0] + \
279279
tile_num_inter_die_conn[x][0];
280280
}
281281

282282
for (size_t y = 1; y < device_ctx.grid.height(); y++) {
283-
acc_tile_num_inter_die_conn[0][y] = acc_tile_num_inter_die_conn[0][y-1] + \
283+
acc_tile_num_inter_die_conn_[0][y] = acc_tile_num_inter_die_conn_[0][y-1] + \
284284
tile_num_inter_die_conn[0][y];
285285
}
286286

287287
for (size_t x_high = 1; x_high < device_ctx.grid.width(); x_high++) {
288288
for (size_t y_high = 1; y_high < device_ctx.grid.height(); y_high++) {
289-
acc_tile_num_inter_die_conn[x_high][y_high] = acc_tile_num_inter_die_conn[x_high-1][y_high] + \
290-
acc_tile_num_inter_die_conn[x_high][y_high-1] - \
291-
acc_tile_num_inter_die_conn[x_high][y_high];
292-
}
293-
}
294-
295-
for (size_t x_high = 1; x_high < device_ctx.grid.width(); x_high++) {
296-
for (size_t y_high = 1; y_high < device_ctx.grid.height(); y_high++) {
297-
for (size_t x_low = 1; x_low <= x_high; x_low++) {
298-
for (size_t y_low = 1; y_low <= y_high; y_low++) {
299-
int num_inter_die_conn = acc_tile_num_inter_die_conn[x_high][y_high] - \
300-
acc_tile_num_inter_die_conn[x_low-1][y_high] - \
301-
acc_tile_num_inter_die_conn[x_high][y_low-1] + \
302-
acc_tile_num_inter_die_conn[x_low-1][y_low-1];
303-
int seen_num_tiles = (x_high - x_low + 1) * (y_high - y_low + 1);
304-
if (num_inter_die_conn == 0) {
305-
VTR_LOG_WARN("CHANZ place cost fac is 0 at (%lu,%lu), (%lu,%lu)\n", x_low, y_low, x_high, y_high);
306-
chanz_place_cost_fac_[x_high][y_high][x_low][y_low] = 1.0f;
307-
} else {
308-
chanz_place_cost_fac_[x_high][y_high][x_low][y_low] = seen_num_tiles / static_cast<float>(num_inter_die_conn);
309-
chanz_place_cost_fac_[x_high][y_high][x_low][y_low] = pow(
310-
(double)chanz_place_cost_fac_[x_high][y_high][x_low][y_low],
311-
(double)place_cost_exp);
312-
}
313-
}
314-
}
289+
acc_tile_num_inter_die_conn_[x_high][y_high] = acc_tile_num_inter_die_conn_[x_high-1][y_high] + \
290+
acc_tile_num_inter_die_conn_[x_high][y_high-1] - \
291+
acc_tile_num_inter_die_conn_[x_high-1][y_high-1] + \
292+
tile_num_inter_die_conn[x_high][y_high];
315293
}
316294
}
317295
}

0 commit comments

Comments
 (0)