Skip to content

Commit 99cedb8

Browse files
committed
check_route: add option to disable, quick check or full check
The difference between the "quick" and "full" check is the non-configurable nodes that are checked in the "full" and skipped with the "quick" option Signed-off-by: Alessandro Comodi <[email protected]>
1 parent f99eb2a commit 99cedb8

File tree

5 files changed

+57
-16
lines changed

5 files changed

+57
-16
lines changed

vpr/src/base/SetupVPR.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,7 @@ static void SetupRouterOpts(const t_options& Options, t_router_opts* RouterOpts)
381381
RouterOpts->router_heap = Options.router_heap;
382382
RouterOpts->exit_after_first_routing_iteration = Options.exit_after_first_routing_iteration;
383383

384-
RouterOpts->disable_check_route = Options.disable_check_route;
385-
RouterOpts->quick_check_route = Options.quick_check_route;
384+
RouterOpts->check_route = Options.check_route;
386385
}
387386

388387
static void SetupAnnealSched(const t_options& Options,

vpr/src/base/read_options.cpp

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,41 @@ struct ParseRouterHeap {
858858
}
859859
};
860860

861+
struct ParseCheckRoute {
862+
ConvertedValue<e_check_route_option> from_str(std::string str) {
863+
ConvertedValue<e_check_route_option> conv_value;
864+
if (str == "off")
865+
conv_value.set_value(e_check_route_option::OFF);
866+
else if (str == "quick")
867+
conv_value.set_value(e_check_route_option::QUICK);
868+
else if (str == "full")
869+
conv_value.set_value(e_check_route_option::FULL);
870+
else {
871+
std::stringstream msg;
872+
msg << "Invalid conversion from '" << str << "' to e_check_route_option (expected one of: " << argparse::join(default_choices(), ", ") << ")";
873+
conv_value.set_error(msg.str());
874+
}
875+
return conv_value;
876+
}
877+
878+
ConvertedValue<std::string> to_str(e_check_route_option val) {
879+
ConvertedValue<std::string> conv_value;
880+
if (val == e_check_route_option::OFF)
881+
conv_value.set_value("off");
882+
else if (val == e_check_route_option::QUICK)
883+
conv_value.set_value("quick");
884+
else {
885+
VTR_ASSERT(val == e_check_route_option::FULL);
886+
conv_value.set_value("full");
887+
}
888+
return conv_value;
889+
}
890+
891+
std::vector<std::string> default_choices() {
892+
return {"off", "quick", "full"};
893+
}
894+
};
895+
861896
struct ParsePlaceEfforScaling {
862897
ConvertedValue<e_place_effort_scaling> from_str(std::string str) {
863898
ConvertedValue<e_place_effort_scaling> conv_value;
@@ -1887,14 +1922,13 @@ argparse::ArgumentParser create_arg_parser(std::string prog_name, t_options& arg
18871922
.default_value("off")
18881923
.show_in(argparse::ShowIn::HELP_ONLY);
18891924

1890-
route_timing_grp.add_argument<bool, ParseOnOff>(args.disable_check_route, "--disable_check_route")
1891-
.help("Disables check_route once routing step has finished or when routing file is loaded")
1892-
.default_value("off")
1893-
.show_in(argparse::ShowIn::HELP_ONLY);
1894-
1895-
route_timing_grp.add_argument<bool, ParseOnOff>(args.quick_check_route, "--quick_check_route")
1896-
.help("Runs check_route, disabling slow checks, once routing step has finished or when routing file is loaded")
1897-
.default_value("off")
1925+
route_timing_grp.add_argument<e_check_route_option, ParseCheckRoute>(args.check_route, "--check_route")
1926+
.help(
1927+
"Options to run check route in three different modes.\n"
1928+
" * off : check route is completely disabled.\n"
1929+
" * quick : runs check route with slow checks disabled.\n"
1930+
" * full : runs the full check route step.\n")
1931+
.default_value("quick")
18981932
.show_in(argparse::ShowIn::HELP_ONLY);
18991933

19001934
route_timing_grp.add_argument(args.router_debug_net, "--router_debug_net")

vpr/src/base/read_options.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ struct t_options {
140140
argparse::ArgValue<int> min_incremental_reroute_fanout;
141141
argparse::ArgValue<bool> read_rr_edge_metadata;
142142
argparse::ArgValue<bool> exit_after_first_routing_iteration;
143-
argparse::ArgValue<bool> disable_check_route;
144-
argparse::ArgValue<bool> quick_check_route;
143+
argparse::ArgValue<e_check_route_option> check_route;
145144

146145
/* Timing-driven router options only */
147146
argparse::ArgValue<float> astar_fac;

vpr/src/base/vpr_api.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,12 @@ RouteStatus vpr_route_flow(t_vpr_setup& vpr_setup, const t_arch& arch) {
710710
std::string graphics_msg;
711711
if (route_status.success()) {
712712
//Sanity check the routing
713-
if (!router_opts.disable_check_route) {
714-
check_route(router_opts.route_type, router_opts.quick_check_route);
713+
if (router_opts.check_route == e_check_route_option::QUICK) {
714+
check_route(router_opts.route_type, /*quick=*/true);
715+
} else if (router_opts.check_route == e_check_route_option::FULL) {
716+
check_route(router_opts.route_type, /*quick=*/false);
717+
} else {
718+
VTR_LOG_WARN("The user disabled the check route step.");
715719
}
716720
get_serial_num();
717721

vpr/src/base/vpr_types.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ enum class e_balance_block_type_util {
139139
AUTO
140140
};
141141

142+
enum class e_check_route_option {
143+
OFF,
144+
QUICK,
145+
FULL
146+
};
147+
142148
/* Selection algorithm for selecting next seed */
143149
enum class e_cluster_seed {
144150
TIMING,
@@ -1000,8 +1006,7 @@ struct t_router_opts {
10001006
e_heap_type router_heap;
10011007
bool exit_after_first_routing_iteration;
10021008

1003-
bool disable_check_route;
1004-
bool quick_check_route;
1009+
e_check_route_option check_route;
10051010
};
10061011

10071012
struct t_analysis_opts {

0 commit comments

Comments
 (0)