Skip to content

Commit 93fc414

Browse files
committed
vpr: Add --router_init_wirelength_abort_threshold option
This allows the router's first iteration wirelength based abort threshold to be set via the command-line (previously hard coded). This allows it to be changed for architecture specific reasons.
1 parent b242abe commit 93fc414

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

vpr/src/base/SetupVPR.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ static void SetupRouterOpts(const t_options& Options, t_router_opts *RouterOpts)
325325
RouterOpts->criticality_exp = Options.criticality_exp;
326326
RouterOpts->max_criticality = Options.max_criticality;
327327
RouterOpts->max_router_iterations = Options.max_router_iterations;
328+
RouterOpts->init_wirelength_abort_threshold = Options.router_init_wirelength_abort_threshold;
328329
RouterOpts->min_incremental_reroute_fanout = Options.min_incremental_reroute_fanout;
329330
RouterOpts->incr_reroute_delay_ripup = Options.incr_reroute_delay_ripup;
330331
RouterOpts->pres_fac_mult = Options.pres_fac_mult;

vpr/src/base/read_options.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,12 @@ static argparse::ArgumentParser create_arg_parser(std::string prog_name, t_optio
12301230
.default_value("1.0")
12311231
.show_in(argparse::ShowIn::HELP_ONLY);
12321232

1233+
route_timing_grp.add_argument(args.router_init_wirelength_abort_threshold, "--router_init_wirelength_abort_threshold")
1234+
.help("The first routing iteration wirelength abort threshold."
1235+
" If the first routing iteration uses more than this fraction of available wirelength routing is aborted.")
1236+
.default_value("0.85")
1237+
.show_in(argparse::ShowIn::HELP_ONLY);
1238+
12331239
route_timing_grp.add_argument<e_incr_reroute_delay_ripup,ParseIncrRerouteDelayRipup>(args.incr_reroute_delay_ripup, "--incremental_reroute_delay_ripup")
12341240
.help("Controls whether incremental net routing will rip-up (and re-route) a critical connection for delay, even if the routing is legal.")
12351241
.default_value("auto")

vpr/src/base/read_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ struct t_options {
119119
argparse::ArgValue<float> astar_fac;
120120
argparse::ArgValue<float> max_criticality;
121121
argparse::ArgValue<float> criticality_exp;
122+
argparse::ArgValue<float> router_init_wirelength_abort_threshold;
122123
argparse::ArgValue<e_incr_reroute_delay_ripup> incr_reroute_delay_ripup;
123124
argparse::ArgValue<e_routing_failure_predictor> routing_failure_predictor;
124125
argparse::ArgValue<e_routing_budgets_algorithm> routing_budgets_algorithm;

vpr/src/base/vpr_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,7 @@ struct t_router_opts {
857857
float astar_fac;
858858
float max_criticality;
859859
float criticality_exp;
860+
float init_wirelength_abort_threshold;
860861
bool verify_binary_search;
861862
bool full_stats;
862863
bool congestion_analysis;

vpr/src/route/route_timing.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ void reduce_budgets_if_congested(route_budgets &budgeting_inf,
249249
CBRR& connections_inf, float slope, int itry);
250250

251251
static bool should_route_net(ClusterNetId net_id, const CBRR& connections_inf, bool if_force_reroute);
252-
static bool early_exit_heuristic(const WirelengthInfo& wirelength_info);
252+
static bool early_exit_heuristic(const t_router_opts& router_opts, const WirelengthInfo& wirelength_info);
253253

254254
struct more_sinks_than {
255255
inline bool operator()(const ClusterNetId net_index1, const ClusterNetId net_index2) {
@@ -584,7 +584,7 @@ bool try_timing_driven_route(
584584
/*
585585
* Abort checks: Should we give-up because this routing problem is unlikely to converge to a legal routing?
586586
*/
587-
if (itry == 1 && early_exit_heuristic(wirelength_info)) {
587+
if (itry == 1 && early_exit_heuristic(router_opts, wirelength_info)) {
588588
//Abort
589589
break;
590590
}
@@ -2111,14 +2111,14 @@ static bool should_route_net(ClusterNetId net_id, const CBRR& connections_inf, b
21112111
return false; /* Current route has no overuse */
21122112
}
21132113

2114-
static bool early_exit_heuristic(const WirelengthInfo& wirelength_info) {
2114+
static bool early_exit_heuristic(const t_router_opts& router_opts, const WirelengthInfo& wirelength_info) {
21152115
/* Early exit code for cases where it is obvious that a successful route will not be found
21162116
Heuristic: If total wirelength used in first routing iteration is X% of total available wirelength, exit */
21172117

2118-
if (wirelength_info.used_wirelength_ratio() > FIRST_ITER_WIRELENTH_LIMIT) {
2118+
if (wirelength_info.used_wirelength_ratio() > router_opts.init_wirelength_abort_threshold) {
21192119
VTR_LOG("Wire length usage ratio %g exceeds limit of %g, fail routing.\n",
21202120
wirelength_info.used_wirelength_ratio(),
2121-
FIRST_ITER_WIRELENTH_LIMIT);
2121+
router_opts.init_wirelength_abort_threshold);
21222122
return true;
21232123
}
21242124
return false;

0 commit comments

Comments
 (0)