Skip to content

Commit 4192107

Browse files
add --place_frequency to read_options
1 parent eff6743 commit 4192107

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

vpr/src/base/read_options.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,37 @@ struct ParsePlaceBoundingBox {
618618
}
619619
};
620620

621+
struct ParsePlacementFreq {
622+
ConvertedValue<e_place_freq> from_str(const std::string& str) {
623+
ConvertedValue<e_place_freq> conv_value;
624+
if (str == "once") {
625+
conv_value.set_value(e_place_freq::ONCE);
626+
} else if (str == "always") {
627+
conv_value.set_value(e_place_freq::ALWAYS);
628+
} else {
629+
std::stringstream msg;
630+
msg << "Invalid conversion from '" << str << "' to e_place_freq (expected one of: " << argparse::join(default_choices(), ", ") << ")";
631+
conv_value.set_error(msg.str());
632+
}
633+
return conv_value;
634+
}
635+
636+
ConvertedValue<std::string> to_str(e_place_freq val) {
637+
ConvertedValue<std::string> conv_value;
638+
if (val == e_place_freq::ONCE) {
639+
conv_value.set_value("once");
640+
} else {
641+
VTR_ASSERT(val == e_place_freq::ALWAYS);
642+
conv_value.set_value("always");
643+
}
644+
return conv_value;
645+
}
646+
647+
std::vector<std::string> default_choices() {
648+
return {"once", "always"};
649+
}
650+
};
651+
621652
struct ParsePlaceAgentAlgorithm {
622653
ConvertedValue<e_agent_algorithm> from_str(const std::string& str) {
623654
ConvertedValue<e_agent_algorithm> conv_value;
@@ -2343,6 +2374,12 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
23432374
.choices({"auto_bb", "cube_bb", "per_layer_bb"})
23442375
.show_in(argparse::ShowIn::HELP_ONLY);
23452376

2377+
place_grp.add_argument<e_place_freq, ParsePlacementFreq>(args.place_placement_freq, "--place_frequency")
2378+
.help("Run placement every time or only once during channel width search.")
2379+
.default_value("once")
2380+
.choices({"once, always"})
2381+
.show_in(argparse::ShowIn::HELP_ONLY);
2382+
23462383
place_grp.add_argument<bool, ParseOnOff>(args.RL_agent_placement, "--RL_agent_placement")
23472384
.help(
23482385
"Uses a Reinforcement Learning (RL) agent in choosing the appropriate move type in placement."

vpr/src/base/read_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ struct t_options {
148148
argparse::ArgValue<std::vector<float>> place_static_move_prob;
149149
argparse::ArgValue<int> place_high_fanout_net;
150150
argparse::ArgValue<e_place_bounding_box_mode> place_bounding_box_mode;
151+
argparse::ArgValue<e_place_freq> place_placement_freq;
151152

152153
argparse::ArgValue<bool> RL_agent_placement;
153154
argparse::ArgValue<bool> place_agent_multistate;

vpr/src/base/setup_vpr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ static void setup_placer_opts(const t_options& Options, t_placer_opts* PlacerOpt
683683
PlacerOpts->delay_model_type = Options.place_delay_model;
684684
PlacerOpts->delay_model_reducer = Options.place_delay_model_reducer;
685685

686-
PlacerOpts->place_freq = e_place_freq::ALWAYS; /* DEFAULT */
686+
PlacerOpts->place_freq = Options.place_placement_freq;
687687

688688
PlacerOpts->post_place_timing_report_file = Options.post_place_timing_report_file;
689689

0 commit comments

Comments
 (0)