Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2e4dc59

Browse files
committedApr 3, 2025·
[vpr][place] clean up the code
1 parent 75e9474 commit 2e4dc59

File tree

1 file changed

+11
-31
lines changed

1 file changed

+11
-31
lines changed
 

‎vpr/src/place/move_utils.cpp

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -40,43 +40,23 @@ void set_placer_breakpoint_reached(bool flag) {
4040
* @brief Expand the y-axis search range based on the number of blocks in the column
4141
*
4242
* @param search_range The search range to adjust
43-
* @param y_lower_iter The lower bound of the search range in the compressed grid
44-
* @param y_range The search range across the y-axis
45-
* @param type The type of the block to move
4643
* @param block_rows Compatible blocks in the column
4744
*/
4845
static void adjust_y_axis_search_range(t_bb& search_range,
49-
vtr::flat_map2<int, t_physical_tile_loc>::const_iterator& y_lower_iter,
50-
int& y_range,
51-
t_logical_block_type_ptr type,
5246
const vtr::flat_map2<int, t_physical_tile_loc>& block_rows) {
5347

54-
auto y_upper_iter = block_rows.upper_bound(search_range.ymax);
48+
if (block_rows.size() <= G_MIN_NUM_BLOCKS_IN_COLUMN) {
49+
/* The number of compatible blocks is less than
50+
* the minimum number of blocks in a column
51+
* Expand the search range to include all blocks in the column
52+
*/
5553

56-
if (block_rows.size() > G_MIN_NUM_BLOCKS_IN_COLUMN) {
57-
if (y_lower_iter->first > search_range.ymin) {
58-
//No valid blocks at this x location which are within rlim_y
59-
//
60-
if (type->index != 1) {
61-
continue;
62-
} else {
63-
//Fall back to allow the whole y range
64-
y_lower_iter = block_rows.begin();
65-
y_upper_iter = block_rows.end();
66-
67-
search_range.ymin = y_lower_iter->first;
68-
search_range.ymax = (y_upper_iter - 1)->first;
69-
}
70-
}
71-
} else { // search_range is not fixed and there are less than G_MIN_NUM_BLOCKS_IN_COLUMN blocks at this x location
72-
y_lower_iter = block_rows.begin();
73-
y_upper_iter = block_rows.end();
54+
auto y_lower_iter = block_rows.begin();
55+
auto y_upper_iter = block_rows.end();
7456

7557
search_range.ymin = y_lower_iter->first;
7658
search_range.ymax = (y_upper_iter - 1)->first;
7759
}
78-
79-
y_range = std::distance(y_lower_iter, y_upper_iter);
8060
}
8161

8262
e_create_move create_move(t_pl_blocks_to_be_moved& blocks_affected,
@@ -1060,16 +1040,16 @@ bool find_compatible_compressed_loc_in_range(t_logical_block_type_ptr type,
10601040
//The candidates are stored in a flat_map so we can efficiently find the set of valid
10611041
//candidates with upper/lower bound.
10621042
const auto& block_rows = compressed_block_grid.get_column_block_map(to_loc.x, to_layer_num);
1043+
if (!fixed_search_range) {
1044+
adjust_y_axis_search_range(search_range, block_rows);
1045+
}
1046+
10631047
auto y_lower_iter = block_rows.lower_bound(search_range.ymin);
10641048
auto y_upper_iter = block_rows.upper_bound(search_range.ymax);
10651049
if (y_lower_iter == block_rows.end()) {
10661050
continue;
10671051
}
10681052
int y_range = std::distance(y_lower_iter, y_upper_iter);
1069-
if (!fixed_search_range) {
1070-
y_lower_iter = adjust_y_axis_search_range(search_range, y_range, type, block_rows);
1071-
}
1072-
10731053
VTR_ASSERT(y_range >= 0);
10741054

10751055
//At this point we know y_lower_iter and y_upper_iter

0 commit comments

Comments
 (0)
Please sign in to comment.