Skip to content

Commit d5a98a4

Browse files
bugfix: check if there is any unfixed Noc routers
If all routers are constrained, place_noc_routers_randomly crashes.
1 parent ca55771 commit d5a98a4

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

vpr/src/place/initial_noc_placement.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ static void place_noc_routers_randomly(std::vector<ClusterBlockId>& unfixed_rout
103103
* only once.
104104
*/
105105

106+
// check if all NoC routers have already been placed
107+
if (unfixed_routers.empty()) {
108+
return;
109+
}
110+
106111
// Make a copy of NoC physical routers because we want to change its order
107112
vtr::vector<NocRouterId, NocRouter> noc_phy_routers = noc_ctx.noc_model.get_noc_routers();
108113

vpr/src/place/initial_placement.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ static void clear_all_grid_locs();
6767
*
6868
* @return true if macro was placed, false if not.
6969
*/
70-
static bool place_macro(int macros_max_num_tries, const t_pl_macro& pl_macro, enum e_pad_loc_type pad_loc_type, std::vector<t_grid_empty_locs_block_type>* blk_types_empty_locs_in_grid, vtr::vector<ClusterBlockId, t_block_score>& block_scores);
70+
static bool place_macro(int macros_max_num_tries,
71+
const t_pl_macro& pl_macro,
72+
enum e_pad_loc_type pad_loc_type,
73+
std::vector<t_grid_empty_locs_block_type>* blk_types_empty_locs_in_grid,
74+
vtr::vector<ClusterBlockId, t_block_score>& block_scores);
7175

7276
/*
7377
* Assign scores to each block based on macro size and floorplanning constraints.
@@ -107,7 +111,10 @@ static int get_blk_type_first_loc(t_pl_loc& loc, const t_pl_macro& pl_macro, std
107111
* @param blk_types_empty_locs_in_grid first location (lowest y) and number of remaining blocks in each column for the blk_id type
108112
*
109113
*/
110-
static void update_blk_type_first_loc(int blk_type_column_index, t_logical_block_type_ptr block_type, const t_pl_macro& pl_macro, std::vector<t_grid_empty_locs_block_type>* blk_types_empty_locs_in_grid);
114+
static void update_blk_type_first_loc(int blk_type_column_index,
115+
t_logical_block_type_ptr block_type,
116+
const t_pl_macro& pl_macro,
117+
std::vector<t_grid_empty_locs_block_type>* blk_types_empty_locs_in_grid);
111118

112119
/**
113120
* @brief Initializes empty locations of the grid with a specific block type into vector for dense initial placement
@@ -212,7 +219,8 @@ static void check_initial_placement_legality() {
212219

213220
for (auto blk_id : cluster_ctx.clb_nlist.blocks()) {
214221
if (place_ctx.block_locs[blk_id].loc.x == INVALID_X) {
215-
VTR_LOG("Block %s (# %d) of type %s could not be placed during initial placement iteration %d\n", cluster_ctx.clb_nlist.block_name(blk_id).c_str(), blk_id, cluster_ctx.clb_nlist.block_type(blk_id)->name, MAX_INIT_PLACE_ATTEMPTS - 1);
222+
VTR_LOG("Block %s (# %d) of type %s could not be placed during initial placement iteration %d\n",
223+
cluster_ctx.clb_nlist.block_name(blk_id).c_str(), blk_id, cluster_ctx.clb_nlist.block_type(blk_id)->name, MAX_INIT_PLACE_ATTEMPTS - 1);
216224
unplaced_blocks++;
217225
}
218226
}

0 commit comments

Comments
 (0)