19
19
* t_pb:
20
20
* Represents a clustered instance of a t_pb_graph_node containing netlist primitives
21
21
*
22
- * t_pb_type and t_pb_graph_node (and related types) describe the targetted FPGA architecture, while t_pb represents
22
+ * t_pb_type and t_pb_graph_node (and related types) describe the targeted FPGA architecture, while t_pb represents
23
23
* the actual clustering of the user netlist.
24
24
*
25
25
* For example:
87
87
* cluster until a nullptr is returned. So, the number of repeated molecules is changed from 1 to 500,
88
88
* effectively making the clusterer pack a cluster until a nullptr is returned.
89
89
*/
90
- # define ATTRACTION_GROUPS_MAX_REPEATED_MOLECULES 500
90
+ static constexpr int ATTRACTION_GROUPS_MAX_REPEATED_MOLECULES = 500 ;
91
91
92
92
static bool s_partitioning_status_NOP = false ;
93
93
bool partitioning_status_NOP () { return s_partitioning_status_NOP; }
@@ -132,9 +132,8 @@ std::map<t_logical_block_type_ptr, size_t> do_clustering(const t_packer_opts& pa
132
132
t_cluster_progress_stats cluster_stats;
133
133
134
134
// int num_molecules, num_molecules_processed, mols_since_last_print, blocks_since_last_analysis,
135
- int num_blocks_hill_added, max_pb_depth,
136
- seedindex, savedseedindex /* index of next most timing critical block */ ,
137
- detailed_routing_stage;
135
+ int num_blocks_hill_added = 0 , max_pb_depth = 0 , detailed_routing_stage = 0 ;
136
+ int seedindex = 0 , savedseedindex = 0 ; // index of next most timing critical block
138
137
139
138
const int verbosity = packer_opts.pack_verbosity ;
140
139
@@ -146,7 +145,7 @@ std::map<t_logical_block_type_ptr, size_t> do_clustering(const t_packer_opts& pa
146
145
147
146
std::map<t_logical_block_type_ptr, size_t > num_used_type_instances;
148
147
149
- bool is_cluster_legal = 0 ;
148
+ bool isClusterLegal = false ;
150
149
enum e_block_pack_status block_pack_status;
151
150
152
151
t_cluster_placement_stats* cur_cluster_placement_stats_ptr = nullptr ;
@@ -187,8 +186,6 @@ std::map<t_logical_block_type_ptr, size_t> do_clustering(const t_packer_opts& pa
187
186
helper_ctx.max_cluster_size = 0 ;
188
187
max_pb_depth = 0 ;
189
188
190
- seedindex = 0 ;
191
-
192
189
const t_molecule_stats max_molecule_stats = calc_max_molecules_stats (molecule_head);
193
190
194
191
mark_all_molecules_valid (molecule_head);
@@ -233,9 +230,12 @@ std::map<t_logical_block_type_ptr, size_t> do_clustering(const t_packer_opts& pa
233
230
clustering_delay_calc, timing_info, atom_criticality);
234
231
}
235
232
233
+ // Assign gain scores to atoms and sort them based on the scores.
236
234
auto seed_atoms = initialize_seed_atoms (packer_opts.cluster_seed_type , max_molecule_stats, atom_criticality);
237
235
238
- istart = get_highest_gain_seed_molecule (seedindex, seed_atoms);
236
+ /* index of next most timing critical block */
237
+ int seed_index = 0 ;
238
+ istart = get_highest_gain_seed_molecule (seed_index, seed_atoms);
239
239
240
240
print_pack_status_header ();
241
241
@@ -353,7 +353,7 @@ std::map<t_logical_block_type_ptr, size_t> do_clustering(const t_packer_opts& pa
353
353
354
354
while (istart != nullptr ) {
355
355
356
- is_cluster_legal = false ;
356
+ isClusterLegal = false ;
357
357
savedseedindex = seedindex;
358
358
359
359
// If in the previous "for (detailed_routing_stage ..." call we failed all the
@@ -387,7 +387,7 @@ std::map<t_logical_block_type_ptr, size_t> do_clustering(const t_packer_opts& pa
387
387
failed_for_loop = true ;
388
388
389
389
for (detailed_routing_stage = (int )E_DETAILED_ROUTE_AT_END_ONLY;
390
- !is_cluster_legal && detailed_routing_stage != (int )E_DETAILED_ROUTE_INVALID;
390
+ !isClusterLegal && detailed_routing_stage != (int )E_DETAILED_ROUTE_INVALID;
391
391
detailed_routing_stage++) {
392
392
393
393
ClusterBlockId clb_index (helper_ctx.total_clb_num );
@@ -399,6 +399,7 @@ std::map<t_logical_block_type_ptr, size_t> do_clustering(const t_packer_opts& pa
399
399
* stores PartitionRegion information while the cluster is packed*/
400
400
PartitionRegion temp_cluster_pr;
401
401
402
+ #if 0
402
403
start_new_cluster(helper_ctx.cluster_placement_stats, helper_ctx.primitives_list,
403
404
clb_index, istart,
404
405
num_used_type_instances,
@@ -413,6 +414,7 @@ std::map<t_logical_block_type_ptr, size_t> do_clustering(const t_packer_opts& pa
413
414
balance_block_type_utilization,
414
415
packer_opts.feasible_block_array_size,
415
416
temp_cluster_pr);
417
+ #endif // //00000000000000000000000000000000000000000000000000
416
418
417
419
// initial molecule in cluster has been processed
418
420
cluster_stats.num_molecules_processed ++;
@@ -495,6 +497,7 @@ std::map<t_logical_block_type_ptr, size_t> do_clustering(const t_packer_opts& pa
495
497
break ;
496
498
}
497
499
500
+ #if 0
498
501
try_fill_cluster(packer_opts,
499
502
cur_cluster_placement_stats_ptr,
500
503
prev_molecule,
@@ -522,16 +525,17 @@ std::map<t_logical_block_type_ptr, size_t> do_clustering(const t_packer_opts& pa
522
525
unclustered_list_head_size,
523
526
net_output_feeds_driving_block_input,
524
527
primitive_candidate_block_types);
528
+ #endif // //////000000000000000
525
529
526
530
i++;
527
531
528
532
}
529
533
530
534
max_nb_molecule = i;
531
535
532
- is_cluster_legal = check_cluster_legality (verbosity, detailed_routing_stage, router_data);
536
+ isClusterLegal = check_cluster_legality (verbosity, detailed_routing_stage, router_data);
533
537
534
- if (is_cluster_legal ) {
538
+ if (isClusterLegal ) {
535
539
536
540
// Calls the extra check for "clb" only (may need to revisit this check) (T.Besson)
537
541
//
@@ -547,25 +551,25 @@ std::map<t_logical_block_type_ptr, size_t> do_clustering(const t_packer_opts& pa
547
551
548
552
// Call the check as if we would output the final packing ... and see if there is any
549
553
// mode conflict. (T.Besson)
550
- // 'is_cluster_legal ' turns to false if there is a mode conflict.
554
+ // 'isClusterLegal ' turns to false if there is a mode conflict.
551
555
//
552
- is_cluster_legal = rsbe::check_if_xml_mode_conflict (packer_opts, arch,
556
+ isClusterLegal = rsbe::check_if_xml_mode_conflict (packer_opts, arch,
553
557
clustering_data.intra_lb_routing );
554
558
555
559
// Remove the previous pushed "intra_lb_routing_solution" to clean up
556
560
// the place. (T.Besson)
557
561
//
558
562
(clustering_data.intra_lb_routing ).pop_back ();
559
563
560
- if (!is_cluster_legal &&
564
+ if (!isClusterLegal &&
561
565
(detailed_routing_stage == (int )E_DETAILED_ROUTE_FOR_EACH_ATOM)) {
562
566
563
567
VTR_LOGV (verbosity > 0 , " Info: rejected cluster packing solution with modes conflict [%d]\n " ,
564
568
max_nb_molecule);
565
569
}
566
570
}
567
571
568
- if (is_cluster_legal ) {
572
+ if (isClusterLegal ) {
569
573
570
574
istart = save_cluster_routing_and_pick_new_seed (packer_opts, helper_ctx.total_clb_num ,
571
575
seed_atoms, num_blocks_hill_added, clustering_data.intra_lb_routing ,
@@ -610,9 +614,10 @@ std::map<t_logical_block_type_ptr, size_t> do_clustering(const t_packer_opts& pa
610
614
} else {
611
615
612
616
while (istart != nullptr ) {
613
- is_cluster_legal = false ;
614
- savedseedindex = seedindex;
615
- for (detailed_routing_stage = (int )E_DETAILED_ROUTE_AT_END_ONLY; !is_cluster_legal && detailed_routing_stage != (int )E_DETAILED_ROUTE_INVALID; detailed_routing_stage++) {
617
+ isClusterLegal = false ;
618
+ int saved_seed_index = seed_index;
619
+ for (detailed_routing_stage = (int )E_DETAILED_ROUTE_AT_END_ONLY; !isClusterLegal && detailed_routing_stage != (int )E_DETAILED_ROUTE_INVALID; detailed_routing_stage++) {
620
+ // Use the total number created clusters so far as the ID for the new cluster
616
621
ClusterBlockId clb_index (helper_ctx.total_clb_num );
617
622
618
623
VTR_LOGV (verbosity > 2 , " Complex block %d:\n " , helper_ctx.total_clb_num );
@@ -621,6 +626,12 @@ std::map<t_logical_block_type_ptr, size_t> do_clustering(const t_packer_opts& pa
621
626
* Since some of the primitives might fail legality, this structure temporarily
622
627
* stores PartitionRegion information while the cluster is packed*/
623
628
PartitionRegion temp_cluster_pr;
629
+ /*
630
+ * Stores the cluster's NoC group ID as more primitives are added to it.
631
+ * This is used to check if a candidate primitive is in the same NoC group
632
+ * as the atom blocks that have already been added to the primitive.
633
+ */
634
+ NocGroupId temp_cluster_noc_grp_id = NocGroupId::INVALID ();
624
635
625
636
start_new_cluster (helper_ctx.cluster_placement_stats , helper_ctx.primitives_list ,
626
637
clb_index, istart,
@@ -635,7 +646,8 @@ std::map<t_logical_block_type_ptr, size_t> do_clustering(const t_packer_opts& pa
635
646
packer_opts.enable_pin_feasibility_filter ,
636
647
balance_block_type_utilization,
637
648
packer_opts.feasible_block_array_size ,
638
- temp_cluster_pr);
649
+ temp_cluster_pr,
650
+ temp_cluster_noc_grp_id);
639
651
640
652
// initial molecule in cluster has been processed
641
653
cluster_stats.num_molecules_processed ++;
@@ -659,7 +671,7 @@ std::map<t_logical_block_type_ptr, size_t> do_clustering(const t_packer_opts& pa
659
671
t_ext_pin_util target_ext_pin_util = helper_ctx.target_external_pin_util .get_pin_util (cluster_ctx.clb_nlist .block_type (clb_index)->name );
660
672
int high_fanout_threshold = helper_ctx.high_fanout_thresholds .get_threshold (cluster_ctx.clb_nlist .block_type (clb_index)->name );
661
673
update_cluster_stats (istart, clb_index,
662
- is_clock, // Set of clock nets
674
+ is_clock, // Set of clock nets
663
675
is_global, // Set of global nets (currently all clocks)
664
676
packer_opts.global_clocks ,
665
677
packer_opts.alpha , packer_opts.beta ,
@@ -734,20 +746,21 @@ std::map<t_logical_block_type_ptr, size_t> do_clustering(const t_packer_opts& pa
734
746
router_data,
735
747
target_ext_pin_util,
736
748
temp_cluster_pr,
749
+ temp_cluster_noc_grp_id,
737
750
block_pack_status,
738
751
clustering_data.unclustered_list_head ,
739
752
unclustered_list_head_size,
740
753
net_output_feeds_driving_block_input,
741
754
primitive_candidate_block_types);
742
755
}
743
756
744
- is_cluster_legal = check_cluster_legality (verbosity, detailed_routing_stage, router_data);
757
+ isClusterLegal = check_cluster_legality (verbosity, detailed_routing_stage, router_data);
745
758
746
- if (is_cluster_legal ) {
747
- istart = save_cluster_routing_and_pick_new_seed (packer_opts, helper_ctx.total_clb_num , seed_atoms, num_blocks_hill_added, clustering_data.intra_lb_routing , seedindex , cluster_stats, router_data);
759
+ if (isClusterLegal ) {
760
+ istart = save_cluster_routing_and_pick_new_seed (packer_opts, helper_ctx.total_clb_num , seed_atoms, num_blocks_hill_added, clustering_data.intra_lb_routing , seed_index , cluster_stats, router_data);
748
761
store_cluster_info_and_free (packer_opts, clb_index, logic_block_type, le_pb_type, le_count, clb_inter_blk_nets);
749
762
} else {
750
- free_data_and_requeue_used_mols_if_illegal (clb_index, savedseedindex , num_used_type_instances, helper_ctx.total_clb_num , seedindex );
763
+ free_data_and_requeue_used_mols_if_illegal (clb_index, saved_seed_index , num_used_type_instances, helper_ctx.total_clb_num , seed_index );
751
764
}
752
765
free_router_data (router_data);
753
766
router_data = nullptr ;
0 commit comments