@@ -415,8 +415,10 @@ static bool try_centroid_placement(t_pl_macro pl_macro, PartitionRegion& pr, t_l
415
415
416
416
// centroid suggestion was either occupied or does not match block type
417
417
// try to find a near location that meet these requirements
418
+ bool neighbor_legal_loc;
418
419
if (!is_loc_legal (centroid_loc, pr, block_type)) {
419
- if (!find_centroid_neighbor (centroid_loc, block_type)) { // no neighbor candidate found
420
+ neighbor_legal_loc = find_centroid_neighbor (centroid_loc, block_type);
421
+ if (!neighbor_legal_loc) { // no neighbor candidate found
420
422
return false ;
421
423
}
422
424
}
@@ -428,10 +430,14 @@ static bool try_centroid_placement(t_pl_macro pl_macro, PartitionRegion& pr, t_l
428
430
429
431
auto & device_ctx = g_vpr_ctx.device ();
430
432
// choose the location's subtile if the centroid location is legal.
431
- const auto & compressed_block_grid = g_vpr_ctx.placement ().compressed_block_grids [block_type->index ];
432
- auto & compatible_sub_tiles = compressed_block_grid.compatible_sub_tiles_for_tile .at (device_ctx.grid [centroid_loc.x ][centroid_loc.y ].type ->index );
433
- centroid_loc.sub_tile = compatible_sub_tiles[vtr::irand ((int )compatible_sub_tiles.size () - 1 )];
434
-
433
+ // if the location is found within the "find_centroid_neighbor", it already has a subtile
434
+ // we don't need to find one agian
435
+ if (!neighbor_legal_loc){
436
+ const auto & compressed_block_grid = g_vpr_ctx.placement ().compressed_block_grids [block_type->index ];
437
+ auto & compatible_sub_tiles = compressed_block_grid.compatible_sub_tiles_for_tile .at (device_ctx.grid [centroid_loc.x ][centroid_loc.y ].type ->index );
438
+ centroid_loc.sub_tile = compatible_sub_tiles[vtr::irand ((int )compatible_sub_tiles.size () - 1 )];
439
+ }
440
+
435
441
VTR_ASSERT (device_ctx.grid [centroid_loc.x ][centroid_loc.y ].width_offset == 0 );
436
442
VTR_ASSERT (device_ctx.grid [centroid_loc.x ][centroid_loc.y ].height_offset == 0 );
437
443
0 commit comments