@@ -167,7 +167,6 @@ static void initial_placement_pl_macros(int macros_max_num_tries, int* free_loca
167
167
ClusterBlockId blk_id;
168
168
169
169
auto & cluster_ctx = g_vpr_ctx.clustering ();
170
- auto & device_ctx = g_vpr_ctx.device ();
171
170
auto & place_ctx = g_vpr_ctx.placement ();
172
171
173
172
auto & pl_macros = place_ctx.pl_macros ;
@@ -185,9 +184,7 @@ static void initial_placement_pl_macros(int macros_max_num_tries, int* free_loca
185
184
return lhs_num_tiles < rhs_num_tiles;
186
185
};
187
186
188
- if (device_ctx.has_multiple_equivalent_tiles ) {
189
- std::sort (sorted_pl_macros.begin (), sorted_pl_macros.end (), criteria);
190
- }
187
+ std::stable_sort (sorted_pl_macros.begin (), sorted_pl_macros.end (), criteria);
191
188
192
189
/* Macros are harder to place. Do them first */
193
190
for (auto pl_macro : sorted_pl_macros) {
@@ -196,57 +193,57 @@ static void initial_placement_pl_macros(int macros_max_num_tries, int* free_loca
196
193
197
194
// Assume that all the blocks in the macro are of the same type
198
195
blk_id = pl_macro.members [0 ].blk_index ;
199
- auto logical_block = cluster_ctx.clb_nlist .block_type (blk_id);
200
- auto type = pick_placement_type (logical_block, int (pl_macro.members .size ()), free_locations);
196
+ auto block_type = cluster_ctx.clb_nlist .block_type (blk_id);
201
197
202
- if (type == nullptr ) {
203
- VPR_FATAL_ERROR (VPR_ERROR_PLACE,
204
- " Initial placement failed.\n "
205
- " Could not place macro length %zu with head block %s (#%zu); not enough free locations of type %s (#%d).\n "
206
- " VPR cannot auto-size for your circuit, please resize the FPGA manually.\n " ,
207
- pl_macro.members .size (), cluster_ctx.clb_nlist .block_name (blk_id).c_str (), size_t (blk_id), logical_block->name , logical_block->index );
208
- }
209
-
210
- itype = type->index ;
211
-
212
- // Try to place the macro first, if can be placed - place them, otherwise try again
213
- for (itry = 0 ; itry < macros_max_num_tries && macro_placed == false ; itry++) {
214
- // Choose a random position for the head
215
- ipos = vtr::irand (free_locations[itype] - 1 );
198
+ for (auto tile_type : block_type->equivalent_tiles ) { // Try each possible tile type
199
+ itype = tile_type->index ;
216
200
217
- // Try to place the macro
218
- macro_placed = try_place_macro (itype, ipos, pl_macro);
201
+ // Try to place the macro first, if can be placed - place them, otherwise try again
202
+ for (itry = 0 ; itry < macros_max_num_tries && macro_placed == false ; itry++) {
203
+ // Choose a random position for the head
204
+ ipos = vtr::irand (free_locations[itype] - 1 );
219
205
220
- } // Finished all tries
221
-
222
- if (macro_placed == false ) {
223
- // if a macro still could not be placed after macros_max_num_tries times,
224
- // go through the chip exhaustively to find a legal placement for the macro
225
- // place the macro on the first location that is legal
226
- // then set macro_placed = true;
227
- // if there are no legal positions, error out
228
-
229
- // Exhaustive placement of carry macros
230
- for (ipos = 0 ; ipos < free_locations[itype] && macro_placed == false ; ipos++) {
231
206
// Try to place the macro
232
207
macro_placed = try_place_macro (itype, ipos, pl_macro);
233
208
234
- } // Exhausted all the legal placement position for this macro
209
+ } // Finished all tries
235
210
236
- // If macro could not be placed after exhaustive placement, error out
237
211
if (macro_placed == false ) {
238
- // Error out
239
- VPR_FATAL_ERROR (VPR_ERROR_PLACE,
240
- " Initial placement failed.\n "
241
- " Could not place macro length %zu with head block %s (#%zu); not enough free locations of type %s (#%d).\n "
242
- " Please manually size the FPGA because VPR can't do this yet.\n " ,
243
- pl_macro.members .size (), cluster_ctx.clb_nlist .block_name (blk_id).c_str (), size_t (blk_id), device_ctx.physical_tile_types [itype].name , itype);
212
+ // if a macro still could not be placed after macros_max_num_tries times,
213
+ // go through the chip exhaustively to find a legal placement for the macro
214
+ // place the macro on the first location that is legal
215
+ // then set macro_placed = true;
216
+ // if there are no legal positions, error out
217
+
218
+ // Exhaustive placement of carry macros
219
+ for (ipos = 0 ; ipos < free_locations[itype] && macro_placed == false ; ipos++) {
220
+ // Try to place the macro
221
+ macro_placed = try_place_macro (itype, ipos, pl_macro);
222
+
223
+ } // Exhausted all the legal placement position for this macro
224
+
225
+ // If macro could not be placed after exhaustive placement, error out
226
+ } else {
227
+ // This macro has been placed successfully
228
+ break ;
244
229
}
230
+ }
245
231
246
- } else {
247
- // This macro has been placed successfully, proceed to place the next macro
248
- continue ;
232
+ if (macro_placed == false ) {
233
+ std::vector<std::string> tried_types;
234
+ for (auto tile_type : block_type->equivalent_tiles ) {
235
+ tried_types.push_back (tile_type->name );
236
+ }
237
+ std::string tried_types_str = " {" + vtr::join (tried_types, " , " ) + " }" ;
238
+
239
+ // Error out
240
+ VPR_FATAL_ERROR (VPR_ERROR_PLACE,
241
+ " Initial placement failed.\n "
242
+ " Could not place macro length %zu with head block %s (#%zu); not enough free locations of type(s) %s.\n "
243
+ " Please manually size the FPGA because VPR can't do this yet.\n " ,
244
+ pl_macro.members .size (), cluster_ctx.clb_nlist .block_name (blk_id).c_str (), size_t (blk_id), tried_types_str.c_str ());
249
245
}
246
+
250
247
} // Finish placing all the pl_macros successfully
251
248
}
252
249
0 commit comments