Skip to content

Commit c57cb6c

Browse files
committed
[vpr][place] increase rlim init place gradually
1 parent 85344e2 commit c57cb6c

File tree

1 file changed

+30
-22
lines changed

1 file changed

+30
-22
lines changed

vpr/src/place/initial_placement.cpp

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ static bool find_centroid_neighbor(t_pl_loc& centroid_loc,
208208
bool search_for_empty,
209209
int r_lim,
210210
const BlkLocRegistry& blk_loc_registry,
211+
const PartitionRegion& pr,
211212
vtr::RngContainer& rng);
212213

213214
/**
@@ -403,8 +404,9 @@ bool find_subtile_in_location(t_pl_loc& centroid,
403404
static bool find_centroid_neighbor(t_pl_loc& centroid_loc,
404405
t_logical_block_type_ptr block_type,
405406
bool search_for_empty,
406-
int rlim,
407+
int /*rlim*/,
407408
const BlkLocRegistry& blk_loc_registry,
409+
const PartitionRegion& pr,
408410
vtr::RngContainer& rng) {
409411
const auto& compressed_block_grid = g_vpr_ctx.placement().compressed_block_grids[block_type->index];
410412
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,
415417
centroid_loc,
416418
num_layers);
417419

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+
}
421424

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,
423429
compressed_centroid_loc[centroid_loc_layer_num],
424430
first_rlim);
425431

426-
int delta_cx = search_range.xmax - search_range.xmin;
432+
int delta_cx = search_range.xmax - search_range.xmin;
427433

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;
432438

433-
t_physical_tile_loc to_compressed_loc;
434439

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+
}
445451

446452
if (!legal) {
447453
return false;
448454
}
449455

450456
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);
451459

452460
return legal;
453461
}
@@ -908,7 +916,7 @@ static bool try_centroid_placement(const t_pl_macro& pl_macro,
908916
//centroid suggestion was either occupied or does not match block type
909917
//try to find a near location that meet these requirements
910918
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);
912920
if (!neighbor_legal_loc) { //no neighbor candidate found
913921
return false;
914922
}

0 commit comments

Comments
 (0)