@@ -55,7 +55,7 @@ static void clear_all_grid_locs();
5555 * 1) try_centroid_placement : tries to find a location based on the macro's logical connections.
5656 * 2) try_place_macro_randomly : if no smart location found in the centroid placement, the function tries
5757 * to place it randomly for the max number of tries.
58- * 3) try_place_macro_exhaustively : if neither placement alogrithms work, the function will find a location
58+ * 3) try_place_macro_exhaustively : if neither placement algorithms work, the function will find a location
5959 * for the macro by exhaustively searching all available locations.
6060 * If first iteration failed, next iteration calls dense placement for specific block types.
6161 *
@@ -92,13 +92,13 @@ static vtr::vector<ClusterBlockId, t_block_score> assign_block_scores();
9292static int get_y_loc_based_on_macro_direction (t_grid_empty_locs_block_type first_macro_loc, const t_pl_macro& pl_macro);
9393
9494/* *
95- * @brief Tries to get the first available location of a specific block type that can accomodate macro blocks
95+ * @brief Tries to get the first available location of a specific block type that can accommodate macro blocks
9696 *
9797 * @param loc The first available location that can place the macro blocks.
9898 * @param pl_macro The macro to be placed.
9999 * @param blk_types_empty_locs_in_grid first location (lowest y) and number of remaining blocks in each column for the blk_id type
100100 *
101- * @return index to a column of blk_types_empty_locs_in_grid that can accomodate pl_macro and location of first available location returned by reference
101+ * @return index to a column of blk_types_empty_locs_in_grid that can accommodate pl_macro and location of first available location returned by reference
102102 */
103103static int get_blk_type_first_loc (t_pl_loc& loc, const t_pl_macro& pl_macro, std::vector<t_grid_empty_locs_block_type>* blk_types_empty_locs_in_grid);
104104
@@ -144,7 +144,9 @@ static inline void fix_IO_block_types(const t_pl_macro& pl_macro, t_pl_loc loc,
144144 *
145145 * @return True if the location is legal for the macro head member, false otherwise.
146146 */
147- static bool is_loc_legal (t_pl_loc& loc, PartitionRegion& pr, t_logical_block_type_ptr block_type);
147+ static bool is_loc_legal (const t_pl_loc& loc,
148+ const PartitionRegion& pr,
149+ t_logical_block_type_ptr block_type);
148150
149151/* *
150152 * @brief Calculates a centroid location for a block based on its placed connections.
@@ -180,7 +182,7 @@ static bool find_centroid_neighbor(t_pl_loc& centroid_loc, t_logical_block_type_
180182 * @return true if the macro gets placed, false if not.
181183 */
182184static bool try_centroid_placement (const t_pl_macro& pl_macro,
183- PartitionRegion& pr,
185+ const PartitionRegion& pr,
184186 t_logical_block_type_ptr block_type,
185187 enum e_pad_loc_type pad_loc_type,
186188 vtr::vector<ClusterBlockId, t_block_score>& block_scores);
@@ -199,7 +201,7 @@ static bool try_centroid_placement(const t_pl_macro& pl_macro,
199201 * @return true if the macro gets placed, false if not.
200202 */
201203static bool try_dense_placement (const t_pl_macro& pl_macro,
202- PartitionRegion& pr,
204+ const PartitionRegion& pr,
203205 t_logical_block_type_ptr block_type,
204206 enum e_pad_loc_type pad_loc_type,
205207 std::vector<t_grid_empty_locs_block_type>* blk_types_empty_locs_in_grid);
@@ -253,7 +255,9 @@ bool is_block_placed(ClusterBlockId blk_id) {
253255 return (place_ctx.block_locs [blk_id].loc .x != INVALID_X);
254256}
255257
256- static bool is_loc_legal (t_pl_loc& loc, PartitionRegion& pr, t_logical_block_type_ptr block_type) {
258+ static bool is_loc_legal (const t_pl_loc& loc,
259+ const PartitionRegion& pr,
260+ t_logical_block_type_ptr block_type) {
257261 const auto & grid = g_vpr_ctx.device ().grid ;
258262 bool legal = false ;
259263
@@ -424,7 +428,11 @@ static std::vector<ClusterBlockId> find_centroid_loc(const t_pl_macro& pl_macro,
424428 return connected_blocks_to_update;
425429}
426430
427- static bool try_centroid_placement (const t_pl_macro& pl_macro, PartitionRegion& pr, t_logical_block_type_ptr block_type, enum e_pad_loc_type pad_loc_type, vtr::vector<ClusterBlockId, t_block_score>& block_scores) {
431+ static bool try_centroid_placement (const t_pl_macro& pl_macro,
432+ const PartitionRegion& pr,
433+ t_logical_block_type_ptr block_type,
434+ enum e_pad_loc_type pad_loc_type,
435+ vtr::vector<ClusterBlockId, t_block_score>& block_scores) {
428436 t_pl_loc centroid_loc (OPEN, OPEN, OPEN, OPEN);
429437 std::vector<ClusterBlockId> unplaced_blocks_to_update_their_score;
430438
@@ -453,7 +461,7 @@ static bool try_centroid_placement(const t_pl_macro& pl_macro, PartitionRegion&
453461 auto & device_ctx = g_vpr_ctx.device ();
454462 // choose the location's subtile if the centroid location is legal.
455463 // if the location is found within the "find_centroid_neighbor", it already has a subtile
456- // we don't need to find one agian
464+ // we don't need to find one again
457465 if (!neighbor_legal_loc) {
458466 const auto & compressed_block_grid = g_vpr_ctx.placement ().compressed_block_grids [block_type->index ];
459467 const auto & type = device_ctx.grid .get_physical_type ({centroid_loc.x , centroid_loc.y , centroid_loc.layer });
@@ -515,7 +523,7 @@ static void update_blk_type_first_loc(int blk_type_column_index,
515523static int get_blk_type_first_loc (t_pl_loc& loc,
516524 const t_pl_macro& pl_macro,
517525 std::vector<t_grid_empty_locs_block_type>* blk_types_empty_locs_in_grid) {
518- // loop over all empty locations and choose first column that can accomodate macro blocks
526+ // loop over all empty locations and choose first column that can accommodate macro blocks
519527 for (unsigned int empty_loc_index = 0 ; empty_loc_index < blk_types_empty_locs_in_grid->size (); empty_loc_index++) {
520528 auto first_empty_loc = blk_types_empty_locs_in_grid->at (empty_loc_index);
521529
@@ -743,7 +751,7 @@ bool try_place_macro_exhaustively(const t_pl_macro& pl_macro, const PartitionReg
743751}
744752
745753static bool try_dense_placement (const t_pl_macro& pl_macro,
746- PartitionRegion& pr,
754+ const PartitionRegion& pr,
747755 t_logical_block_type_ptr block_type,
748756 enum e_pad_loc_type pad_loc_type,
749757 std::vector<t_grid_empty_locs_block_type>* blk_types_empty_locs_in_grid) {
@@ -911,7 +919,7 @@ static vtr::vector<ClusterBlockId, t_block_score> assign_block_scores() {
911919 for (auto blk_id : cluster_ctx.clb_nlist .blocks ()) {
912920 block_scores[blk_id].number_of_placed_connections = 0 ;
913921 if (is_cluster_constrained (blk_id)) {
914- PartitionRegion pr = floorplan_ctx.cluster_constraints [blk_id];
922+ const PartitionRegion& pr = floorplan_ctx.cluster_constraints [blk_id];
915923 auto block_type = cluster_ctx.clb_nlist .block_type (blk_id);
916924 double floorplan_score = get_floorplan_score (blk_id, pr, block_type, grid_tiles);
917925 block_scores[blk_id].tiles_outside_of_floorplan_constraints = floorplan_score;
@@ -943,7 +951,7 @@ static void place_all_blocks([[maybe_unused]] const t_placer_opts& placer_opts,
943951 // keep tracks of which block types can not be placed in each iteration
944952 std::unordered_set<int > unplaced_blk_type_in_curr_itr;
945953
946- auto criteria = [&block_scores, &cluster_ctx](const ClusterBlockId& lhs, const ClusterBlockId& rhs) {
954+ auto criteria = [&block_scores, &cluster_ctx](ClusterBlockId lhs, ClusterBlockId rhs) {
947955 int lhs_score = block_scores[lhs].macro_size + block_scores[lhs].number_of_placed_connections + SORT_WEIGHT_PER_TILES_OUTSIDE_OF_PR * block_scores[lhs].tiles_outside_of_floorplan_constraints + SORT_WEIGHT_PER_FAILED_BLOCK * block_scores[lhs].failed_to_place_in_prev_attempts ;
948956 int rhs_score = block_scores[rhs].macro_size + block_scores[rhs].number_of_placed_connections + SORT_WEIGHT_PER_TILES_OUTSIDE_OF_PR * block_scores[rhs].tiles_outside_of_floorplan_constraints + SORT_WEIGHT_PER_FAILED_BLOCK * block_scores[rhs].failed_to_place_in_prev_attempts ;
949957
@@ -1146,6 +1154,7 @@ void initial_placement(const t_placer_opts& placer_opts,
11461154 * as fixed so they do not get moved during initial placement or later during the simulated annealing stage of placement*/
11471155 mark_fixed_blocks ();
11481156
1157+ // Compute and store compressed floorplanning constraints
11491158 alloc_and_load_compressed_cluster_constraints ();
11501159
11511160
0 commit comments