Skip to content

Commit 8fdbe93

Browse files
authored
Unused Packer Options Cleanup (#2976)
* 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 04183ba commit 8fdbe93

11 files changed

+88
-73
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
@@ -570,15 +570,12 @@ void SetupPackerOpts(const t_options& Options,
570570
PackerOpts->doPacking = STAGE_DO;
571571
}
572572

573-
//TODO: document?
574-
PackerOpts->global_clocks = true; /* DEFAULT */
575-
576573
PackerOpts->allow_unrelated_clustering = Options.allow_unrelated_clustering;
577574
PackerOpts->connection_driven = Options.connection_driven_clustering;
578575
PackerOpts->timing_driven = Options.timing_driven_clustering;
579576
PackerOpts->cluster_seed_type = Options.cluster_seed_type;
580-
PackerOpts->alpha = Options.alpha_clustering;
581-
PackerOpts->beta = Options.beta_clustering;
577+
PackerOpts->timing_gain_weight = Options.timing_gain_weight;
578+
PackerOpts->connection_gain_weight = Options.connection_gain_weight;
582579
PackerOpts->pack_verbosity = Options.pack_verbosity;
583580
PackerOpts->enable_pin_feasibility_filter = Options.enable_clustering_pin_feasibility_filter;
584581
PackerOpts->balance_block_type_utilization = Options.balance_block_type_utilization;
@@ -588,13 +585,10 @@ void SetupPackerOpts(const t_options& Options,
588585
PackerOpts->high_fanout_threshold = Options.pack_high_fanout_threshold;
589586
PackerOpts->transitive_fanout_threshold = Options.pack_transitive_fanout_threshold;
590587
PackerOpts->feasible_block_array_size = Options.pack_feasible_block_array_size;
591-
PackerOpts->use_attraction_groups = Options.use_attraction_groups;
592588

593589
PackerOpts->device_layout = Options.device_layout;
594590

595591
PackerOpts->timing_update_type = Options.timing_update_type;
596-
PackerOpts->pack_num_moves = Options.pack_num_moves;
597-
PackerOpts->pack_move_type = Options.pack_move_type;
598592
}
599593

600594
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
@@ -732,8 +732,8 @@ static void ShowPackerOpts(const t_packer_opts& PackerOpts) {
732732
} else {
733733
VPR_FATAL_ERROR(VPR_ERROR_UNKNOWN, "Unknown packer allow_unrelated_clustering\n");
734734
}
735-
VTR_LOG("PackerOpts.alpha_clustering: %f\n", PackerOpts.alpha);
736-
VTR_LOG("PackerOpts.beta_clustering: %f\n", PackerOpts.beta);
735+
VTR_LOG("PackerOpts.timing_gain_weight: %f\n", PackerOpts.timing_gain_weight);
736+
VTR_LOG("PackerOpts.connection_gain_weight: %f\n", PackerOpts.connection_gain_weight);
737737
VTR_LOG("PackerOpts.cluster_seed_type: ");
738738
switch (PackerOpts.cluster_seed_type) {
739739
case e_cluster_seed::TIMING:
@@ -758,7 +758,6 @@ static void ShowPackerOpts(const t_packer_opts& PackerOpts) {
758758
VPR_FATAL_ERROR(VPR_ERROR_UNKNOWN, "Unknown packer cluster_seed_type\n");
759759
}
760760
VTR_LOG("PackerOpts.connection_driven: %s", (PackerOpts.connection_driven ? "true\n" : "false\n"));
761-
VTR_LOG("PackerOpts.global_clocks: %s", (PackerOpts.global_clocks ? "true\n" : "false\n"));
762761
VTR_LOG("PackerOpts.timing_driven: %s", (PackerOpts.timing_driven ? "true\n" : "false\n"));
763762
VTR_LOG("PackerOpts.target_external_pin_util: %s", vtr::join(PackerOpts.target_external_pin_util, " ").c_str());
764763
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-5
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,9 +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;
125-
argparse::ArgValue<std::string> pack_move_type;
126123
/* Placement options */
127124
argparse::ArgValue<int> Seed;
128125
argparse::ArgValue<bool> ShowPlaceTiming;

vpr/src/base/vpr_api.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1400,8 +1400,7 @@ bool vpr_analysis_flow(const Netlist<>& net_list,
14001400
}
14011401

14021402
std::string post_routing_packing_output_file_name = vpr_setup.PackerOpts.output_file + ".post_routing";
1403-
write_packing_results_to_xml(vpr_setup.PackerOpts.global_clocks,
1404-
Arch.architecture_id,
1403+
write_packing_results_to_xml(Arch.architecture_id,
14051404
post_routing_packing_output_file_name.c_str());
14061405
} else {
14071406
VTR_LOG_WARN("Synchronization between packing and routing results is not applied due to illegal circuit implementation\n");

vpr/src/base/vpr_types.h

+62-7
Original file line numberDiff line numberDiff line change
@@ -705,17 +705,75 @@ enum e_stage_action {
705705
/**
706706
* @brief Options for packing
707707
*
708-
* TODO: document each packing parameter
708+
* @param circuit_file_name
709+
* Path to technology mapped user circuit in BLIF format.
710+
* @param output_file
711+
* Path to packed user circuit in net format.
712+
* @param timing_driven
713+
* Whether or not to do timing driven clustering. (Default: on)
714+
* @param timing_gain_weight
715+
* Controls the optimization of timing vs area in timing driven
716+
* clustering.
717+
* A value of 0 focuses only on area; 1 focuses only on timing.
718+
* (Default: 0.75)
719+
* @param connection_gain_weight
720+
* Controls the optimization of smaller net absorption vs. signal
721+
* sharing in connection driven clustering.
722+
* A value of 0 focuses solely on signal sharing; a value of 1
723+
* focuses solely on absorbing smaller nets into a cluster.
724+
* (Default: 0.9)
725+
* @param cluster_seed_type
726+
* Selection algorithm for selecting next seed. (Default: blend2 if
727+
* timing_driven is on; max_inputs otherwise)
728+
* @param target_device_utilization
729+
* Sets the target device utilization. (Default: 1.0)
730+
* @param allow_unrelated_clustering
731+
* Allows primitives which have no attraction to the given cluster
732+
* to be packed into it. (Default: auto)
733+
* @param connection_driven
734+
* Controls whether or not packing prioritizes the absorption of nets
735+
* with fewer connections into a complex logic block over nets with
736+
* more connections. (Default: on)
737+
* @param pack_verbosity
738+
* Controls how verbose clustering's output is. (Default: 2)
739+
* @param enable_pin_feasibility_filter
740+
* Counts the number of available pins in groups/classes of mutually
741+
* connected pins within a cluster, then filters out candidate
742+
* primitives/atoms/molecules for which the cluster has insufficient
743+
* pins to route (without performing a full routing). (Default: on)
744+
* @param balance_block_type_utilization
745+
* If enabled, when a primitive can potentially be mapped to multiple
746+
* block types the packer will pick the block type which (currently)
747+
* has the lowest utilization. (Default: auto)
748+
* @param target_external_pin_util
749+
* Sets the external pin utilization target. (Default: auto)
750+
* @param prioritize_transitive_connectivity
751+
* Whether transitive connectivity is prioritized over high-fanout
752+
* connectivity. (Default: on)
753+
* @param feasible_block_array_size
754+
* Max size of the priority queue for candidates that pass the early
755+
* filter legality test, but not the more detailed routing test.
756+
* (Default: 30)
757+
* @param doPacking
758+
* Run packing stage.
759+
* @param device_layout
760+
* Controls which device layout/floorplan is used from the
761+
* architecture file. (Default: smallest device which satisfies the
762+
* circuit's resource requirements)
763+
* @param timing_update_type
764+
* Controls how timing analysis updates are performed. (Default: auto)
765+
* @param load_flat_placement
766+
* Whether to reconstruct a packing solution from a flat placement
767+
* file. (Default: off; on if <stage option: --legalize> is on)
709768
*/
710769
struct t_packer_opts {
711770
std::string circuit_file_name;
712771
std::string sdc_file_name;
713772
std::string output_file;
714-
bool global_clocks;
715773
bool timing_driven;
716774
enum e_cluster_seed cluster_seed_type;
717-
float alpha;
718-
float beta;
775+
float timing_gain_weight;
776+
float connection_gain_weight;
719777
float target_device_utilization;
720778
e_unrelated_clustering allow_unrelated_clustering;
721779
bool connection_driven;
@@ -730,9 +788,6 @@ struct t_packer_opts {
730788
e_stage_action doPacking;
731789
std::string device_layout;
732790
e_timing_update_type timing_update_type;
733-
bool use_attraction_groups;
734-
int pack_num_moves;
735-
std::string pack_move_type;
736791
bool load_flat_placement = false;
737792
};
738793

vpr/src/pack/cluster_util.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ void check_and_output_clustering(ClusterLegalizer& cluster_legalizer,
7777
}
7878

7979
output_clustering(&cluster_legalizer,
80-
packer_opts.global_clocks,
8180
is_clock,
8281
arch->architecture_id,
8382
packer_opts.output_file.c_str(),

vpr/src/pack/greedy_candidate_selector.cpp

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

301301
e_gain_update gain_flag = e_gain_update::NO_GAIN;
302-
if (!is_clock_.count(net_id) || !packer_opts_.global_clocks)
302+
if (!is_clock_.count(net_id))
303303
gain_flag = e_gain_update::GAIN;
304304

305305
mark_and_update_partial_gain(cluster_gain_stats,
@@ -327,13 +327,9 @@ void GreedyCandidateSelector::update_cluster_gain_stats_candidate_success(
327327
for (AtomPinId pin_id : atom_netlist_.block_clock_pins(blk_id)) {
328328
AtomNetId net_id = atom_netlist_.pin_net(pin_id);
329329

330-
e_gain_update gain_flag = e_gain_update::GAIN;
331-
if (packer_opts_.global_clocks)
332-
gain_flag = e_gain_update::NO_GAIN;
333-
334330
mark_and_update_partial_gain(cluster_gain_stats,
335331
net_id,
336-
gain_flag,
332+
e_gain_update::NO_GAIN,
337333
blk_id,
338334
cluster_legalizer,
339335
high_fanout_net_threshold,
@@ -623,9 +619,9 @@ void GreedyCandidateSelector::update_total_gain(ClusterGainStats& cluster_gain_s
623619
VTR_ASSERT(num_used_pins > 0);
624620
if (packer_opts_.connection_driven) {
625621
/*try to absorb as many connections as possible*/
626-
cluster_gain_stats.gain[blk_id] = ((1 - packer_opts_.beta)
622+
cluster_gain_stats.gain[blk_id] = ((1 - packer_opts_.connection_gain_weight)
627623
* (float)cluster_gain_stats.sharing_gain[blk_id]
628-
+ packer_opts_.beta * (float)cluster_gain_stats.connection_gain[blk_id])
624+
+ packer_opts_.connection_gain_weight * (float)cluster_gain_stats.connection_gain[blk_id])
629625
/ (num_used_pins);
630626
} else {
631627
cluster_gain_stats.gain[blk_id] = ((float)cluster_gain_stats.sharing_gain[blk_id])
@@ -634,9 +630,9 @@ void GreedyCandidateSelector::update_total_gain(ClusterGainStats& cluster_gain_s
634630

635631
/* Add in timing driven cost into cost function */
636632
if (packer_opts_.timing_driven) {
637-
cluster_gain_stats.gain[blk_id] = packer_opts_.alpha
633+
cluster_gain_stats.gain[blk_id] = packer_opts_.timing_gain_weight
638634
* cluster_gain_stats.timing_gain[blk_id]
639-
+ (1.0 - packer_opts_.alpha) * (float)cluster_gain_stats.gain[blk_id];
635+
+ (1.0 - packer_opts_.timing_gain_weight) * (float)cluster_gain_stats.gain[blk_id];
640636
}
641637
}
642638
}

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)