@@ -284,22 +284,24 @@ void NetCostHandler::alloc_and_load_for_fast_vertical_cost_update_(float place_c
284
284
tile_num_inter_die_conn[0 ][y];
285
285
}
286
286
287
- for (size_t x_high = 0 ; x_high < device_ctx.grid .width (); x_high++) {
288
- for (size_t y_high = 0 ; y_high < device_ctx.grid .height (); y_high++) {
289
- for (int x_low = 0 ; x_low <= x_high; x_low++) {
290
- for (int y_low = 0 ; y_low <= y_high; y_low++) {
291
- int num_inter_die_conn = 0 ;
292
- for (int x = x_low; x <= x_high; x++) {
293
- for (int y = y_low; y <= y_high; y++) {
294
- num_inter_die_conn += tile_num_inter_die_conn[x][y];
295
- }
296
- }
287
+ for (size_t x_high = 1 ; x_high < device_ctx.grid .width (); x_high++) {
288
+ for (size_t y_high = 1 ; y_high < device_ctx.grid .height (); y_high++) {
289
+ for (size_t x_low = 1 ; x_low <= x_high; x_low++) {
290
+ for (size_t y_low = 1 ; y_low <= y_high; y_low++) {
291
+ int num_inter_die_conn = acc_tile_num_inter_die_conn[x_high][y_high] - \
292
+ acc_tile_num_inter_die_conn[x_low-1 ][y_high] - \
293
+ acc_tile_num_inter_die_conn[x_high][y_low-1 ] + \
294
+ acc_tile_num_inter_die_conn[x_low-1 ][y_low-1 ];
297
295
int seen_num_tiles = (x_high - x_low + 1 ) * (y_high - y_low + 1 );
298
- chanz_place_cost_fac_[x_high][y_high][x_low][y_low] = seen_num_tiles / static_cast <float >(num_inter_die_conn);
299
-
300
- chanz_place_cost_fac_[x_high][y_high][x_low][y_low] = pow (
301
- (double )chanz_place_cost_fac_[x_high][y_high][x_low][y_low],
302
- (double )place_cost_exp);
296
+ if (num_inter_die_conn == 0 ) {
297
+ VTR_LOG_WARN (" CHANZ place cost fac is 0 at (%lu,%lu), (%lu,%lu)\n " , x_low, y_low, x_high, y_high);
298
+ chanz_place_cost_fac_[x_high][y_high][x_low][y_low] = 1 .0f ;
299
+ } else {
300
+ chanz_place_cost_fac_[x_high][y_high][x_low][y_low] = seen_num_tiles / static_cast <float >(num_inter_die_conn);
301
+ chanz_place_cost_fac_[x_high][y_high][x_low][y_low] = pow (
302
+ (double )chanz_place_cost_fac_[x_high][y_high][x_low][y_low],
303
+ (double )place_cost_exp);
304
+ }
303
305
}
304
306
}
305
307
}
0 commit comments