@@ -28,52 +28,6 @@ void set_placer_breakpoint_reached(bool flag) {
28
28
f_placer_breakpoint_reached = flag;
29
29
}
30
30
31
- /* *
32
- * @brief Adjust the search range based on the block type and constraints
33
- *
34
- * If the block is an IO block, we expand the search range to include all blocks in the column
35
- * We found empirically that this is a good strategy for IO blocks given they are located in
36
- * the periphery for most FPGA architectures
37
- *
38
- * @param block_type The type of the block to move
39
- * @param block_id The block ID of the moving block
40
- * @param search_range The search range to adjust
41
- * @param delta_cx The delta x of the search range
42
- * @param to_layer_num The layer that the block is moving to
43
- *
44
- * @return true if the search range was adjusted, false otherwise
45
- */
46
- static bool adjust_search_range (t_logical_block_type_ptr block_type,
47
- ClusterBlockId block_id,
48
- t_bb& search_range,
49
- int & delta_cx,
50
- int to_layer_num) {
51
-
52
- auto block_constrained = is_cluster_constrained (block_id);
53
-
54
- if (block_constrained) {
55
- bool intersect = intersect_range_limit_with_floorplan_constraints (block_id,
56
- search_range,
57
- delta_cx,
58
- to_layer_num);
59
- if (!intersect) {
60
- return false ;
61
- }
62
- }
63
-
64
- if (is_io_type (block_type) && !block_constrained) {
65
- /* We empirically found that for the IO blocks,
66
- * Given their sparsity, we expand the y-axis search range
67
- * to include all blocks in the column
68
- */
69
- const t_compressed_block_grid& compressed_block_grid = g_vpr_ctx.placement ().compressed_block_grids [block_type->index ];
70
- search_range.ymin = 0 ;
71
- search_range.ymax = compressed_block_grid.get_num_rows (to_layer_num) - 1 ;
72
- }
73
-
74
- return true ;
75
- }
76
-
77
31
e_create_move create_move (t_pl_blocks_to_be_moved& blocks_affected,
78
32
ClusterBlockId b_from,
79
33
t_pl_loc to,
@@ -715,9 +669,16 @@ bool find_to_loc_uniform(t_logical_block_type_ptr type,
715
669
rlim);
716
670
int delta_cx = search_range.xmax - search_range.xmin ;
717
671
718
- bool adjust_search_range_res = adjust_search_range (type, b_from, search_range, delta_cx, to_layer_num);
719
- if (!adjust_search_range_res) {
720
- return false ;
672
+ auto block_constrained = is_cluster_constrained (b_from);
673
+
674
+ if (block_constrained) {
675
+ bool intersect = intersect_range_limit_with_floorplan_constraints (b_from,
676
+ search_range,
677
+ delta_cx,
678
+ to_layer_num);
679
+ if (!intersect) {
680
+ return false ;
681
+ }
721
682
}
722
683
723
684
t_physical_tile_loc to_compressed_loc;
@@ -731,6 +692,7 @@ bool find_to_loc_uniform(t_logical_block_type_ptr type,
731
692
/* is_median=*/ false ,
732
693
to_layer_num,
733
694
/* search_for_empty=*/ false ,
695
+ block_constrained,
734
696
blk_loc_registry,
735
697
rng);
736
698
@@ -802,9 +764,16 @@ bool find_to_loc_median(t_logical_block_type_ptr blk_type,
802
764
to_layer_num,
803
765
to_layer_num);
804
766
805
- bool adjust_search_range_res = adjust_search_range (blk_type, b_from, search_range, delta_cx, to_layer_num);
806
- if (!adjust_search_range_res) {
807
- return false ;
767
+ auto block_constrained = is_cluster_constrained (b_from);
768
+
769
+ if (block_constrained) {
770
+ bool intersect = intersect_range_limit_with_floorplan_constraints (b_from,
771
+ search_range,
772
+ delta_cx,
773
+ to_layer_num);
774
+ if (!intersect) {
775
+ return false ;
776
+ }
808
777
}
809
778
810
779
t_physical_tile_loc to_compressed_loc;
@@ -817,6 +786,7 @@ bool find_to_loc_median(t_logical_block_type_ptr blk_type,
817
786
/* is_median=*/ true ,
818
787
to_layer_num,
819
788
/* search_for_empty=*/ false ,
789
+ block_constrained,
820
790
blk_loc_registry,
821
791
rng);
822
792
@@ -885,9 +855,16 @@ bool find_to_loc_centroid(t_logical_block_type_ptr blk_type,
885
855
}
886
856
delta_cx = search_range.xmax - search_range.xmin ;
887
857
888
- bool adjust_search_range_res = adjust_search_range (blk_type, b_from, search_range, delta_cx, to_layer_num);
889
- if (!adjust_search_range_res) {
890
- return false ;
858
+ auto block_constrained = is_cluster_constrained (b_from);
859
+
860
+ if (block_constrained) {
861
+ bool intersect = intersect_range_limit_with_floorplan_constraints (b_from,
862
+ search_range,
863
+ delta_cx,
864
+ to_layer_num);
865
+ if (!intersect) {
866
+ return false ;
867
+ }
891
868
}
892
869
893
870
t_physical_tile_loc to_compressed_loc;
@@ -902,6 +879,7 @@ bool find_to_loc_centroid(t_logical_block_type_ptr blk_type,
902
879
/* is_median=*/ false ,
903
880
to_layer_num,
904
881
/* search_for_empty=*/ false ,
882
+ block_constrained,
905
883
blk_loc_registry,
906
884
rng);
907
885
@@ -991,11 +969,12 @@ int find_empty_compatible_subtile(t_logical_block_type_ptr type,
991
969
bool find_compatible_compressed_loc_in_range (t_logical_block_type_ptr type,
992
970
const int delta_cx,
993
971
const t_physical_tile_loc& from_loc,
994
- const t_bb& search_range,
972
+ t_bb search_range,
995
973
t_physical_tile_loc& to_loc,
996
974
bool is_median,
997
975
int to_layer_num,
998
976
bool search_for_empty,
977
+ bool block_constrained,
999
978
const BlkLocRegistry& blk_loc_registry,
1000
979
vtr::RngContainer& rng) {
1001
980
// TODO For the time being, the blocks only moved in the same layer. This assertion should be removed after VPR is updated to move blocks between layers
@@ -1038,10 +1017,13 @@ bool find_compatible_compressed_loc_in_range(t_logical_block_type_ptr type,
1038
1017
}
1039
1018
auto y_upper_iter = block_rows.upper_bound (search_range.ymax );
1040
1019
1041
- if (y_lower_iter->first > search_range.ymin ) {
1042
- if (!is_io_type (type)) {
1043
- continue ;
1044
- }
1020
+ if (block_rows.size () < 3 ) {
1021
+ // Fall back to allow the whole y range
1022
+ y_lower_iter = block_rows.begin ();
1023
+ y_upper_iter = block_rows.end ();
1024
+
1025
+ search_range.ymin = y_lower_iter->first ;
1026
+ search_range.ymax = (y_upper_iter - 1 )->first ;
1045
1027
}
1046
1028
1047
1029
int y_range = std::distance (y_lower_iter, y_upper_iter);
0 commit comments