Skip to content

Commit 5e8a495

Browse files
committed
[vpr][place] add adjust search range to find centriod neighbour
1 parent 17ec4a0 commit 5e8a495

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

vpr/src/place/initial_placement.cpp

+22-7
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ static std::vector<ClusterBlockId> find_centroid_loc(const t_pl_macro& pl_macro,
203203
*
204204
* @return true if the function can find any location near the centroid one, false otherwise.
205205
*/
206-
static bool find_centroid_neighbor(t_pl_loc& centroid_loc,
206+
static bool find_centroid_neighbor(ClusterBlockId block_id,
207+
t_pl_loc& centroid_loc,
207208
t_logical_block_type_ptr block_type,
208209
bool search_for_empty,
209210
int r_lim,
@@ -212,7 +213,8 @@ static bool find_centroid_neighbor(t_pl_loc& centroid_loc,
212213

213214
/**
214215
* @brief tries to place a macro at a centroid location of its placed connections.
215-
*
216+
*
217+
* @param block_id The block to be placed.
216218
* @param pl_macro The macro to be placed.
217219
* @param pr The PartitionRegion of the macro - represents its floorplanning constraints, is the size of the whole chip if the macro is not
218220
* constrained.
@@ -225,7 +227,8 @@ static bool find_centroid_neighbor(t_pl_loc& centroid_loc,
225227
*
226228
* @return true if the macro gets placed, false if not.
227229
*/
228-
static bool try_centroid_placement(const t_pl_macro& pl_macro,
230+
static bool try_centroid_placement(ClusterBlockId block_id,
231+
const t_pl_macro& pl_macro,
229232
const PartitionRegion& pr,
230233
t_logical_block_type_ptr block_type,
231234
e_pad_loc_type pad_loc_type,
@@ -400,7 +403,8 @@ bool find_subtile_in_location(t_pl_loc& centroid,
400403
return false;
401404
}
402405

403-
static bool find_centroid_neighbor(t_pl_loc& centroid_loc,
406+
static bool find_centroid_neighbor(ClusterBlockId block_id,
407+
t_pl_loc& centroid_loc,
404408
t_logical_block_type_ptr block_type,
405409
bool search_for_empty,
406410
int rlim,
@@ -425,6 +429,16 @@ static bool find_centroid_neighbor(t_pl_loc& centroid_loc,
425429

426430
int delta_cx = search_range.xmax - search_range.xmin;
427431

432+
bool search_range_adjusted = adjust_search_range(block_type,
433+
block_id,
434+
search_range,
435+
delta_cx,
436+
centroid_loc_layer_num);
437+
438+
if (!search_range_adjusted) {
439+
return false;
440+
}
441+
428442
//Block has not been placed yet, so the "from" coords will be (-1, -1)
429443
int cx_from = OPEN;
430444
int cy_from = OPEN;
@@ -832,7 +846,8 @@ static inline t_pl_loc find_nearest_compatible_loc(const t_flat_pl_loc& src_flat
832846
return best_loc;
833847
}
834848

835-
static bool try_centroid_placement(const t_pl_macro& pl_macro,
849+
static bool try_centroid_placement(ClusterBlockId block_id,
850+
const t_pl_macro& pl_macro,
836851
const PartitionRegion& pr,
837852
t_logical_block_type_ptr block_type,
838853
e_pad_loc_type pad_loc_type,
@@ -889,7 +904,7 @@ static bool try_centroid_placement(const t_pl_macro& pl_macro,
889904
//centroid suggestion was either occupied or does not match block type
890905
//try to find a near location that meet these requirements
891906
if (!found_legal_subtile) {
892-
bool neighbor_legal_loc = find_centroid_neighbor(centroid_loc, block_type, false, rlim, blk_loc_registry, rng);
907+
bool neighbor_legal_loc = find_centroid_neighbor(block_id, centroid_loc, block_type, false, rlim, blk_loc_registry, rng);
893908
if (!neighbor_legal_loc) { //no neighbor candidate found
894909
return false;
895910
}
@@ -1300,7 +1315,7 @@ static bool place_macro(int macros_max_num_tries,
13001315

13011316
if (!macro_placed) {
13021317
VTR_LOGV_DEBUG(g_vpr_ctx.placement().f_placer_debug, "\t\t\tTry centroid placement\n");
1303-
macro_placed = try_centroid_placement(pl_macro, pr, block_type, pad_loc_type, block_scores, blk_loc_registry, flat_placement_info, rng);
1318+
macro_placed = try_centroid_placement(blk_id, pl_macro, pr, block_type, pad_loc_type, block_scores, blk_loc_registry, flat_placement_info, rng);
13041319
}
13051320
VTR_LOGV_DEBUG(g_vpr_ctx.placement().f_placer_debug, "\t\t\tMacro is placed: %d\n", macro_placed);
13061321
// If macro is not placed yet, try to place the macro randomly for the max number of random tries

0 commit comments

Comments
 (0)