@@ -28,6 +28,52 @@ 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
+
31
77
e_create_move create_move (t_pl_blocks_to_be_moved& blocks_affected,
32
78
ClusterBlockId b_from,
33
79
t_pl_loc to,
@@ -669,16 +715,9 @@ bool find_to_loc_uniform(t_logical_block_type_ptr type,
669
715
rlim);
670
716
int delta_cx = search_range.xmax - search_range.xmin ;
671
717
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
- }
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 ;
682
721
}
683
722
684
723
t_physical_tile_loc to_compressed_loc;
@@ -692,7 +731,6 @@ bool find_to_loc_uniform(t_logical_block_type_ptr type,
692
731
/* is_median=*/ false ,
693
732
to_layer_num,
694
733
/* search_for_empty=*/ false ,
695
- block_constrained,
696
734
blk_loc_registry,
697
735
rng);
698
736
@@ -764,16 +802,9 @@ bool find_to_loc_median(t_logical_block_type_ptr blk_type,
764
802
to_layer_num,
765
803
to_layer_num);
766
804
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
- }
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 ;
777
808
}
778
809
779
810
t_physical_tile_loc to_compressed_loc;
@@ -786,7 +817,6 @@ bool find_to_loc_median(t_logical_block_type_ptr blk_type,
786
817
/* is_median=*/ true ,
787
818
to_layer_num,
788
819
/* search_for_empty=*/ false ,
789
- block_constrained,
790
820
blk_loc_registry,
791
821
rng);
792
822
@@ -855,16 +885,9 @@ bool find_to_loc_centroid(t_logical_block_type_ptr blk_type,
855
885
}
856
886
delta_cx = search_range.xmax - search_range.xmin ;
857
887
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
- }
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 ;
868
891
}
869
892
870
893
t_physical_tile_loc to_compressed_loc;
@@ -879,7 +902,6 @@ bool find_to_loc_centroid(t_logical_block_type_ptr blk_type,
879
902
/* is_median=*/ false ,
880
903
to_layer_num,
881
904
/* search_for_empty=*/ false ,
882
- block_constrained,
883
905
blk_loc_registry,
884
906
rng);
885
907
@@ -969,12 +991,11 @@ int find_empty_compatible_subtile(t_logical_block_type_ptr type,
969
991
bool find_compatible_compressed_loc_in_range (t_logical_block_type_ptr type,
970
992
const int delta_cx,
971
993
const t_physical_tile_loc& from_loc,
972
- t_bb search_range,
994
+ const t_bb& search_range,
973
995
t_physical_tile_loc& to_loc,
974
996
bool is_median,
975
997
int to_layer_num,
976
998
bool search_for_empty,
977
- bool block_constrained,
978
999
const BlkLocRegistry& blk_loc_registry,
979
1000
vtr::RngContainer& rng) {
980
1001
// 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
@@ -1017,13 +1038,10 @@ bool find_compatible_compressed_loc_in_range(t_logical_block_type_ptr type,
1017
1038
}
1018
1039
auto y_upper_iter = block_rows.upper_bound (search_range.ymax );
1019
1040
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 ;
1041
+ if (y_lower_iter->first > search_range.ymin ) {
1042
+ if (!is_io_type (type)) {
1043
+ continue ;
1044
+ }
1027
1045
}
1028
1046
1029
1047
int y_range = std::distance (y_lower_iter, y_upper_iter);
0 commit comments