@@ -208,6 +208,7 @@ static bool find_centroid_neighbor(t_pl_loc& centroid_loc,
208
208
bool search_for_empty,
209
209
int r_lim,
210
210
const BlkLocRegistry& blk_loc_registry,
211
+ const PartitionRegion& pr,
211
212
vtr::RngContainer& rng);
212
213
213
214
/* *
@@ -403,8 +404,9 @@ bool find_subtile_in_location(t_pl_loc& centroid,
403
404
static bool find_centroid_neighbor (t_pl_loc& centroid_loc,
404
405
t_logical_block_type_ptr block_type,
405
406
bool search_for_empty,
406
- int rlim,
407
+ int /* rlim*/ ,
407
408
const BlkLocRegistry& blk_loc_registry,
409
+ const PartitionRegion& pr,
408
410
vtr::RngContainer& rng) {
409
411
const auto & compressed_block_grid = g_vpr_ctx.placement ().compressed_block_grids [block_type->index ];
410
412
const int num_layers = g_vpr_ctx.device ().grid .get_num_layers ();
@@ -415,39 +417,45 @@ static bool find_centroid_neighbor(t_pl_loc& centroid_loc,
415
417
centroid_loc,
416
418
num_layers);
417
419
418
- // range limit (rlim) set a limit for the neighbor search in the centroid placement
419
- // the neighbor location should be within the defined range to calculated centroid location
420
- int first_rlim = rlim;
420
+ size_t max_dim = 0 ;
421
+ for (int layer = 0 ; layer < num_layers; layer++) {
422
+ max_dim = std::max (max_dim, std::max (compressed_block_grid.get_num_rows (layer), compressed_block_grid.get_num_columns (layer)));
423
+ }
421
424
422
- auto search_range = get_compressed_grid_target_search_range (compressed_block_grid,
425
+ bool legal = false ;
426
+ t_physical_tile_loc to_compressed_loc;
427
+ for (int rlim = 1 ; rlim <= max_dim/2 ; rlim++) {
428
+ auto search_range = get_compressed_grid_target_search_range (compressed_block_grid,
423
429
compressed_centroid_loc[centroid_loc_layer_num],
424
430
first_rlim);
425
431
426
- int delta_cx = search_range.xmax - search_range.xmin ;
432
+ int delta_cx = search_range.xmax - search_range.xmin ;
427
433
428
- // Block has not been placed yet, so the "from" coords will be (-1, -1)
429
- int cx_from = OPEN;
430
- int cy_from = OPEN;
431
- int layer_from = centroid_loc_layer_num;
434
+ // Block has not been placed yet, so the "from" coords will be (-1, -1)
435
+ int cx_from = OPEN;
436
+ int cy_from = OPEN;
437
+ int layer_from = centroid_loc_layer_num;
432
438
433
- t_physical_tile_loc to_compressed_loc;
434
439
435
- bool legal = find_compatible_compressed_loc_in_range (block_type,
436
- delta_cx,
437
- {cx_from, cy_from, layer_from},
438
- search_range,
439
- to_compressed_loc,
440
- /* is_median=*/ false ,
441
- centroid_loc_layer_num,
442
- search_for_empty,
443
- blk_loc_registry,
444
- rng);
440
+ legal = find_compatible_compressed_loc_in_range (block_type,
441
+ delta_cx,
442
+ {cx_from, cy_from, layer_from},
443
+ search_range,
444
+ to_compressed_loc,
445
+ /* is_median=*/ false ,
446
+ centroid_loc_layer_num,
447
+ search_for_empty,
448
+ blk_loc_registry,
449
+ rng);
450
+ }
445
451
446
452
if (!legal) {
447
453
return false ;
448
454
}
449
455
450
456
compressed_grid_to_loc (block_type, to_compressed_loc, centroid_loc, rng);
457
+ bool found_subtile = find_subtile_in_location (centroid_loc, block_type, blk_loc_registry, pr, rng);
458
+ VTR_ASSERT (found_subtile);
451
459
452
460
return legal;
453
461
}
@@ -908,7 +916,7 @@ static bool try_centroid_placement(const t_pl_macro& pl_macro,
908
916
// centroid suggestion was either occupied or does not match block type
909
917
// try to find a near location that meet these requirements
910
918
if (!found_legal_subtile) {
911
- bool neighbor_legal_loc = find_centroid_neighbor (centroid_loc, block_type, false , rlim, blk_loc_registry, rng);
919
+ bool neighbor_legal_loc = find_centroid_neighbor (centroid_loc, block_type, true , rlim, blk_loc_registry, pr , rng);
912
920
if (!neighbor_legal_loc) { // no neighbor candidate found
913
921
return false ;
914
922
}
0 commit comments