@@ -316,6 +316,8 @@ void add_cluster_molecule_candidates_by_transitive_connectivity(t_pb* cur_pb,
316
316
int transitive_fanout_threshold,
317
317
const int feasible_block_array_size);
318
318
319
+ bool check_free_primitives_for_molecule_atoms (t_pack_molecule* molecule, t_cluster_placement_stats* cluster_placement_stats_ptr);
320
+
319
321
static t_pack_molecule* get_molecule_for_cluster (t_pb* cur_pb,
320
322
const std::multimap<AtomBlockId, t_pack_molecule*>& atom_molecules,
321
323
AttractionInfo& attraction_groups,
@@ -2480,19 +2482,7 @@ void add_cluster_molecule_candidates_by_connectivity_and_timing(t_pb* cur_pb,
2480
2482
for (const auto & kv : vtr::make_range (rng.first , rng.second )) {
2481
2483
t_pack_molecule* molecule = kv.second ;
2482
2484
if (molecule->valid ) {
2483
- bool success = true ;
2484
- for (int j = 0 ; j < get_array_size_of_molecule (molecule); j++) {
2485
- if (molecule->atom_block_ids [j]) {
2486
- VTR_ASSERT (atom_ctx.lookup .atom_clb (molecule->atom_block_ids [j]) == ClusterBlockId::INVALID ());
2487
- auto blk_id2 = molecule->atom_block_ids [j];
2488
- if (!exists_free_primitive_for_atom_block (cluster_placement_stats_ptr, blk_id2)) {
2489
- /* TODO: debating whether to check if placement exists for molecule
2490
- * (more robust) or individual atom blocks (faster) */
2491
- success = false ;
2492
- break ;
2493
- }
2494
- }
2495
- }
2485
+ bool success = check_free_primitives_for_molecule_atoms (molecule, cluster_placement_stats_ptr);
2496
2486
if (success) {
2497
2487
add_molecule_to_pb_stats_candidates (molecule,
2498
2488
cur_pb->pb_stats ->gain , cur_pb, feasible_block_array_size);
@@ -2529,19 +2519,7 @@ void add_cluster_molecule_candidates_by_highfanout_connectivity(t_pb* cur_pb,
2529
2519
for (const auto & kv : vtr::make_range (rng.first , rng.second )) {
2530
2520
t_pack_molecule* molecule = kv.second ;
2531
2521
if (molecule->valid ) {
2532
- bool success = true ;
2533
- for (int j = 0 ; j < get_array_size_of_molecule (molecule); j++) {
2534
- if (molecule->atom_block_ids [j]) {
2535
- VTR_ASSERT (atom_ctx.lookup .atom_clb (molecule->atom_block_ids [j]) == ClusterBlockId::INVALID ());
2536
- auto blk_id2 = molecule->atom_block_ids [j];
2537
- if (!exists_free_primitive_for_atom_block (cluster_placement_stats_ptr, blk_id2)) {
2538
- /* TODO: debating whether to check if placement exists for molecule (more
2539
- * robust) or individual atom blocks (faster) */
2540
- success = false ;
2541
- break ;
2542
- }
2543
- }
2544
- }
2522
+ bool success = check_free_primitives_for_molecule_atoms (molecule, cluster_placement_stats_ptr);
2545
2523
if (success) {
2546
2524
add_molecule_to_pb_stats_candidates (molecule,
2547
2525
cur_pb->pb_stats ->gain , cur_pb, std::min (feasible_block_array_size, AAPACK_MAX_HIGH_FANOUT_EXPLORE));
@@ -2573,19 +2551,7 @@ void add_cluster_molecule_candidates_by_attraction_group(t_pb* cur_pb,
2573
2551
for (const auto & kv : vtr::make_range (rng.first , rng.second )) {
2574
2552
t_pack_molecule* molecule = kv.second ;
2575
2553
if (molecule->valid ) {
2576
- bool success = true ;
2577
- for (int i_atom = 0 ; i_atom < get_array_size_of_molecule (molecule); i_atom++) {
2578
- if (molecule->atom_block_ids [i_atom]) {
2579
- VTR_ASSERT (atom_ctx.lookup .atom_clb (molecule->atom_block_ids [i_atom]) == ClusterBlockId::INVALID ());
2580
- auto blk_id2 = molecule->atom_block_ids [i_atom];
2581
- if (!exists_free_primitive_for_atom_block (cluster_placement_stats_ptr, blk_id2)) {
2582
- /* TODO: debating whether to check if placement exists for molecule
2583
- * (more robust) or individual atom blocks (faster) */
2584
- success = false ;
2585
- break ;
2586
- }
2587
- }
2588
- }
2554
+ bool success = check_free_primitives_for_molecule_atoms (molecule, cluster_placement_stats_ptr);
2589
2555
if (success) {
2590
2556
add_molecule_to_pb_stats_candidates (molecule,
2591
2557
cur_pb->pb_stats ->gain , cur_pb, feasible_block_array_size);
@@ -2620,19 +2586,7 @@ void add_cluster_molecule_candidates_by_transitive_connectivity(t_pb* cur_pb,
2620
2586
for (const auto & transitive_candidate : cur_pb->pb_stats ->transitive_fanout_candidates ) {
2621
2587
t_pack_molecule* molecule = transitive_candidate.second ;
2622
2588
if (molecule->valid ) {
2623
- bool success = true ;
2624
- for (int j = 0 ; j < get_array_size_of_molecule (molecule); j++) {
2625
- if (molecule->atom_block_ids [j]) {
2626
- VTR_ASSERT (atom_ctx.lookup .atom_clb (molecule->atom_block_ids [j]) == ClusterBlockId::INVALID ());
2627
- auto blk_id = molecule->atom_block_ids [j];
2628
- if (!exists_free_primitive_for_atom_block (cluster_placement_stats_ptr, blk_id)) {
2629
- /* TODO: debating whether to check if placement exists for molecule (more
2630
- * robust) or individual atom blocks (faster) */
2631
- success = false ;
2632
- break ;
2633
- }
2634
- }
2635
- }
2589
+ bool success = check_free_primitives_for_molecule_atoms (molecule, cluster_placement_stats_ptr);
2636
2590
if (success) {
2637
2591
add_molecule_to_pb_stats_candidates (molecule,
2638
2592
cur_pb->pb_stats ->gain , cur_pb, std::min (feasible_block_array_size, AAPACK_MAX_TRANSITIVE_EXPLORE));
@@ -2641,6 +2595,26 @@ void add_cluster_molecule_candidates_by_transitive_connectivity(t_pb* cur_pb,
2641
2595
}
2642
2596
}
2643
2597
2598
+ bool check_free_primitives_for_molecule_atoms (t_pack_molecule* molecule, t_cluster_placement_stats* cluster_placement_stats_ptr) {
2599
+ auto & atom_ctx = g_vpr_ctx.atom ();
2600
+ bool success = true ;
2601
+
2602
+ for (int i_atom = 0 ; i_atom < get_array_size_of_molecule (molecule); i_atom++) {
2603
+ if (molecule->atom_block_ids [i_atom]) {
2604
+ VTR_ASSERT (atom_ctx.lookup .atom_clb (molecule->atom_block_ids [i_atom]) == ClusterBlockId::INVALID ());
2605
+ auto blk_id2 = molecule->atom_block_ids [i_atom];
2606
+ if (!exists_free_primitive_for_atom_block (cluster_placement_stats_ptr, blk_id2)) {
2607
+ /* TODO: debating whether to check if placement exists for molecule
2608
+ * (more robust) or individual atom blocks (faster) */
2609
+ success = false ;
2610
+ break ;
2611
+ }
2612
+ }
2613
+ }
2614
+
2615
+ return success;
2616
+ }
2617
+
2644
2618
/* ****************************************/
2645
2619
static t_pack_molecule* get_molecule_for_cluster (t_pb* cur_pb,
2646
2620
const std::multimap<AtomBlockId, t_pack_molecule*>& atom_molecules,
0 commit comments