@@ -39,16 +39,15 @@ struct ClusterGainStats {
39
39
// / @brief Attraction (inverse of cost) function.
40
40
std::unordered_map<AtomBlockId, float > gain;
41
41
42
- // / @brief The timing criticality score of this atom cluster_ctx.blocks .
42
+ // / @brief The timing criticality score of this atom.
43
43
// / Determined by the most critical atom net between this atom
44
- // / cluster_ctx.blocks and any atom cluster_ctx.blocks in the current
45
- // / pb.
46
- std::unordered_map<AtomBlockId, float > timinggain;
44
+ // / and any atom in the current pb.
45
+ std::unordered_map<AtomBlockId, float > timing_gain;
47
46
// / @brief Weighted sum of connections to attraction function.
48
- std::unordered_map<AtomBlockId, float > connectiongain ;
49
- // / @brief How many nets on an atom cluster_ctx.blocks are already in the
50
- // / pb under consideration.
51
- std::unordered_map<AtomBlockId, float > sharinggain ;
47
+ std::unordered_map<AtomBlockId, float > connection_gain ;
48
+ // / @brief How many nets on an atom are already in the pb under
49
+ // / consideration.
50
+ std::unordered_map<AtomBlockId, float > sharing_gain ;
52
51
53
52
// / @brief Stores the number of times atoms have failed to be packed into
54
53
// / the cluster.
@@ -57,7 +56,9 @@ struct ClusterGainStats {
57
56
// / has failed to be packed into the cluster.
58
57
std::unordered_map<AtomBlockId, int > atom_failures;
59
58
60
- // / @brief List of nets with the num_pins_of_net_in_pb and gain entries altered.
59
+ // / @brief List of nets with the num_pins_of_net_in_pb and gain entries
60
+ // / altered (i.e. have some gain-related connection to the current
61
+ // / cluster).
61
62
std::vector<AtomNetId> marked_nets;
62
63
// / @brief List of blocks with the num_pins_of_net_in_pb and gain entries altered.
63
64
std::vector<AtomBlockId> marked_blocks;
@@ -69,7 +70,7 @@ struct ClusterGainStats {
69
70
// / determine next candidate molecule then explore molecules on
70
71
// / transitive fanout.
71
72
bool explore_transitive_fanout;
72
- // / @brief Holding trasitive fanout candidates key: root block id of the
73
+ // / @brief Holding transitive fanout candidates key: root block id of the
73
74
// / molecule, value: pointer to the molecule.
74
75
// TODO: This should be an unordered map, unless stability is desired.
75
76
std::map<AtomBlockId, t_pack_molecule*> transitive_fanout_candidates;
@@ -87,7 +88,7 @@ struct ClusterGainStats {
87
88
// / Sorted in ascending gain order so that the last cluster_ctx.blocks is
88
89
// / the most desirable (this makes it easy to pop blocks off the list.
89
90
std::vector<t_pack_molecule*> feasible_blocks;
90
- int num_feasible_blocks; /* [0..num_marked_models-1] */
91
+ int num_feasible_blocks;
91
92
};
92
93
93
94
/* *
@@ -139,10 +140,16 @@ class GreedyCandidateSelector {
139
140
static constexpr int AAPACK_MAX_HIGH_FANOUT_EXPLORE = 10 ;
140
141
141
142
// / @brief When investigating transitive fanout connections in packing,
142
- // / consider a maximum of this many molecule s , must be less than
143
+ // / consider a maximum of this many molecules , must be less than
143
144
// / packer_opts.feasible_block_array_size.
144
145
static constexpr int AAPACK_MAX_TRANSITIVE_EXPLORE = 40 ;
145
146
147
+ // / @brief When adding cluster molecule candidates by attraction groups,
148
+ // / only investigate this many candidates. Some attraction groups can
149
+ // / get very large; so this threshold decides when to explore all
150
+ // / atoms in the group, or a randomly selected number of them.
151
+ static constexpr int attraction_group_num_atoms_threshold_ = 500 ;
152
+
146
153
public:
147
154
~GreedyCandidateSelector ();
148
155
@@ -181,9 +188,9 @@ class GreedyCandidateSelector {
181
188
* @param net_output_feeds_driving_block_input
182
189
* The set of nets whose output feeds the block that drives
183
190
* itself. This may cause double-counting in the gain
184
- * calculations and need to be handled special.
191
+ * calculations and needs special handling .
185
192
* @param timing_info
186
- * Setup timing info for this Atom Netlist. Used to incorperate
193
+ * Setup timing info for this Atom Netlist. Used to incorporate
187
194
* timing / criticality into the gain calculation.
188
195
* @param log_verbosity
189
196
* The verbosity of log messages in the candidate selector.
@@ -265,8 +272,6 @@ class GreedyCandidateSelector {
265
272
* @param failed_mol
266
273
* The molecule that failed to pack into the cluster.
267
274
*/
268
- // Update the cluster gain stats after a candidate was unsuccessfully
269
- // clustered into the current cluster.
270
275
void update_cluster_gain_stats_candidate_failed (
271
276
ClusterGainStats& cluster_gain_stats,
272
277
t_pack_molecule* failed_mol);
@@ -304,7 +309,9 @@ class GreedyCandidateSelector {
304
309
* This should be called after all molecules have been packed into a cluster.
305
310
*
306
311
* This updates internal lookup tables in the candidate selector. For
307
- * example, inter-clb nets.
312
+ * example, what inter-clb nets exist on a cluster are stored by this
313
+ * routine to make later transistive gain function calculations more
314
+ * efficient.
308
315
*
309
316
* @param cluster_gain_stats
310
317
* The cluster gain stats for the cluster to finalize.
@@ -351,7 +358,7 @@ class GreedyCandidateSelector {
351
358
e_net_relation_to_clustered_block net_relation_to_clustered_block);
352
359
353
360
/* *
354
- * @brief Updates the connectiongain in the cluster_gain_stats.
361
+ * @brief Updates the connection_gain in the cluster_gain_stats.
355
362
*/
356
363
void update_connection_gain_values (ClusterGainStats& cluster_gain_stats,
357
364
AtomNetId net_id,
@@ -360,7 +367,7 @@ class GreedyCandidateSelector {
360
367
e_net_relation_to_clustered_block net_relation_to_clustered_block);
361
368
362
369
/* *
363
- * Updates the timinggain in the cluster_gain_stats.
370
+ * Updates the timing_gain in the cluster_gain_stats.
364
371
*/
365
372
void update_timing_gain_values (ClusterGainStats& cluster_gain_stats,
366
373
AtomNetId net_id,
@@ -369,8 +376,8 @@ class GreedyCandidateSelector {
369
376
370
377
/* *
371
378
* @brief Updates the total gain array to reflect the desired tradeoff
372
- * between input sharing (sharinggain ) and path_length minimization
373
- * (timinggain ) input each time a new molecule is added to the
379
+ * between input sharing (sharing_gain ) and path_length minimization
380
+ * (timing_gain ) input each time a new molecule is added to the
374
381
* cluster.
375
382
*/
376
383
void update_total_gain (ClusterGainStats& cluster_gain_stats,
@@ -439,8 +446,8 @@ class GreedyCandidateSelector {
439
446
*
440
447
* Attraction groups can be very large, so we only add some randomly
441
448
* selected molecules for efficiency if the number of atoms in the group is
442
- * greater than 500 . Therefore, the molecules added to the candidates will
443
- * vary each time you call this function.
449
+ * greater than some threshold . Therefore, the molecules added to the
450
+ * candidates will vary each time you call this function.
444
451
*/
445
452
void add_cluster_molecule_candidates_by_attraction_group (
446
453
ClusterGainStats& cluster_gain_stats,
@@ -450,7 +457,7 @@ class GreedyCandidateSelector {
450
457
AttractionInfo& attraction_groups);
451
458
452
459
/* *
453
- * @brief Finds a molecule to propose which is unrelated by may be good to
460
+ * @brief Finds a molecule to propose which is unrelated but may be good to
454
461
* cluster.
455
462
*/
456
463
t_pack_molecule* get_unrelated_candidate_for_cluster (
@@ -473,7 +480,8 @@ class GreedyCandidateSelector {
473
480
// / @brief The verbosity of log messages in the candidate selector.
474
481
const int log_verbosity_;
475
482
476
- // / @brief Pre-computed logical block types for each model in the architecture.
483
+ // / @brief Pre-computed vector of logical block types that could implement
484
+ // / the given model in the architecture.
477
485
const std::map<const t_model*, std::vector<t_logical_block_type_ptr>>& primitive_candidate_block_types_;
478
486
479
487
// / @brief The high-fanout thresholds per logical block type. Used to ignore
@@ -500,7 +508,9 @@ class GreedyCandidateSelector {
500
508
// / transitive candidates.
501
509
vtr::vector<LegalizationClusterId, std::vector<AtomNetId>> clb_inter_blk_nets_;
502
510
503
- // / @brief Data pre-computed to help select unrelated molecules.
511
+ // / @brief Data pre-computed to help select unrelated molecules. This is a
512
+ // / list of list of molecules sorted by their gain, where the first
513
+ // / dimension is the number of external outputs of the molecule.
504
514
std::vector<std::vector<t_pack_molecule *>> unrelated_clustering_data_;
505
515
506
516
// / @brief A count on the number of unrelated clustering attempts which
0 commit comments