Skip to content

Commit b80abb5

Browse files
committed
[place] expand search range if the number of blocks in the column is less than a certain number
1 parent 42d06e7 commit b80abb5

File tree

1 file changed

+38
-18
lines changed

1 file changed

+38
-18
lines changed

vpr/src/place/move_utils.cpp

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
#include "placer_state.h"
1515
#include "PlacerCriticalities.h"
1616

17+
18+
/**
19+
* @brief If the number of blocks compatible with the moving block is less than this value,
20+
* the search reagion is expanded to include all blocks in the column. It is specially useful
21+
* for IO blocks which are on the perimeter of the device. This would allow the IO blocks to
22+
* moved between top and bottom edges even when the rlim is small.
23+
*/
24+
size_t G_MIN_NUM_BLOCKS_IN_COLUMN = 3;
25+
1726
//f_placer_breakpoint_reached is used to stop the placer when a breakpoint is reached.
1827
// When this flag is true, it stops the placer after the current perturbation. Thus, when a breakpoint is reached, this flag is set to true.
1928
//Note: The flag is only effective if compiled with VTR_ENABLE_DEBUG_LOGGING
@@ -1002,26 +1011,36 @@ bool find_compatible_compressed_loc_in_range(t_logical_block_type_ptr type,
10021011
//The candidates are stored in a flat_map so we can efficiently find the set of valid
10031012
//candidates with upper/lower bound.
10041013
const auto& block_rows = compressed_block_grid.get_column_block_map(to_loc.x, to_layer_num);
1005-
auto y_lower_iter = block_rows.lower_bound(search_range.ymin);
1006-
if (y_lower_iter == block_rows.end()) {
1007-
continue;
1008-
}
1009-
1010-
auto y_upper_iter = block_rows.upper_bound(search_range.ymax);
1011-
1012-
if (y_lower_iter->first > search_range.ymin) {
1013-
//No valid blocks at this x location which are within rlim_y
1014-
//
1015-
if (type->index != 1)
1014+
auto y_lower_iter = block_rows.begin();
1015+
auto y_upper_iter = block_rows.end();
1016+
1017+
if (block_rows.size() > G_MIN_NUM_BLOCKS_IN_COLUMN || search_range.is_fixed) {
1018+
y_lower_iter = block_rows.lower_bound(search_range.ymin);
1019+
if (y_lower_iter == block_rows.end()) {
10161020
continue;
1017-
else {
1018-
//Fall back to allow the whole y range
1019-
y_lower_iter = block_rows.begin();
1020-
y_upper_iter = block_rows.end();
1021-
1022-
search_range.ymin = y_lower_iter->first;
1023-
search_range.ymax = (y_upper_iter - 1)->first;
10241021
}
1022+
y_upper_iter = block_rows.upper_bound(search_range.ymax);
1023+
1024+
if (y_lower_iter->first > search_range.ymin) {
1025+
//No valid blocks at this x location which are within rlim_y
1026+
//
1027+
if (type->index != 1) {
1028+
continue;
1029+
} else if (!search_range.is_fixed) {
1030+
//Fall back to allow the whole y range
1031+
y_lower_iter = block_rows.begin();
1032+
y_upper_iter = block_rows.end();
1033+
1034+
search_range.ymin = y_lower_iter->first;
1035+
search_range.ymax = (y_upper_iter - 1)->first;
1036+
}
1037+
}
1038+
} else { // search_range is not fixed and there are less than G_MIN_NUM_BLOCKS_IN_COLUMN blocks at this x location
1039+
y_lower_iter = block_rows.begin();
1040+
y_upper_iter = block_rows.end();
1041+
1042+
search_range.ymin = y_lower_iter->first;
1043+
search_range.ymax = (y_upper_iter - 1)->first;
10251044
}
10261045

10271046
int y_range = std::distance(y_lower_iter, y_upper_iter);
@@ -1176,6 +1195,7 @@ bool intersect_range_limit_with_floorplan_constraints(ClusterBlockId b_from,
11761195
if (compressed_regions[0].empty()) {
11771196
return false;
11781197
}
1198+
search_range.is_fixed = true;
11791199

11801200
Region range_reg(search_range.xmin, search_range.ymin,
11811201
search_range.xmax, search_range.ymax, layer_num);

0 commit comments

Comments
 (0)