Skip to content

Commit f762360

Browse files
committed
Standardized and renamed packer alpha and beta variable. They are now referred to as timing_gain_weight and connection_gain_weight, used as a weight parameter during timing and connection driven clustering respectively. Removed global_clocks, use_attraction_groups, pack_num_moves, pack_move_type from packer.
1 parent 797e969 commit f762360

11 files changed

+39
-85
lines changed

doc/src/vpr/command_line_usage.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -569,15 +569,15 @@ For people not working on CAD, you can probably leave all the options to their d
569569

570570
**Default**: ``auto``
571571

572-
.. option:: --alpha_clustering <float>
572+
.. option:: --timing_gain_weight <float>
573573

574574
A parameter that weights the optimization of timing vs area.
575575

576576
A value of 0 focuses solely on area, a value of 1 focuses entirely on timing.
577577

578578
**Default**: ``0.75``
579579

580-
.. option:: --beta_clustering <float>
580+
.. option:: --connection_gain_weight <float>
581581

582582
A tradeoff parameter that controls the optimization of smaller net absorption vs. the optimization of signal sharing.
583583

vpr/src/base/SetupVPR.cpp

+2-8
Original file line numberDiff line numberDiff line change
@@ -573,15 +573,12 @@ void SetupPackerOpts(const t_options& Options,
573573
PackerOpts->doPacking = STAGE_DO;
574574
}
575575

576-
//TODO: document?
577-
PackerOpts->global_clocks = true; /* DEFAULT */
578-
579576
PackerOpts->allow_unrelated_clustering = Options.allow_unrelated_clustering;
580577
PackerOpts->connection_driven = Options.connection_driven_clustering;
581578
PackerOpts->timing_driven = Options.timing_driven_clustering;
582579
PackerOpts->cluster_seed_type = Options.cluster_seed_type;
583-
PackerOpts->alpha = Options.alpha_clustering;
584-
PackerOpts->beta = Options.beta_clustering;
580+
PackerOpts->timing_gain_weight = Options.timing_gain_weight;
581+
PackerOpts->connection_gain_weight = Options.connection_gain_weight;
585582
PackerOpts->pack_verbosity = Options.pack_verbosity;
586583
PackerOpts->enable_pin_feasibility_filter = Options.enable_clustering_pin_feasibility_filter;
587584
PackerOpts->balance_block_type_utilization = Options.balance_block_type_utilization;
@@ -591,13 +588,10 @@ void SetupPackerOpts(const t_options& Options,
591588
PackerOpts->high_fanout_threshold = Options.pack_high_fanout_threshold;
592589
PackerOpts->transitive_fanout_threshold = Options.pack_transitive_fanout_threshold;
593590
PackerOpts->feasible_block_array_size = Options.pack_feasible_block_array_size;
594-
PackerOpts->use_attraction_groups = Options.use_attraction_groups;
595591

596592
PackerOpts->device_layout = Options.device_layout;
597593

598594
PackerOpts->timing_update_type = Options.timing_update_type;
599-
PackerOpts->pack_num_moves = Options.pack_num_moves;
600-
PackerOpts->pack_move_type = Options.pack_move_type;
601595
}
602596

