Skip to content

[Place] Expand search range for sparse blocks #2960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
0c355d8
[type] add is_fixed to t_bb
amin1377 Apr 1, 2025
42d06e7
[vpr][type] add comments for t_bb
amin1377 Apr 1, 2025
b80abb5
[place] expand search range if the number of blocks in the column is …
amin1377 Apr 1, 2025
0f038dc
make format
amin1377 Apr 1, 2025
271640b
[base][types] remove is_fixed from t_bb
amin1377 Apr 2, 2025
a2ae770
[vpr][place] adjust search range in another function
amin1377 Apr 2, 2025
01b55e8
[vpr][place] fix a typo
amin1377 Apr 2, 2025
df7a0c4
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 Apr 3, 2025
75e9474
[vpr][place] fix a typo
amin1377 Apr 3, 2025
2e4dc59
[vpr][place] clean up the code
amin1377 Apr 3, 2025
34c7571
[vpr][place] don't continue if there is no compatible block in the gi…
amin1377 Apr 3, 2025
c94c8b8
[vpr][place] check lower_iter afer adjustment
amin1377 Apr 3, 2025
512eb7c
[vpr][place] add adjust_search_range
amin1377 Apr 3, 2025
1da6e6d
[vpr][place] add adjust_search_range
amin1377 Apr 3, 2025
a1d67f7
make format
amin1377 Apr 3, 2025
9c4057a
Merge branch 'master' into placement_search_range
amin1377 Apr 24, 2025
a27a74f
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 Apr 26, 2025
58a3522
[vpr][place] use is_io_type to determine whether a block is of the ty…
amin1377 Apr 26, 2025
43e33fa
[libs][libarch] add is_io_type for logical types
amin1377 Apr 26, 2025
3ea75f2
[vpr][place] add comment for adjust_search_range
amin1377 Apr 26, 2025
ac7a821
[test] update strong results
amin1377 Apr 26, 2025
6871fc9
[test] update srong odin
amin1377 Apr 26, 2025
84790cf
[test] update basic_timing results
amin1377 Apr 26, 2025
9f8e498
[test] update parmys and odin res
amin1377 Apr 26, 2025
e2b0c9d
[test] update nightly test 1 res
amin1377 Apr 28, 2025
cf86a33
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 May 1, 2025
a97d8db
[vpr][place] don't skip the x if search range min is below the y found
amin1377 May 1, 2025
2dc79c9
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 May 12, 2025
fe99d5e
[vpr][place] search for another column if block is not io and lower_b…
amin1377 May 13, 2025
f9e8517
[vpr][place] remove adjust search range and adjust it inside find_com…
amin1377 May 14, 2025
dae25cc
[vpr][place] use a constexpr to compare the number of blocks in column
amin1377 May 14, 2025
ade994b
[vpr][place] pass block_constraint parameter to relevant functions in…
amin1377 May 14, 2025
96e9cc5
make format
amin1377 May 14, 2025
4a6e333
[vpr][place] move MIN_BLK_PER_COLUMN_EXPAND into the routine
amin1377 May 14, 2025
caaf456
make format
amin1377 May 14, 2025
af29e9d
[vpr][place] expand search range if block is io
amin1377 May 14, 2025
7070d1b
Revert "[vpr][place] expand search range if block is io"
amin1377 May 14, 2025
7c96daa
Revert "make format"
amin1377 May 14, 2025
057d0a9
Revert "[vpr][place] move MIN_BLK_PER_COLUMN_EXPAND into the routine"
amin1377 May 14, 2025
8c4a49b
Revert "make format"
amin1377 May 14, 2025
d416295
Revert "[vpr][place] pass block_constraint parameter to relevant func…
amin1377 May 14, 2025
4152246
Revert "[vpr][place] use a constexpr to compare the number of blocks …
amin1377 May 14, 2025
cfa8210
Revert "[vpr][place] remove adjust search range and adjust it inside …
amin1377 May 14, 2025
17ec4a0
[vpr][place] move adjust_search_range to move_utils.h so it can be ac…
amin1377 May 14, 2025
5e8a495
[vpr][place] add adjust search range to find centriod neighbour
amin1377 May 14, 2025
36e1eb6
[vpr][place] remove a special case in find_compatible_compressed_loc_…
amin1377 May 15, 2025
59a08eb
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-ve…
amin1377 May 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions vpr/src/base/vpr_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,16 +422,29 @@ struct t_net_power {
/**
* @brief Stores a 3D bounding box in terms of the minimum and
* maximum coordinates: x, y, layer
*
* @var xmin: The minimum x-coordinate of the bounding box
* @var xmax: The maximum x-coordinate of the bounding box
* @var ymin: The minimum y-coordinate of the bounding box
* @var ymax: The maximum y-coordinate of the bounding box
* @var layer_min: The minimum layer of the bounding box
* @var layer_max: The maximum layer of the bounding box
* @var is_fixed: Indicates whether the bounding box can be stretched.
* This is useful during placement, where the bounding box passed to the
* function (representing the placement range) may be stretched to find a
* better solution. However, if the block has a fixed floorplan, this
* flag is set to true to prevent changes during placement.
*/
struct t_bb {
t_bb() = default;
t_bb(int xmin_, int xmax_, int ymin_, int ymax_, int layer_min_, int layer_max_)
t_bb(int xmin_, int xmax_, int ymin_, int ymax_, int layer_min_, int layer_max_, bool is_fixed_ = false)
: xmin(xmin_)
, xmax(xmax_)
, ymin(ymin_)
, ymax(ymax_)
, layer_min(layer_min_)
, layer_max(layer_max_) {
, layer_max(layer_max_)
, is_fixed(is_fixed_) {
VTR_ASSERT(xmax_ >= xmin_);
VTR_ASSERT(ymax_ >= ymin_);
VTR_ASSERT(layer_max_ >= layer_min_);
Expand All @@ -442,6 +455,7 @@ struct t_bb {
int ymax = OPEN;
int layer_min = OPEN;
int layer_max = OPEN;
bool is_fixed = false;
};

/**
Expand Down
53 changes: 36 additions & 17 deletions vpr/src/place/move_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
#include "placer_state.h"
#include "PlacerCriticalities.h"

/**
* @brief If the number of blocks compatible with the moving block is less than this value,
* the search reagion is expanded to include all blocks in the column. It is specially useful
* for IO blocks which are on the perimeter of the device. This would allow the IO blocks to
* moved between top and bottom edges even when the rlim is small.
*/
size_t G_MIN_NUM_BLOCKS_IN_COLUMN = 3;

//f_placer_breakpoint_reached is used to stop the placer when a breakpoint is reached.
// 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.
//Note: The flag is only effective if compiled with VTR_ENABLE_DEBUG_LOGGING
Expand Down Expand Up @@ -1002,26 +1010,36 @@ bool find_compatible_compressed_loc_in_range(t_logical_block_type_ptr type,
//The candidates are stored in a flat_map so we can efficiently find the set of valid
//candidates with upper/lower bound.
const auto& block_rows = compressed_block_grid.get_column_block_map(to_loc.x, to_layer_num);
auto y_lower_iter = block_rows.lower_bound(search_range.ymin);
if (y_lower_iter == block_rows.end()) {
continue;
}
auto y_lower_iter = block_rows.begin();
auto y_upper_iter = block_rows.end();

auto y_upper_iter = block_rows.upper_bound(search_range.ymax);

if (y_lower_iter->first > search_range.ymin) {
//No valid blocks at this x location which are within rlim_y
//
if (type->index != 1)
if (block_rows.size() > G_MIN_NUM_BLOCKS_IN_COLUMN || search_range.is_fixed) {
y_lower_iter = block_rows.lower_bound(search_range.ymin);
if (y_lower_iter == block_rows.end()) {
continue;
else {
//Fall back to allow the whole y range
y_lower_iter = block_rows.begin();
y_upper_iter = block_rows.end();

search_range.ymin = y_lower_iter->first;
search_range.ymax = (y_upper_iter - 1)->first;
}
y_upper_iter = block_rows.upper_bound(search_range.ymax);

if (y_lower_iter->first > search_range.ymin) {
//No valid blocks at this x location which are within rlim_y
//
if (type->index != 1) {
continue;
} else if (!search_range.is_fixed) {
//Fall back to allow the whole y range
y_lower_iter = block_rows.begin();
y_upper_iter = block_rows.end();

search_range.ymin = y_lower_iter->first;
search_range.ymax = (y_upper_iter - 1)->first;
}
}
} else { // search_range is not fixed and there are less than G_MIN_NUM_BLOCKS_IN_COLUMN blocks at this x location
y_lower_iter = block_rows.begin();
y_upper_iter = block_rows.end();

search_range.ymin = y_lower_iter->first;
search_range.ymax = (y_upper_iter - 1)->first;
}

int y_range = std::distance(y_lower_iter, y_upper_iter);
Expand Down Expand Up @@ -1176,6 +1194,7 @@ bool intersect_range_limit_with_floorplan_constraints(ClusterBlockId b_from,
if (compressed_regions[0].empty()) {
return false;
}
search_range.is_fixed = true;

Region range_reg(search_range.xmin, search_range.ymin,
search_range.xmax, search_range.ymax, layer_num);
Expand Down
Loading