@@ -149,10 +149,11 @@ NetCostHandler::NetCostHandler(const t_placer_opts& placer_opts,
149
149
* been recomputed. */
150
150
bb_update_status_.resize (num_nets, NetUpdateState::NOT_UPDATED_YET);
151
151
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_ ();
153
153
}
154
154
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 ;
156
157
auto & device_ctx = g_vpr_ctx.device ();
157
158
158
159
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
229
230
}
230
231
231
232
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_ ();
233
234
}
234
235
}
235
236
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_ () {
237
238
const auto & device_ctx = g_vpr_ctx.device ();
238
239
const auto & rr_graph = device_ctx.rr_graph ;
239
240
240
241
const size_t grid_height = device_ctx.grid .height ();
241
242
const size_t grid_width = device_ctx.grid .width ();
242
243
243
244
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 .);
245
246
246
247
vtr::NdMatrix<float , 2 > tile_num_inter_die_conn ({grid_width, grid_height}, 0 .);
247
248
@@ -271,47 +272,24 @@ void NetCostHandler::alloc_and_load_for_fast_vertical_cost_update_(float place_c
271
272
}
272
273
}
273
274
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 ];
276
276
// Initialize the first row and column
277
277
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 ] + \
279
279
tile_num_inter_die_conn[x][0 ];
280
280
}
281
281
282
282
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 ] + \
284
284
tile_num_inter_die_conn[0 ][y];
285
285
}
286
286
287
287
for (size_t x_high = 1 ; x_high < device_ctx.grid .width (); x_high++) {
288
288
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];
315
293
}
316
294
}
317
295
}
0 commit comments