@@ -2631,25 +2631,14 @@ static t_pack_molecule* get_highest_gain_molecule(t_pb* cur_pb,
2631
2631
2632
2632
/* Grab highest gain molecule */
2633
2633
t_pack_molecule* molecule = nullptr ;
2634
- if (cur_pb->pb_stats ->num_feasible_blocks > 0 ) {
2635
- cur_pb->pb_stats ->num_feasible_blocks --;
2636
- int index = cur_pb->pb_stats ->num_feasible_blocks ;
2637
- molecule = cur_pb->pb_stats ->feasible_blocks [index];
2638
- VTR_ASSERT (molecule->valid == true );
2639
- return molecule;
2640
- }
2641
-
2642
- /*
2643
- * No suitable molecules were found from the above functions - if
2644
- * attraction groups were created, explore the attraction groups to see if
2645
- * any suitable molecules can be found.
2646
- */
2647
- int num_pulls = attraction_groups.get_att_group_pulls ();
2648
-
2649
- if (cur_pb->pb_stats ->pulled_from_atom_groups < num_pulls) {
2650
- add_cluster_molecule_candidates_by_attraction_group (cur_pb, cluster_placement_stats_ptr, atom_molecules, attraction_groups,
2651
- feasible_block_array_size, cluster_index, primitive_candidate_block_types);
2652
- cur_pb->pb_stats ->pulled_from_atom_groups ++;
2634
+ if (cur_pb->pb_stats ->num_feasible_blocks == 0 ) {
2635
+ /*
2636
+ * No suitable molecules were found from the above functions - if
2637
+ * attraction groups were created, explore the attraction groups to see if
2638
+ * any suitable molecules can be found.
2639
+ */
2640
+ add_cluster_molecule_candidates_by_attraction_group (cur_pb, cluster_placement_stats_ptr, atom_molecules, attraction_groups,
2641
+ feasible_block_array_size, cluster_index, primitive_candidate_block_types);
2653
2642
}
2654
2643
2655
2644
if (cur_pb->pb_stats ->num_feasible_blocks > 0 ) {
@@ -2738,6 +2727,9 @@ static void add_cluster_molecule_candidates_by_highfanout_connectivity(t_pb* cur
2738
2727
* If the current cluster being packed has an attraction group associated with it
2739
2728
* (i.e. there are atoms in it that belong to an attraction group), this routine adds molecules
2740
2729
* from the associated attraction group to the list of feasible blocks for the cluster.
2730
+ * Attraction groups can be very large, so we only add some randomly selected molecules for efficiency
2731
+ * if the number of atoms in the group is greater than 500. Therefore, the molecules added to the candidates
2732
+ * will vary each time you call this function.
2741
2733
*/
2742
2734
static void add_cluster_molecule_candidates_by_attraction_group (t_pb* cur_pb,
2743
2735
t_cluster_placement_stats* cluster_placement_stats_ptr,
@@ -2751,6 +2743,22 @@ static void add_cluster_molecule_candidates_by_attraction_group(t_pb* cur_pb,
2751
2743
2752
2744
auto cluster_type = cluster_ctx.clb_nlist .block_type (clb_index);
2753
2745
2746
+ /*
2747
+ * For each cluster, we want to explore the attraction group molecules as potential
2748
+ * candidates for the cluster a limited number of times. This limit is imposed because
2749
+ * if the cluster belongs to a very large attraction group, we could potentially search
2750
+ * through its attraction group molecules for a very long time.
2751
+ * Defining a number of times to search through the attraction groups (i.e. number of
2752
+ * attraction group pulls) determines how many times we search through the cluster's attraction
2753
+ * group molecules for candidate molecules.
2754
+ */
2755
+ int num_pulls = attraction_groups.get_att_group_pulls ();
2756
+ if (cur_pb->pb_stats ->pulled_from_atom_groups < num_pulls) {
2757
+ cur_pb->pb_stats ->pulled_from_atom_groups ++;
2758
+ } else {
2759
+ return ;
2760
+ }
2761
+
2754
2762
AttractGroupId grp_id = cur_pb->pb_stats ->attraction_grp_id ;
2755
2763
if (grp_id == AttractGroupId::INVALID ()) {
2756
2764
return ;
@@ -2769,6 +2777,7 @@ static void add_cluster_molecule_candidates_by_attraction_group(t_pb* cur_pb,
2769
2777
VTR_ASSERT (itr != primitive_candidate_block_types.end ());
2770
2778
std::vector<t_logical_block_type_ptr>& candidate_types = itr->second ;
2771
2779
2780
+ // Only consider molecules that are unpacked and of the correct type
2772
2781
if (atom_ctx.lookup .atom_clb (atom_id) == ClusterBlockId::INVALID ()
2773
2782
&& std::find (candidate_types.begin (), candidate_types.end (), cluster_type) != candidate_types.end ()) {
2774
2783
auto rng = atom_molecules.equal_range (atom_id);
@@ -2802,6 +2811,7 @@ static void add_cluster_molecule_candidates_by_attraction_group(t_pb* cur_pb,
2802
2811
VTR_ASSERT (itr != primitive_candidate_block_types.end ());
2803
2812
std::vector<t_logical_block_type_ptr>& candidate_types = itr->second ;
2804
2813
2814
+ // Only consider molecules that are unpacked and of the correct type
2805
2815
if (atom_ctx.lookup .atom_clb (blk_id) == ClusterBlockId::INVALID ()
2806
2816
&& std::find (candidate_types.begin (), candidate_types.end (), cluster_type) != candidate_types.end ()) {
2807
2817
auto rng = atom_molecules.equal_range (blk_id);
0 commit comments