@@ -97,10 +97,7 @@ static std::unordered_set<FlatPlacementBinId> get_direct_neighbors_of_bin(
97
97
// the bounding box. We need to ensure that the bin represents a tile (not
98
98
// part of a tile). If it did represent part of a tile, this algorithm
99
99
// would need to change.
100
- VTR_ASSERT_DEBUG (static_cast <double >(bl_x) == bin_region.bottom_left ().x () &&
101
- static_cast <double >(bl_y) == bin_region.bottom_left ().y () &&
102
- static_cast <double >(bin_width) == bin_region.width () &&
103
- static_cast <double >(bin_height) == bin_region.height ());
100
+ VTR_ASSERT_DEBUG (static_cast <double >(bl_x) == bin_region.bottom_left ().x () && static_cast <double >(bl_y) == bin_region.bottom_left ().y () && static_cast <double >(bin_width) == bin_region.width () && static_cast <double >(bin_height) == bin_region.height ());
104
101
105
102
double placeable_region_width, placeable_region_height, placeable_region_depth;
106
103
std::tie (placeable_region_width, placeable_region_height, placeable_region_depth) = density_manager.get_overall_placeable_region_size ();
@@ -251,8 +248,7 @@ void FlowBasedLegalizer::compute_neighbors_of_bin(FlatPlacementBinId src_bin_id,
251
248
q.push (dir_neighbor_bin_id);
252
249
}
253
250
// Check if all of the models have been found in all directions.
254
- all_models_found_in_all_directions = all_up_found && all_down_found &&
255
- all_left_found && all_right_found;
251
+ all_models_found_in_all_directions = all_up_found && all_down_found && all_left_found && all_right_found;
256
252
}
257
253
258
254
// Assign the results into the neighbors of the bin.
@@ -437,7 +433,7 @@ std::vector<std::vector<FlatPlacementBinId>> FlowBasedLegalizer::get_paths(
437
433
const PrimitiveVector& starting_bin_supply = get_bin_supply (src_bin_id);
438
434
while (!queue.empty () && demand < starting_bin_supply) {
439
435
// Pop the current bin off the queue.
440
- std::vector<FlatPlacementBinId> & p = queue.front ();
436
+ std::vector<FlatPlacementBinId>& p = queue.front ();
441
437
FlatPlacementBinId tail_bin_id = p.back ();
442
438
// Look over its neighbors
443
439
for (FlatPlacementBinId neighbor_bin_id : bin_neighbors_[tail_bin_id]) {
@@ -500,8 +496,7 @@ std::vector<std::vector<FlatPlacementBinId>> FlowBasedLegalizer::get_paths(
500
496
starting_bin_supply.manhattan_norm ());
501
497
502
498
// Sort the paths in increasing order of cost.
503
- std::sort (paths.begin (), paths.end (), [&](const std::vector<FlatPlacementBinId>& a,
504
- const std::vector<FlatPlacementBinId>& b) {
499
+ std::sort (paths.begin (), paths.end (), [&](const std::vector<FlatPlacementBinId>& a, const std::vector<FlatPlacementBinId>& b) {
505
500
return bin_cost[a.back ()] < bin_cost[b.back ()];
506
501
});
507
502
@@ -730,11 +725,11 @@ struct SpreadingWindow {
730
725
} // namespace
731
726
732
727
BiPartitioningPartialLegalizer::BiPartitioningPartialLegalizer (
733
- const APNetlist& netlist,
734
- std::shared_ptr<FlatPlacementDensityManager> density_manager,
735
- int log_verbosity)
736
- : PartialLegalizer(netlist, log_verbosity)
737
- , density_manager_(density_manager) {}
728
+ const APNetlist& netlist,
729
+ std::shared_ptr<FlatPlacementDensityManager> density_manager,
730
+ int log_verbosity)
731
+ : PartialLegalizer(netlist, log_verbosity)
732
+ , density_manager_(density_manager) {}
738
733
739
734
/* *
740
735
* @brief Identify spreading windows which contain overfilled bins on the device
@@ -750,8 +745,8 @@ BiPartitioningPartialLegalizer::BiPartitioningPartialLegalizer(
750
745
* spreading easier.
751
746
*/
752
747
static std::vector<SpreadingWindow> identify_non_overlapping_windows (
753
- const APNetlist& netlist,
754
- FlatPlacementDensityManager& density_manager) {
748
+ const APNetlist& netlist,
749
+ FlatPlacementDensityManager& density_manager) {
755
750
// Identify overfilled bins
756
751
const std::unordered_set<FlatPlacementBinId>& overfilled_bins = density_manager.get_overfilled_bins ();
757
752
@@ -763,27 +758,27 @@ static std::vector<SpreadingWindow> identify_non_overlapping_windows(
763
758
size_t width, height, layers;
764
759
std::tie (width, height, layers) = density_manager.get_overall_placeable_region_size ();
765
760
vtr::PrefixSum2D<float > capacity_prefix_sum (width, height, [&](size_t x, size_t y) {
766
- FlatPlacementBinId bin_id = density_manager.get_bin (x, y, 0 );
767
- // For now we take the L1 norm of the bin divided by its area.
768
- // The L1 norm is just a count of the number of primitives that
769
- // can fit into the bin (without caring for primitive type). We
770
- // divide by area such that large bins (1x4 for example) get
771
- // normalized to 1x1 regions.
772
- const vtr::Rect <double >& bin_region = density_manager.flat_placement_bins ().bin_region (bin_id);
773
- float bin_area = bin_region.width () * bin_region.height ();
774
- return density_manager.get_bin_capacity (bin_id).manhattan_norm () / bin_area;
775
- });
761
+ FlatPlacementBinId bin_id = density_manager.get_bin (x, y, 0 );
762
+ // For now we take the L1 norm of the bin divided by its area.
763
+ // The L1 norm is just a count of the number of primitives that
764
+ // can fit into the bin (without caring for primitive type). We
765
+ // divide by area such that large bins (1x4 for example) get
766
+ // normalized to 1x1 regions.
767
+ const vtr::Rect <double >& bin_region = density_manager.flat_placement_bins ().bin_region (bin_id);
768
+ float bin_area = bin_region.width () * bin_region.height ();
769
+ return density_manager.get_bin_capacity (bin_id).manhattan_norm () / bin_area;
770
+ });
776
771
777
772
// Create a prefix sum for the utilization.
778
773
// The utilization of the bins will change between routing iterations, so
779
774
// this prefix sum must be recomputed.
780
775
vtr::PrefixSum2D<float > utilization_prefix_sum (width, height, [&](size_t x, size_t y) {
781
- FlatPlacementBinId bin_id = density_manager.get_bin (x, y, 0 );
782
- // This is computed the same way as the capacity prefix sum above.
783
- const vtr::Rect <double >& bin_region = density_manager.flat_placement_bins ().bin_region (bin_id);
784
- float bin_area = bin_region.width () * bin_region.height ();
785
- return density_manager.get_bin_utilization (bin_id).manhattan_norm () / bin_area;
786
- });
776
+ FlatPlacementBinId bin_id = density_manager.get_bin (x, y, 0 );
777
+ // This is computed the same way as the capacity prefix sum above.
778
+ const vtr::Rect <double >& bin_region = density_manager.flat_placement_bins ().bin_region (bin_id);
779
+ float bin_area = bin_region.width () * bin_region.height ();
780
+ return density_manager.get_bin_utilization (bin_id).manhattan_norm () / bin_area;
781
+ });
787
782
788
783
// 1) For each of the overfilled bins, create and store a minimum window.
789
784
// TODO: This is a very simple algorithm which currently only uses the number
@@ -808,8 +803,7 @@ static std::vector<SpreadingWindow> identify_non_overlapping_windows(
808
803
809
804
// If the region did not grow, exit. This is a maximal bin.
810
805
// TODO: Maybe print warning.
811
- if (new_xmin == region.xmin () && new_xmax == region.xmax () &&
812
- new_ymin == region.ymin () && new_ymax == region.ymax ()) {
806
+ if (new_xmin == region.xmin () && new_xmax == region.xmax () && new_ymin == region.ymin () && new_ymax == region.ymax ()) {
813
807
break ;
814
808
}
815
809
@@ -1040,15 +1034,15 @@ void BiPartitioningPartialLegalizer::legalize(PartialPlacement& p_placement) {
1040
1034
if (partition_dir == e_partition_dir::VERTICAL) {
1041
1035
// Sort the blocks in the window by the x coordinate.
1042
1036
std::sort (window.contained_blocks .begin (), window.contained_blocks .end (), [&](APBlockId a, APBlockId b) {
1043
- return p_placement.block_x_locs [a] < p_placement.block_x_locs [b];
1044
- });
1037
+ return p_placement.block_x_locs [a] < p_placement.block_x_locs [b];
1038
+ });
1045
1039
1046
1040
} else {
1047
1041
VTR_ASSERT (partition_dir == e_partition_dir::HORIZONTAL);
1048
1042
// Sort the blocks in the window by the y coordinate.
1049
1043
std::sort (window.contained_blocks .begin (), window.contained_blocks .end (), [&](APBlockId a, APBlockId b) {
1050
- return p_placement.block_y_locs [a] < p_placement.block_y_locs [b];
1051
- });
1044
+ return p_placement.block_y_locs [a] < p_placement.block_y_locs [b];
1045
+ });
1052
1046
}
1053
1047
1054
1048
// Find the pivot block position.
@@ -1092,4 +1086,3 @@ void BiPartitioningPartialLegalizer::legalize(PartialPlacement& p_placement) {
1092
1086
// Export the legalized placement to the partial placement.
1093
1087
density_manager_->export_placement_from_bins (p_placement);
1094
1088
}
1095
-
0 commit comments