603597
static void SetupNetlistOpts(const t_options& Options, t_netlist_opts& NetlistOpts) {

vpr/src/base/ShowSetup.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,8 @@ static void ShowPackerOpts(const t_packer_opts& PackerOpts) {
731731
} else {
732732
VPR_FATAL_ERROR(VPR_ERROR_UNKNOWN, "Unknown packer allow_unrelated_clustering\n");
733733
}
734-
VTR_LOG("PackerOpts.alpha_clustering: %f\n", PackerOpts.alpha);
735-
VTR_LOG("PackerOpts.beta_clustering: %f\n", PackerOpts.beta);
734+
VTR_LOG("PackerOpts.timing_gain_weight: %f\n", PackerOpts.timing_gain_weight);
735+
VTR_LOG("PackerOpts.connection_gain_weight: %f\n", PackerOpts.connection_gain_weight);
736736
VTR_LOG("PackerOpts.cluster_seed_type: ");
737737
switch (PackerOpts.cluster_seed_type) {
738738
case e_cluster_seed::TIMING:
@@ -757,7 +757,6 @@ static void ShowPackerOpts(const t_packer_opts& PackerOpts) {
757757
VPR_FATAL_ERROR(VPR_ERROR_UNKNOWN, "Unknown packer cluster_seed_type\n");
758758
}
759759
VTR_LOG("PackerOpts.connection_driven: %s", (PackerOpts.connection_driven ? "true\n" : "false\n"));
760-
VTR_LOG("PackerOpts.global_clocks: %s", (PackerOpts.global_clocks ? "true\n" : "false\n"));
761760
VTR_LOG("PackerOpts.timing_driven: %s", (PackerOpts.timing_driven ? "true\n" : "false\n"));
762761
VTR_LOG("PackerOpts.target_external_pin_util: %s", vtr::join(PackerOpts.target_external_pin_util, " ").c_str());
763762
VTR_LOG("\n");

vpr/src/base/read_options.cpp

+2-20
Original file line numberDiff line numberDiff line change
@@ -1972,14 +1972,14 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
19721972
.default_value("auto")
19731973
.show_in(argparse::ShowIn::HELP_ONLY);
19741974

1975-
pack_grp.add_argument(args.alpha_clustering, "--alpha_clustering")
1975+
pack_grp.add_argument(args.timing_gain_weight, "--timing_gain_weight")
19761976
.help(
19771977
"Parameter that weights the optimization of timing vs area. 0.0 focuses solely on"
19781978
" area, 1.0 solely on timing.")
19791979
.default_value("0.75")
19801980
.show_in(argparse::ShowIn::HELP_ONLY);
19811981

1982-
pack_grp.add_argument(args.beta_clustering, "--beta_clustering")
1982+
pack_grp.add_argument(args.connection_gain_weight, "--connection_gain_weight")
19831983
.help(
19841984
"Parameter that weights the absorption of small nets vs signal sharing."
19851985
" 0.0 focuses solely on sharing, 1.0 solely on small net absoprtion."
@@ -2101,24 +2101,6 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
21012101
.default_value("2")
21022102
.show_in(argparse::ShowIn::HELP_ONLY);
21032103

2104-
pack_grp.add_argument<bool, ParseOnOff>(args.use_attraction_groups, "--use_attraction_groups")
2105-
.help("Whether attraction groups are used to make it easier to pack primitives in the same floorplan region together.")
2106-
.default_value("on")
2107-
.show_in(argparse::ShowIn::HELP_ONLY);
2108-
2109-
pack_grp.add_argument(args.pack_num_moves, "--pack_num_moves")
2110-
.help(
2111-
"The number of moves that can be tried in packing stage")
2112-
.default_value("100000")
2113-
.show_in(argparse::ShowIn::HELP_ONLY);
2114-
2115-
pack_grp.add_argument(args.pack_move_type, "--pack_move_type")
2116-
.help(
2117-
"The move type used in packing."
2118-
"The available values are: randomSwap, semiDirectedSwap, semiDirectedSameTypeSwap")
2119-
.default_value("semiDirectedSwap")
2120-
.show_in(argparse::ShowIn::HELP_ONLY);
2121-
21222104
auto& place_grp = parser.add_argument_group("placement options");
21232105

21242106
place_grp.add_argument(args.Seed, "--seed")

vpr/src/base/read_options.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ struct t_options {
108108
/* Clustering options */
109109
argparse::ArgValue<bool> connection_driven_clustering;
110110
argparse::ArgValue<e_unrelated_clustering> allow_unrelated_clustering;
111-
argparse::ArgValue<float> alpha_clustering;
112-
argparse::ArgValue<float> beta_clustering;
111+
argparse::ArgValue<float> timing_gain_weight;
112+
argparse::ArgValue<float> connection_gain_weight;
113113
argparse::ArgValue<bool> timing_driven_clustering;
114114
argparse::ArgValue<e_cluster_seed> cluster_seed_type;
115115
argparse::ArgValue<bool> enable_clustering_pin_feasibility_filter;
@@ -120,8 +120,6 @@ struct t_options {
120120
argparse::ArgValue<int> pack_feasible_block_array_size;
121121
argparse::ArgValue<std::vector<std::string>> pack_high_fanout_threshold;
122122
argparse::ArgValue<int> pack_verbosity;
123-
argparse::ArgValue<bool> use_attraction_groups;
124-
argparse::ArgValue<int> pack_num_moves;
125123
argparse::ArgValue<std::string> pack_move_type;
126124
/* Placement options */
127125
argparse::ArgValue<int> Seed;

vpr/src/base/vpr_api.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1379,8 +1379,7 @@ bool vpr_analysis_flow(const Netlist<>& net_list,
13791379
}
13801380

13811381
std::string post_routing_packing_output_file_name = vpr_setup.PackerOpts.output_file + ".post_routing";
1382-
write_packing_results_to_xml(vpr_setup.PackerOpts.global_clocks,
1383-
Arch.architecture_id,
1382+
write_packing_results_to_xml(Arch.architecture_id,
13841383
post_routing_packing_output_file_name.c_str());
13851384
} else {
13861385
VTR_LOG_WARN("Synchronization between packing and routing results is not applied due to illegal circuit implementation\n");

vpr/src/base/vpr_types.h

+13-20
Original file line numberDiff line numberDiff line change
@@ -710,19 +710,24 @@ enum e_stage_action {
710710
* Path to technology mapped user circuit in BLIF format.
711711
* @param output_file
712712
* Path to packed user circuit in net format.
713-
* @param global_clocks
714-
* ALWAYS TRUE. (Default: True)
715713
* @param timing_driven
716714
* Whether or not to do timing driven clustering. (Default: on)
715+
* @param timing_gain_weight
716+
* Controls the optimization of timing vs area in timing driven
717+
* clustering.
718+
* A value of 0 focuses only on area; 1 focuses only on timing.
719+
* (Default: 0.75)
720+
* @param connection_gain_weight
721+
* Controls the optimization of smaller net absorption vs. signal
722+
* sharing in connection driven clustering.
723+
* A value of 0 focuses solely on signal sharing; a value of 1
724+
* focuses solely on absorbing smaller nets into a cluster.
725+
* (Default: 0.9)
717726
* @param cluster_seed_type
718727
* Selection algorithm for selecting next seed. (Default: blend2 if
719728
* timing_driven is on; max_inputs otherwise)
720-
* @param inter_cluster_net_delay
721-
* ALWAYS 1.0 (Default: 1.0)
722729
* @param target_device_utilization
723730
* Sets the target device utilization. (Default: 1.0)
724-
* @param auto_compute_inter_cluster_net_delay
725-
* ALWAYS TRUE
726731
* @param allow_unrelated_clustering
727732
* Allows primitives which have no attraction to the given cluster
728733
* to be packed into it. (Default: auto)
@@ -758,14 +763,6 @@ enum e_stage_action {
758763
* circuit's resource requirements)
759764
* @param timing_update_type
760765
* Controls how timing analysis updates are performed. (Default: auto)
761-
* @param use_attraction_groups
762-
* Whether attraction groups are used to pack primitives in the same
763-
* floorplan region together.
764-
* @param pack_num_moves
765-
* The number of moves that can be tried in packing stage.
766-
* (Default: 100000)
767-
* @param pack_move_type
768-
* The move type used in packing. (Default: semiDirectedSwap)
769766
* @param load_flat_placement
770767
* Whether to reconstruct a packing solution from a flat placement
771768
* file. (Default: off; on if <stage option: --legalize> is on)
@@ -774,11 +771,10 @@ struct t_packer_opts {
774771
std::string circuit_file_name;
775772
std::string sdc_file_name;
776773
std::string output_file;
777-
bool global_clocks;
778774
bool timing_driven;
779775
enum e_cluster_seed cluster_seed_type;
780-
float alpha;
781-
float beta;
776+
float timing_gain_weight;
777+
float connection_gain_weight;
782778
float target_device_utilization;
783779
e_unrelated_clustering allow_unrelated_clustering;
784780
bool connection_driven;
@@ -793,9 +789,6 @@ struct t_packer_opts {
793789
e_stage_action doPacking;
794790
std::string device_layout;
795791
e_timing_update_type timing_update_type;
796-
bool use_attraction_groups;
797-
int pack_num_moves;
798-
std::string pack_move_type;
799792
bool load_flat_placement = false;
800793
};
801794

vpr/src/pack/cluster_util.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ void check_and_output_clustering(ClusterLegalizer& cluster_legalizer,
7474
}
7575

7676
output_clustering(&cluster_legalizer,
77-
packer_opts.global_clocks,
7877
is_clock,
7978
arch->architecture_id,
8079
packer_opts.output_file.c_str(),

vpr/src/pack/greedy_candidate_selector.cpp

+6-10
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ void GreedyCandidateSelector::update_cluster_gain_stats_candidate_success(
296296
AtomNetId net_id = atom_netlist_.pin_net(pin_id);
297297

298298
e_gain_update gain_flag = e_gain_update::NO_GAIN;
299-
if (!is_clock_.count(net_id) || !packer_opts_.global_clocks)
299+
if (!is_clock_.count(net_id))
300300
gain_flag = e_gain_update::GAIN;
301301

302302
mark_and_update_partial_gain(cluster_gain_stats,
@@ -324,13 +324,9 @@ void GreedyCandidateSelector::update_cluster_gain_stats_candidate_success(
324324
for (AtomPinId pin_id : atom_netlist_.block_clock_pins(blk_id)) {
325325
AtomNetId net_id = atom_netlist_.pin_net(pin_id);
326326

327-
e_gain_update gain_flag = e_gain_update::GAIN;
328-
if (packer_opts_.global_clocks)
329-
gain_flag = e_gain_update::NO_GAIN;
330-
331327
mark_and_update_partial_gain(cluster_gain_stats,
332328
net_id,
333-
gain_flag,
329+
e_gain_update::NO_GAIN,
334330
blk_id,
335331
cluster_legalizer,
336332
high_fanout_net_threshold,
@@ -620,9 +616,9 @@ void GreedyCandidateSelector::update_total_gain(ClusterGainStats& cluster_gain_s
620616
VTR_ASSERT(num_used_pins > 0);
621617
if (packer_opts_.connection_driven) {
622618
/*try to absorb as many connections as possible*/
623-
cluster_gain_stats.gain[blk_id] = ((1 - packer_opts_.beta)
619+
cluster_gain_stats.gain[blk_id] = ((1 - packer_opts_.connection_gain_weight)
624620
* (float)cluster_gain_stats.sharing_gain[blk_id]
625-
+ packer_opts_.beta * (float)cluster_gain_stats.connection_gain[blk_id])
621+
+ packer_opts_.connection_gain_weight * (float)cluster_gain_stats.connection_gain[blk_id])
626622
/ (num_used_pins);
627623
} else {
628624
cluster_gain_stats.gain[blk_id] = ((float)cluster_gain_stats.sharing_gain[blk_id])
@@ -631,9 +627,9 @@ void GreedyCandidateSelector::update_total_gain(ClusterGainStats& cluster_gain_s
631627

632628
/* Add in timing driven cost into cost function */
633629
if (packer_opts_.timing_driven) {
634-
cluster_gain_stats.gain[blk_id] = packer_opts_.alpha
630+
cluster_gain_stats.gain[blk_id] = packer_opts_.timing_gain_weight
635631
* cluster_gain_stats.timing_gain[blk_id]
636-
+ (1.0 - packer_opts_.alpha) * (float)cluster_gain_stats.gain[blk_id];
632+
+ (1.0 - packer_opts_.timing_gain_weight) * (float)cluster_gain_stats.gain[blk_id];
637633
}
638634
}
639635
}

vpr/src/pack/output_clustering.cpp

+8-12
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ static void clustering_xml_blocks_from_netlist(pugi::xml_node& block_node,
640640
/* This routine dumps out the output netlist in a format suitable for *
641641
* input to vpr. This routine also dumps out the internal structure of *
642642
* the cluster, in essentially a graph based format. */
643-
void output_clustering(ClusterLegalizer* cluster_legalizer_ptr, bool global_clocks, const std::unordered_set<AtomNetId>& is_clock, const std::string& architecture_id, const char* out_fname, bool skip_clustering, bool from_legalizer) {
643+
void output_clustering(ClusterLegalizer* cluster_legalizer_ptr, const std::unordered_set<AtomNetId>& is_clock, const std::string& architecture_id, const char* out_fname, bool skip_clustering, bool from_legalizer) {
644644
const DeviceContext& device_ctx = g_vpr_ctx.device();
645645
const AtomNetlist& atom_nlist = g_vpr_ctx.atom().netlist();
646646

@@ -689,17 +689,15 @@ void output_clustering(ClusterLegalizer* cluster_legalizer_ptr, bool global_cloc
689689
block_node.append_child("inputs").text().set(vtr::join(inputs.begin(), inputs.end(), " ").c_str());
690690
block_node.append_child("outputs").text().set(vtr::join(outputs.begin(), outputs.end(), " ").c_str());
691691

692-
if (global_clocks) {
693-
std::vector<std::string> clocks;
694-
for (auto net_id : atom_nlist.nets()) {
695-
if (is_clock.count(net_id)) {
696-
clocks.push_back(atom_nlist.net_name(net_id));
697-
}
692+
std::vector<std::string> clocks;
693+
for (auto net_id : atom_nlist.nets()) {
694+
if (is_clock.count(net_id)) {
695+
clocks.push_back(atom_nlist.net_name(net_id));
698696
}
699-
700-
block_node.append_child("clocks").text().set(vtr::join(clocks.begin(), clocks.end(), " ").c_str());
701697
}
702698

699+
block_node.append_child("clocks").text().set(vtr::join(clocks.begin(), clocks.end(), " ").c_str());
700+
703701
if (skip_clustering == false) {
704702
if (from_legalizer) {
705703
VTR_ASSERT(cluster_legalizer_ptr != nullptr);
@@ -724,15 +722,13 @@ void output_clustering(ClusterLegalizer* cluster_legalizer_ptr, bool global_cloc
724722
* As such, this function is expected to be a standard API
725723
* which can be called anytime and anywhere after packing is finished.
726724
********************************************************************/
727-
void write_packing_results_to_xml(const bool& global_clocks,
728-
const std::string& architecture_id,
725+
void write_packing_results_to_xml(const std::string& architecture_id,
729726
const char* out_fname) {
730727
std::unordered_set<AtomNetId> is_clock = alloc_and_load_is_clock();
731728

732729
// Since the cluster legalizer is not being used to output the clustering
733730
// (from_legalizer is false), passing in nullptr.
734731
output_clustering(nullptr,
735-
global_clocks,
736732
is_clock,
737733
architecture_id,
738734
out_fname,

vpr/src/pack/output_clustering.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@ class ClusterLegalizer;
1717
/// clustered netlist. If from_legalizer is false, the clustered netlist currently
1818
/// in the global scope will be used.
1919
void output_clustering(ClusterLegalizer* cluster_legalizer_ptr,
20-
bool global_clocks,
2120
const std::unordered_set<AtomNetId>& is_clock,
2221
const std::string& architecture_id,
2322
const char* out_fname,
2423
bool skip_clustering,
2524
bool from_legalizer);
2625

27-
void write_packing_results_to_xml(const bool& global_clocks,
28-
const std::string& architecture_id,
26+
void write_packing_results_to_xml(const std::string& architecture_id,
2927
const char* out_fname);
3028

3129
#endif

0 commit comments

Comments
 (0)