Skip to content

Commit 8737d00

Browse files
committed
normalized the floorplanning_outside_of_tiles values
1 parent 64b1ace commit 8737d00

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

vpr/src/place/initial_placement.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ constexpr int INVALID_X = -1;
3030
// The amount of weight that will added to previous unplaced block scores to ensure that failed blocks would be placed earlier next iteration
3131
#define SORT_WEIGHT_PER_FAILED_BLOCK 10
3232

33+
// The amount of weight that will added to each tile which is outside of the floorplanning constraints
34+
#define SORT_WEIGHT_PER_TILES_OUTSIDE_OF_PR 100
35+
3336
/* The maximum number of tries when trying to place a macro at a *
3437
* random location before trying exhaustive placement - find the first *
3538
* legal position and place it during initial placement. */
@@ -822,7 +825,7 @@ static vtr::vector<ClusterBlockId, t_block_score> assign_block_scores() {
822825
if (is_cluster_constrained(blk_id)) {
823826
PartitionRegion pr = floorplan_ctx.cluster_constraints[blk_id];
824827
auto block_type = cluster_ctx.clb_nlist.block_type(blk_id);
825-
int floorplan_score = get_floorplan_score(blk_id, pr, block_type, grid_tiles);
828+
double floorplan_score = get_floorplan_score(blk_id, pr, block_type, grid_tiles);
826829
block_scores[blk_id].tiles_outside_of_floorplan_constraints = floorplan_score;
827830
}
828831
}
@@ -849,8 +852,8 @@ static void place_all_blocks(vtr::vector<ClusterBlockId, t_block_score>& block_s
849852
std::unordered_set<int> unplaced_blk_type_in_curr_itr;
850853

851854
auto criteria = [&block_scores, &cluster_ctx](const ClusterBlockId& lhs, const ClusterBlockId& rhs) {
852-
int lhs_score = 10 * block_scores[lhs].macro_size + block_scores[lhs].number_of_placed_connections + block_scores[lhs].tiles_outside_of_floorplan_constraints + SORT_WEIGHT_PER_FAILED_BLOCK * block_scores[lhs].failed_to_place_in_prev_attempts;
853-
int rhs_score = 10 * block_scores[rhs].macro_size + block_scores[rhs].number_of_placed_connections + block_scores[rhs].tiles_outside_of_floorplan_constraints + SORT_WEIGHT_PER_FAILED_BLOCK * block_scores[rhs].failed_to_place_in_prev_attempts;
855+
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;
856+
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;
854857

855858
return lhs_score < rhs_score;
856859
};
@@ -889,7 +892,7 @@ static void place_all_blocks(vtr::vector<ClusterBlockId, t_block_score>& block_s
889892

890893
auto blk_id_type = cluster_ctx.clb_nlist.block_type(blk_id);
891894
blocks_placed_since_heap_update++;
892-
895+
893896
bool block_placed = place_one_block(blk_id, pad_loc_type, &blk_types_empty_locs_in_grid[blk_id_type->index], &block_scores);
894897

895898
//update heap based on update_heap_freq calculated above

vpr/src/place/initial_placement.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct t_block_score {
1212
int macro_size = 0; //How many members does the macro have, if the block is part of one - this value is zero if the block is not in a macro
1313

1414
//The number of tiles NOT covered by the block's floorplan constraints.
15-
int tiles_outside_of_floorplan_constraints = 0;
15+
double tiles_outside_of_floorplan_constraints = 0;
1616

1717
//The number of initial placement iterations that the block was unplaced.
1818
int failed_to_place_in_prev_attempts;

vpr/src/place/place_constraints.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ int get_part_reg_size(PartitionRegion& pr, t_logical_block_type_ptr block_type,
425425
return num_tiles;
426426
}
427427

428-
int get_floorplan_score(ClusterBlockId blk_id, PartitionRegion& pr, t_logical_block_type_ptr block_type, GridTileLookup& grid_tiles) {
428+
double get_floorplan_score(ClusterBlockId blk_id, PartitionRegion& pr, t_logical_block_type_ptr block_type, GridTileLookup& grid_tiles) {
429429
auto& cluster_ctx = g_vpr_ctx.clustering();
430430

431431
int num_pr_tiles = get_part_reg_size(pr, block_type, grid_tiles);
@@ -441,5 +441,5 @@ int get_floorplan_score(ClusterBlockId blk_id, PartitionRegion& pr, t_logical_bl
441441

442442
int total_type_tiles = grid_tiles.total_type_tiles(block_type);
443443

444-
return total_type_tiles - num_pr_tiles;
444+
return (double)(total_type_tiles - num_pr_tiles)/total_type_tiles;
445445
}

vpr/src/place/place_constraints.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,6 @@ int get_part_reg_size(PartitionRegion& pr, t_logical_block_type_ptr block_type,
130130
* The resulting number is the number of tiles outside the block's floorplan region, meaning the higher
131131
* it is, the more difficult the block is to place.
132132
*/
133-
int get_floorplan_score(ClusterBlockId blk_id, PartitionRegion& pr, t_logical_block_type_ptr block_type, GridTileLookup& grid_tiles);
133+
double get_floorplan_score(ClusterBlockId blk_id, PartitionRegion& pr, t_logical_block_type_ptr block_type, GridTileLookup& grid_tiles);
134134

135135
#endif /* VPR_SRC_PLACE_PLACE_CONSTRAINTS_H_ */

vtr_flow/tasks/regression_tests/vtr_reg_strong/strong_post_routing_sync/config/config.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ qor_parse_file=qor_standard.txt
4444
pass_requirements_file=pass_requirements.txt
4545

4646
#Script parameters
47-
script_params=-track_memory_usage -check_equivalent -starting_stage abc --gen_post_synthesis_netlist on --sweep_dangling_primary_ios off --sweep_constant_primary_outputs off --seed 3
47+
script_params=-track_memory_usage -check_equivalent -starting_stage abc --gen_post_synthesis_netlist on --sweep_dangling_primary_ios off --sweep_constant_primary_outputs off --seed 2

0 commit comments

Comments
 (0)