Skip to content

Commit 512eb7c

Browse files
committed
[vpr][place] add adjust_search_range
1 parent c94c8b8 commit 512eb7c

File tree

1 file changed

+36
-22
lines changed

1 file changed

+36
-22
lines changed

vpr/src/place/move_utils.cpp

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

17-
/**
18-
* @brief If the number of blocks compatible with the moving block is less than this value,
19-
* the search reagion is expanded to include all blocks in the column. It is specially useful
20-
* for IO blocks which are on the perimeter of the device. This would allow the IO blocks to
21-
* moved between top and bottom edges even when the rlim is small.
22-
*/
23-
size_t G_MIN_NUM_BLOCKS_IN_COLUMN = 3;
24-
2517
//f_placer_breakpoint_reached is used to stop the placer when a breakpoint is reached.
2618
// 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.
2719
//Note: The flag is only effective if compiled with VTR_ENABLE_DEBUG_LOGGING
@@ -37,26 +29,48 @@ void set_placer_breakpoint_reached(bool flag) {
3729
}
3830

3931
/**
40-
* @brief Expand the y-axis search range based on the number of blocks in the column
32+
* @brief Adjust the search range based on the block type and constraints
4133
*
34+
* @param block_id The block ID of the moving block
4235
* @param search_range The search range to adjust
43-
* @param block_rows Compatible blocks in the column
36+
* @param delta_cx The delta x of the search range
37+
* @param to_layer_num The layer that the block is moving to
38+
* @return true if the search range was adjusted, false otherwise
4439
*/
45-
static void adjust_y_axis_search_range(t_bb& search_range,
46-
const vtr::flat_map2<int, t_physical_tile_loc>& block_rows) {
47-
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-
*/
40+
static bool adjust_search_range(ClusterBlockId block_id,
41+
t_bb& search_range,
42+
int& delta_cx,
43+
int to_layer_num) {
44+
45+
const auto& device_ctx = g_vpr_ctx.device();
46+
47+
auto block_type = get_block_type(block_id);
48+
auto block_constrained = is_cluster_constrained(block_id);
5349

54-
auto y_lower_iter = block_rows.begin();
55-
auto y_upper_iter = block_rows.end();
50+
if (block_constrained) {
51+
bool intersect = intersect_range_limit_with_floorplan_constraints(block_id,
52+
search_range,
53+
delta_cx,
54+
to_layer_num);
55+
if (!intersect) {
56+
return false;
57+
}
58+
}
5659

57-
search_range.ymin = y_lower_iter->first;
58-
search_range.ymax = (y_upper_iter - 1)->first;
60+
// TODO: Currently this is how we determine whether
61+
// the moving block is of type IO. We need to have a function
62+
// to infer IO type index (similar to what's done for CLBs)
63+
if (block_type->index == 1 && !block_constrained) {
64+
/* We empirically found that for the IO blocks,
65+
* Given their sparsity, we expand the y-axis search range
66+
* to include all blocks in the column
67+
*/
68+
const t_compressed_block_grid& compressed_block_grid = g_vpr_ctx.placement().compressed_block_grids[block_type->index];
69+
search_range.ymin = 0;
70+
search_range.ymax = compressed_block_grid.get_num_rows(to_layer_num) - 1;
5971
}
72+
73+
return true;
6074
}
6175

6276
e_create_move create_move(t_pl_blocks_to_be_moved& blocks_affected,

0 commit comments

Comments
 (0)