19
19
#include " atom_netlist.h"
20
20
#include " cluster_placement.h"
21
21
#include " cluster_router.h"
22
- #include " cluster_util.h"
23
22
#include " globals.h"
24
23
#include " logic_types.h"
25
24
#include " netlist_utils.h"
@@ -80,7 +79,7 @@ static size_t calc_max_cluster_size(const std::vector<t_logical_block_type>& log
80
79
*
81
80
* Used to store information used during clustering.
82
81
*/
83
- static void alloc_and_load_pb_stats (t_pb* pb, const int feasible_block_array_size ) {
82
+ static void alloc_and_load_pb_stats (t_pb* pb) {
84
83
/* Call this routine when starting to fill up a new cluster. It resets *
85
84
* the gain vector, etc. */
86
85
@@ -90,29 +89,8 @@ static void alloc_and_load_pb_stats(t_pb* pb, const int feasible_block_array_siz
90
89
pb->pb_stats ->output_pins_used = std::vector<std::unordered_map<size_t , AtomNetId>>(pb->pb_graph_node ->num_output_pin_class );
91
90
pb->pb_stats ->lookahead_input_pins_used = std::vector<std::vector<AtomNetId>>(pb->pb_graph_node ->num_input_pin_class );
92
91
pb->pb_stats ->lookahead_output_pins_used = std::vector<std::vector<AtomNetId>>(pb->pb_graph_node ->num_output_pin_class );
93
- pb->pb_stats ->num_feasible_blocks = NOT_VALID;
94
- pb->pb_stats ->feasible_blocks = new t_pack_molecule*[feasible_block_array_size];
95
-
96
- for (int i = 0 ; i < feasible_block_array_size; i++)
97
- pb->pb_stats ->feasible_blocks [i] = nullptr ;
98
-
99
- pb->pb_stats ->tie_break_high_fanout_net = AtomNetId::INVALID ();
100
-
101
- pb->pb_stats ->pulled_from_atom_groups = 0 ;
102
- pb->pb_stats ->num_att_group_atoms_used = 0 ;
103
-
104
- pb->pb_stats ->gain .clear ();
105
- pb->pb_stats ->timinggain .clear ();
106
- pb->pb_stats ->connectiongain .clear ();
107
- pb->pb_stats ->sharinggain .clear ();
108
- pb->pb_stats ->hillgain .clear ();
109
- pb->pb_stats ->transitive_fanout_candidates .clear ();
110
-
111
- pb->pb_stats ->num_pins_of_net_in_pb .clear ();
112
92
113
93
pb->pb_stats ->num_child_blocks_in_pb = 0 ;
114
-
115
- pb->pb_stats ->explore_transitive_fanout = true ;
116
94
}
117
95
118
96
/*
@@ -176,22 +154,6 @@ static void free_pb_stats_recursive(t_pb* pb) {
176
154
}
177
155
}
178
156
179
- /* Record the failure of the molecule in this cluster in the current pb stats.
180
- * If a molecule fails repeatedly, it's gain will be penalized if packing with
181
- * attraction groups on. */
182
- static void record_molecule_failure (t_pack_molecule* molecule, t_pb* pb) {
183
- // Only have to record the failure for the first atom in the molecule.
184
- // The convention when checking if a molecule has failed to pack in the cluster
185
- // is to check whether the first atoms has been recorded as having failed
186
-
187
- auto got = pb->pb_stats ->atom_failures .find (molecule->atom_block_ids [0 ]);
188
- if (got == pb->pb_stats ->atom_failures .end ()) {
189
- pb->pb_stats ->atom_failures .insert ({molecule->atom_block_ids [0 ], 1 });
190
- } else {
191
- got->second ++;
192
- }
193
- }
194
-
195
157
/* *
196
158
* @brief Checks whether an atom block can be added to a clustered block
197
159
* without violating floorplanning constraints. It also updates the
@@ -572,7 +534,7 @@ try_place_atom_block_rec(const t_pb_graph_node* pb_graph_node,
572
534
*parent = pb; /* this pb is parent of it's child that called this function */
573
535
VTR_ASSERT (pb->pb_graph_node == pb_graph_node);
574
536
if (pb->pb_stats == nullptr ) {
575
- alloc_and_load_pb_stats (pb, feasible_block_array_size );
537
+ alloc_and_load_pb_stats (pb);
576
538
}
577
539
const t_pb_type* pb_type = pb_graph_node->pb_type ;
578
540
@@ -1216,9 +1178,6 @@ e_block_pack_status ClusterLegalizer::try_pack_molecule(t_pack_molecule* molecul
1216
1178
// macros that limit placement flexibility.
1217
1179
if (cluster.placement_stats ->has_long_chain && molecule->is_chain () && molecule->chain_info ->is_long_chain ) {
1218
1180
VTR_LOGV (log_verbosity_ > 4 , " \t\t\t FAILED Placement Feasibility Filter: Only one long chain per cluster is allowed\n " );
1219
- // Record the failure of this molecule in the current pb stats
1220
- record_molecule_failure (molecule, cluster.pb );
1221
- // Free the allocated data.
1222
1181
return e_block_pack_status::BLK_FAILED_FEASIBLE;
1223
1182
}
1224
1183
@@ -1240,8 +1199,6 @@ e_block_pack_status ClusterLegalizer::try_pack_molecule(t_pack_molecule* molecul
1240
1199
log_verbosity_,
1241
1200
cluster_pr_needs_update);
1242
1201
if (!block_pack_floorplan_status) {
1243
- // Record the failure of this molecule in the current pb stats
1244
- record_molecule_failure (molecule, cluster.pb );
1245
1202
return e_block_pack_status::BLK_FAILED_FLOORPLANNING;
1246
1203
}
1247
1204
@@ -1262,8 +1219,6 @@ e_block_pack_status ClusterLegalizer::try_pack_molecule(t_pack_molecule* molecul
1262
1219
atom_noc_grp_id_,
1263
1220
log_verbosity_);
1264
1221
if (!block_pack_noc_grp_status) {
1265
- // Record the failure of this molecule in the current pb stats
1266
- record_molecule_failure (molecule, cluster.pb );
1267
1222
return e_block_pack_status::BLK_FAILED_NOC_GROUP;
1268
1223
}
1269
1224
}
@@ -1443,9 +1398,6 @@ e_block_pack_status ClusterLegalizer::try_pack_molecule(t_pack_molecule* molecul
1443
1398
}
1444
1399
reset_molecule_info (molecule);
1445
1400
1446
- // Record the failure of this molecule in the current pb stats
1447
- record_molecule_failure (molecule, cluster.pb );
1448
-
1449
1401
/* Packing failed, but a part of the pb tree is still allocated and pbs have their modes set.
1450
1402
* Before trying to pack next molecule the unused pbs need to be freed and, the most important,
1451
1403
* their modes reset. This task is performed by the cleanup_pb() function below. */
@@ -1481,7 +1433,7 @@ ClusterLegalizer::start_new_cluster(t_pack_molecule* molecule,
1481
1433
// Create the physical block for this cluster based on the type.
1482
1434
t_pb* cluster_pb = new t_pb;
1483
1435
cluster_pb->pb_graph_node = cluster_type->pb_graph_head ;
1484
- alloc_and_load_pb_stats (cluster_pb, feasible_block_array_size_ );
1436
+ alloc_and_load_pb_stats (cluster_pb);
1485
1437
cluster_pb->parent_pb = nullptr ;
1486
1438
cluster_pb->mode = cluster_mode;
1487
1439
@@ -1821,6 +1773,20 @@ bool ClusterLegalizer::is_molecule_compatible(t_pack_molecule* molecule,
1821
1773
return true ;
1822
1774
}
1823
1775
1776
+ size_t ClusterLegalizer::get_num_cluster_inputs_available (
1777
+ LegalizationClusterId cluster_id) const {
1778
+ VTR_ASSERT_SAFE (cluster_id.is_valid () && (size_t )cluster_id < legalization_clusters_.size ());
1779
+ const LegalizationCluster& cluster = legalization_clusters_[cluster_id];
1780
+
1781
+ // Count the number of inputs available per pin class.
1782
+ size_t inputs_avail = 0 ;
1783
+ for (int i = 0 ; i < cluster.pb ->pb_graph_node ->num_input_pin_class ; i++) {
1784
+ inputs_avail += cluster.pb ->pb_stats ->input_pins_used [i].size ();
1785
+ }
1786
+
1787
+ return inputs_avail;
1788
+ }
1789
+
1824
1790
void ClusterLegalizer::finalize () {
1825
1791
for (LegalizationClusterId cluster_id : legalization_cluster_ids_) {
1826
1792
if (!cluster_id.is_valid ())
0 commit comments