Skip to content

Commit 07127de

Browse files
committed
Added comments for functions related to adding cluster molecule candidates
1 parent fbb9337 commit 07127de

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

vpr/src/pack/cluster.cpp

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,9 +2401,10 @@ static void start_new_cluster(t_cluster_placement_stats* cluster_placement_stats
24012401
/*
24022402
* Get candidate molecule to pack into currently open cluster
24032403
* Molecule selection priority:
2404-
* 1. Find unpacked molecule based on criticality and strong connectedness (connected by low fanout nets) with current cluster
2405-
* 2. Find unpacked molecule based on transitive connections (eg. 2 hops away) with current cluster
2406-
* 3. Find unpacked molecule based on weak connectedness (connected by high fanout nets) with current cluster
2404+
* 1. Find unpacked molecules based on criticality and strong connectedness (connected by low fanout nets) with current cluster
2405+
* 2. Find unpacked molecules based on transitive connections (eg. 2 hops away) with current cluster
2406+
* 3. Find unpacked molecules based on weak connectedness (connected by high fanout nets) with current cluster
2407+
* 4. Find unpacked molecules based on attraction group of the current cluster (if the cluster has an attraction group)
24072408
*/
24082409
static t_pack_molecule* get_highest_gain_molecule(t_pb* cur_pb,
24092410
const std::multimap<AtomBlockId, t_pack_molecule*>& atom_molecules,
@@ -2415,45 +2416,46 @@ static t_pack_molecule* get_highest_gain_molecule(t_pb* cur_pb,
24152416
bool prioritize_transitive_connectivity,
24162417
int transitive_fanout_threshold,
24172418
const int feasible_block_array_size) {
2418-
/* This routine populates a list of feasible blocks outside the cluster then returns the best one for the list *
2419-
* not currently in a cluster and satisfies the feasibility *
2420-
* function passed in as is_feasible. If there are no feasible *
2421-
* blocks it returns ClusterBlockId::INVALID(). */
2419+
/*
2420+
* This routine populates a list of feasible blocks outside the cluster, then returns the best candidate for the cluster.
2421+
* If there are no feasible blocks it returns a nullptr.
2422+
*/
24222423

24232424
if (gain_mode == HILL_CLIMBING) {
24242425
VPR_FATAL_ERROR(VPR_ERROR_PACK,
24252426
"Hill climbing not supported yet, error out.\n");
24262427
}
24272428

2428-
// 1. Find unpacked molecule based on criticality and strong connectedness (connected by low fanout nets) with current cluster
2429+
// 1. Find unpacked molecules based on criticality and strong connectedness (connected by low fanout nets) with current cluster
24292430
if (cur_pb->pb_stats->num_feasible_blocks == NOT_VALID) {
24302431
add_cluster_molecule_candidates_by_connectivity_and_timing(cur_pb, cluster_placement_stats_ptr, atom_molecules, feasible_block_array_size);
24312432
}
24322433

24332434
if (prioritize_transitive_connectivity) {
2434-
// 2. Find unpacked molecule based on transitive connections (eg. 2 hops away) with current cluster
2435+
// 2. Find unpacked molecules based on transitive connections (eg. 2 hops away) with current cluster
24352436
if (cur_pb->pb_stats->num_feasible_blocks == 0 && cur_pb->pb_stats->explore_transitive_fanout) {
24362437
add_cluster_molecule_candidates_by_transitive_connectivity(cur_pb, cluster_placement_stats_ptr, atom_molecules, clb_inter_blk_nets,
24372438
cluster_index, transitive_fanout_threshold, feasible_block_array_size);
24382439
}
24392440

2440-
// 3. Find unpacked molecule based on weak connectedness (connected by high fanout nets) with current cluster
2441+
// 3. Find unpacked molecules based on weak connectedness (connected by high fanout nets) with current cluster
24412442
if (cur_pb->pb_stats->num_feasible_blocks == 0 && cur_pb->pb_stats->tie_break_high_fanout_net) {
24422443
add_cluster_molecule_candidates_by_highfanout_connectivity(cur_pb, cluster_placement_stats_ptr, atom_molecules, feasible_block_array_size);
24432444
}
24442445
} else { //Reverse order
2445-
// 3. Find unpacked molecule based on weak connectedness (connected by high fanout nets) with current cluster
2446+
// 3. Find unpacked molecules based on weak connectedness (connected by high fanout nets) with current cluster
24462447
if (cur_pb->pb_stats->num_feasible_blocks == 0 && cur_pb->pb_stats->tie_break_high_fanout_net) {
24472448
add_cluster_molecule_candidates_by_highfanout_connectivity(cur_pb, cluster_placement_stats_ptr, atom_molecules, feasible_block_array_size);
24482449
}
24492450

2450-
// 2. Find unpacked molecule based on transitive connections (eg. 2 hops away) with current cluster
2451+
// 2. Find unpacked molecules based on transitive connections (eg. 2 hops away) with current cluster
24512452
if (cur_pb->pb_stats->num_feasible_blocks == 0 && cur_pb->pb_stats->explore_transitive_fanout) {
24522453
add_cluster_molecule_candidates_by_transitive_connectivity(cur_pb, cluster_placement_stats_ptr, atom_molecules, clb_inter_blk_nets,
24532454
cluster_index, transitive_fanout_threshold, feasible_block_array_size);
24542455
}
24552456
}
24562457

2458+
// 4. Find unpacked molecules based on attraction group of the current cluster (if the cluster has an attraction group)
24572459
add_cluster_molecule_candidates_by_attraction_group(cur_pb, cluster_placement_stats_ptr, atom_molecules, attraction_groups, feasible_block_array_size);
24582460

24592461
/* Grab highest gain molecule */
@@ -2469,6 +2471,7 @@ static t_pack_molecule* get_highest_gain_molecule(t_pb* cur_pb,
24692471
return molecule;
24702472
}
24712473

2474+
/* Add molecules with strong connectedness to the current cluster to the list of feasible blocks. */
24722475
static void add_cluster_molecule_candidates_by_connectivity_and_timing(t_pb* cur_pb,
24732476
t_cluster_placement_stats* cluster_placement_stats_ptr,
24742477
const std::multimap<AtomBlockId, t_pack_molecule*>& atom_molecules,
@@ -2497,6 +2500,7 @@ static void add_cluster_molecule_candidates_by_connectivity_and_timing(t_pb* cur
24972500
}
24982501
}
24992502

2503+
/* Add molecules based on weak connectedness (connected by high fanout nets) with current cluster */
25002504
static void add_cluster_molecule_candidates_by_highfanout_connectivity(t_pb* cur_pb,
25012505
t_cluster_placement_stats* cluster_placement_stats_ptr,
25022506
const std::multimap<AtomBlockId, t_pack_molecule*>& atom_molecules,
@@ -2536,15 +2540,18 @@ static void add_cluster_molecule_candidates_by_highfanout_connectivity(t_pb* cur
25362540
cur_pb->pb_stats->tie_break_high_fanout_net = AtomNetId::INVALID(); /* Mark off that this high fanout net has been considered */
25372541
}
25382542

2543+
/*
2544+
* If the current cluster being packed has an attraction group associated with it
2545+
* (i.e. there are atoms in it that belong to an attraction group), this routine adds molecules
2546+
* from the associated attraction group to the list of feasible blocks for the cluster.
2547+
*/
25392548
static void add_cluster_molecule_candidates_by_attraction_group(t_pb* cur_pb,
25402549
t_cluster_placement_stats* cluster_placement_stats_ptr,
25412550
const std::multimap<AtomBlockId, t_pack_molecule*>& atom_molecules,
25422551
AttractionInfo& attraction_groups,
25432552
const int feasible_block_array_size) {
25442553
auto& atom_ctx = g_vpr_ctx.atom();
25452554

2546-
//If the current cluster belongs to an attraction group, add all of the atoms
2547-
//from that attraction group to the feasible blocks
25482555
AttractGroupId grp_id = cur_pb->pb_stats->attraction_grp_id;
25492556
if (grp_id != AttractGroupId::INVALID()) {
25502557
AttractionGroup group = attraction_groups.get_attraction_group_info(grp_id);
@@ -2567,6 +2574,7 @@ static void add_cluster_molecule_candidates_by_attraction_group(t_pb* cur_pb,
25672574
}
25682575
}
25692576

2577+
/* Add molecules based on transitive connections (eg. 2 hops away) with current cluster*/
25702578
static void add_cluster_molecule_candidates_by_transitive_connectivity(t_pb* cur_pb,
25712579
t_cluster_placement_stats* cluster_placement_stats_ptr,
25722580
const std::multimap<AtomBlockId, t_pack_molecule*>& atom_molecules,
@@ -2597,6 +2605,7 @@ static void add_cluster_molecule_candidates_by_transitive_connectivity(t_pb* cur
25972605
}
25982606
}
25992607

2608+
/*Check whether a free primitive exists for each atom block in the molecule*/
26002609
static bool check_free_primitives_for_molecule_atoms(t_pack_molecule* molecule, t_cluster_placement_stats* cluster_placement_stats_ptr) {
26012610
auto& atom_ctx = g_vpr_ctx.atom();
26022611
bool success = true;
@@ -2606,8 +2615,8 @@ static bool check_free_primitives_for_molecule_atoms(t_pack_molecule* molecule,
26062615
VTR_ASSERT(atom_ctx.lookup.atom_clb(molecule->atom_block_ids[i_atom]) == ClusterBlockId::INVALID());
26072616
auto blk_id2 = molecule->atom_block_ids[i_atom];
26082617
if (!exists_free_primitive_for_atom_block(cluster_placement_stats_ptr, blk_id2)) {
2609-
/* TODO: debating whether to check if placement exists for molecule
2610-
* (more robust) or individual atom blocks (faster) (Jason Luu)*/
2618+
/* TODO (Jason Luu): debating whether to check if placement exists for molecule
2619+
* (more robust) or individual atom blocks (faster)*/
26112620
success = false;
26122621
break;
26132622
}

0 commit comments

Comments
 (0)