Skip to content

Commit efe7cc0

Browse files
authored
Merge pull request #2523 from verilog-to-routing/pres_fac_max
Set the maximum pres_fac
2 parents 486be09 + 24d69c0 commit efe7cc0

File tree

12 files changed

+80
-59
lines changed

12 files changed

+80
-59
lines changed

doc/src/vpr/command_line_usage.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,14 @@ VPR uses a negotiated congestion algorithm (based on Pathfinder) to perform rout
11631163

11641164
**Default:** ``1.3``
11651165

1166+
.. option:: --max_pres_fac <float>
1167+
1168+
Sets the maximum present overuse penalty factor that can ever result during routing. Should always be less than 1e25 or so to prevent overflow.
1169+
Smaller values may help prevent circuitous routing in difficult routing problems, but may increase
1170+
the number of routing iterations needed and hence runtime.
1171+
1172+
**Default:** ``1000.0``
1173+
11661174
.. option:: --acc_fac <float>
11671175

11681176
Specifies the accumulated overuse factor (historical congestion cost factor).

vpr/src/base/SetupVPR.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ static void SetupRouterOpts(const t_options& Options, t_router_opts* RouterOpts)
423423
RouterOpts->min_incremental_reroute_fanout = Options.min_incremental_reroute_fanout;
424424
RouterOpts->incr_reroute_delay_ripup = Options.incr_reroute_delay_ripup;
425425
RouterOpts->pres_fac_mult = Options.pres_fac_mult;
426+
RouterOpts->max_pres_fac = Options.max_pres_fac;
426427
RouterOpts->route_type = Options.RouteType;
427428

428429
RouterOpts->full_stats = Options.full_stats;

vpr/src/base/ShowSetup.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ static void ShowRouterOpts(const t_router_opts& RouterOpts) {
328328
VTR_LOG("RouterOpts.first_iter_pres_fac: %f\n", RouterOpts.first_iter_pres_fac);
329329
VTR_LOG("RouterOpts.initial_pres_fac: %f\n", RouterOpts.initial_pres_fac);
330330
VTR_LOG("RouterOpts.pres_fac_mult: %f\n", RouterOpts.pres_fac_mult);
331+
VTR_LOG("RouterOpts.max_pres_fac: %f\n", RouterOpts.max_pres_fac);
331332
VTR_LOG("RouterOpts.max_router_iterations: %d\n", RouterOpts.max_router_iterations);
332333
VTR_LOG("RouterOpts.min_incremental_reroute_fanout: %d\n", RouterOpts.min_incremental_reroute_fanout);
333334
VTR_LOG("RouterOpts.do_check_rr_graph: %s\n", RouterOpts.do_check_rr_graph ? "true" : "false");
@@ -473,6 +474,7 @@ static void ShowRouterOpts(const t_router_opts& RouterOpts) {
473474
VTR_LOG("RouterOpts.first_iter_pres_fac: %f\n", RouterOpts.first_iter_pres_fac);
474475
VTR_LOG("RouterOpts.initial_pres_fac: %f\n", RouterOpts.initial_pres_fac);
475476
VTR_LOG("RouterOpts.pres_fac_mult: %f\n", RouterOpts.pres_fac_mult);
477+
VTR_LOG("RouterOpts.max_pres_fac: %f\n", RouterOpts.max_pres_fac);
476478
VTR_LOG("RouterOpts.max_router_iterations: %d\n", RouterOpts.max_router_iterations);
477479
VTR_LOG("RouterOpts.min_incremental_reroute_fanout: %d\n", RouterOpts.min_incremental_reroute_fanout);
478480
VTR_LOG("RouterOpts.do_check_rr_graph: %s\n", RouterOpts.do_check_rr_graph ? "true" : "false");

vpr/src/base/read_options.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2333,6 +2333,11 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
23332333
.default_value("1.3")
23342334
.show_in(argparse::ShowIn::HELP_ONLY);
23352335

2336+
route_grp.add_argument(args.max_pres_fac, "-max_pres_fac")
2337+
.help("Sets the maximum present overuse penalty factor")
2338+
.default_value("1000.0")
2339+
.show_in(argparse::ShowIn::HELP_ONLY);
2340+
23362341
route_grp.add_argument(args.acc_fac, "--acc_fac")
23372342
.help("Specifies the accumulated overuse factor (historical congestion cost factor)")
23382343
.default_value("1.0")

vpr/src/base/read_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ struct t_options {
187187
argparse::ArgValue<float> first_iter_pres_fac;
188188
argparse::ArgValue<float> initial_pres_fac;
189189
argparse::ArgValue<float> pres_fac_mult;
190+
argparse::ArgValue<float> max_pres_fac;
190191
argparse::ArgValue<float> acc_fac;
191192
argparse::ArgValue<int> bb_factor;
192193
argparse::ArgValue<e_base_cost_type> base_cost_type;

vpr/src/base/vpr_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,6 +1405,7 @@ struct t_router_opts {
14051405
float first_iter_pres_fac;
14061406
float initial_pres_fac;
14071407
float pres_fac_mult;
1408+
float max_pres_fac;
14081409
float acc_fac;
14091410
float bend_cost;
14101411
int max_router_iterations;

vpr/src/place/place.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,8 +1709,8 @@ static e_move_result try_swap(const t_annealing_state* state,
17091709
if (manual_move_enabled) {
17101710
#ifndef NO_GRAPHICS
17111711
create_move_outcome = manual_move_display_and_propose(manual_move_generator, blocks_affected, proposed_action.move_type, rlim, placer_opts, criticalities);
1712-
#else //NO_GRAPHICS
1713-
// Cast to void to explicitly avoid warning.
1712+
#else //NO_GRAPHICS
1713+
//Cast to void to explicitly avoid warning.
17141714
(void)manual_move_generator;
17151715
#endif //NO_GRAPHICS
17161716
} else if (router_block_move) {

vpr/src/route/route.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ bool route(const Netlist<>& net_list,
155155
VTR_ASSERT(router_lookahead != nullptr);
156156

157157
/* Routing parameters */
158-
float pres_fac = update_draw_pres_fac(router_opts.first_iter_pres_fac); /* Typically 0 -> ignore cong. */
158+
float pres_fac = router_opts.first_iter_pres_fac;
159+
update_draw_pres_fac(pres_fac); /* Typically 0 -> ignore cong. */
159160
int bb_fac = router_opts.bb_factor;
160161

161162
/* When routing conflicts are detected the bounding boxes are scaled
@@ -357,7 +358,8 @@ bool route(const Netlist<>& net_list,
357358
//Decrease pres_fac so that critical connections will take more direct routes
358359
//Note that we use first_iter_pres_fac here (typically zero), and switch to
359360
//use initial_pres_fac on the next iteration.
360-
pres_fac = update_draw_pres_fac(router_opts.first_iter_pres_fac);
361+
pres_fac = router_opts.first_iter_pres_fac;
362+
update_draw_pres_fac(pres_fac);
361363

362364
//Reduce timing tolerances to re-route more delay-suboptimal signals
363365
connections_inf.set_connection_criticality_tolerance(0.7);
@@ -374,7 +376,8 @@ bool route(const Netlist<>& net_list,
374376
//after the first routing convergence. Since that is often zero,
375377
//we want to set pres_fac to a reasonable (i.e. typically non-zero)
376378
//value afterwards -- so it grows when multiplied by pres_fac_mult
377-
pres_fac = update_draw_pres_fac(router_opts.initial_pres_fac);
379+
pres_fac = router_opts.initial_pres_fac;
380+
update_draw_pres_fac(pres_fac);
378381
}
379382

380383
//Have we converged the maximum number of times, did not make any changes, or does it seem
@@ -437,12 +440,13 @@ bool route(const Netlist<>& net_list,
437440

438441
//Update pres_fac
439442
if (itry == 1) {
440-
pres_fac = update_draw_pres_fac(router_opts.initial_pres_fac);
443+
pres_fac = router_opts.initial_pres_fac;
444+
update_draw_pres_fac(pres_fac);
441445
} else {
442446
pres_fac *= router_opts.pres_fac_mult;
443-
444-
/* Avoid overflow for high iteration counts, even if acc_cost is big */
445-
pres_fac = update_draw_pres_fac(std::min(pres_fac, static_cast<float>(HUGE_POSITIVE_FLOAT / 1e5)));
447+
pres_fac = std::min(pres_fac, router_opts.max_pres_fac);
448+
/* Set the maximum pres_fac to the value passed by the command line argument */
449+
update_draw_pres_fac(pres_fac);
446450

447451
// Increase short path criticality if it's having a hard time resolving hold violations due to congestion
448452
if (budgeting_inf.if_set()) {

vpr/src/route/route_utils.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -507,15 +507,16 @@ void try_graph(int width_fac,
507507
is_flat);
508508
}
509509

510-
float update_draw_pres_fac(float new_pres_fac) {
511510
#ifndef NO_GRAPHICS
512-
511+
void update_draw_pres_fac(const float new_pres_fac) {
512+
#else
513+
void update_draw_pres_fac(const float /*new_pres_fac*/) {
514+
#endif
515+
#ifndef NO_GRAPHICS
513516
// Only updates the drawing pres_fac if graphics is enabled
514517
get_draw_state_vars()->pres_fac = new_pres_fac;
515518

516519
#endif // NO_GRAPHICS
517-
518-
return new_pres_fac;
519520
}
520521

521522
#ifndef NO_GRAPHICS

vpr/src/route/route_utils.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,8 @@ void try_graph(int width_fac,
136136
int num_directs,
137137
bool is_flat);
138138

139-
/* This routine should take the new value of the present congestion factor
140-
* and propagate it to all the relevant data fields in the vpr flow.
141-
* Currently, it only updates the pres_fac used by the drawing functions */
142-
float update_draw_pres_fac(float new_pres_fac);
139+
/* This routine updates the pres_fac used by the drawing functions */
140+
void update_draw_pres_fac(const float new_pres_fac);
143141

144142
#ifndef NO_GRAPHICS
145143
/** Updates router iteration information and checks for router iteration and net id breakpoints

vtr_flow/tasks/regression_tests/vtr_reg_nightly_test1_odin/arithmetic_tasks/FIR_filters_frac/config/golden_results.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ k6_frac_2uripple_N8_22nm.xml fir_nopipe_27.v common 21.80 vpr 75.34 MiB 0.13 12
133133
k6_frac_2uripple_N8_22nm.xml fir_nopipe_28.v common 27.61 vpr 75.93 MiB 0.13 12672 -1 -1 1 0.42 -1 -1 39444 -1 -1 83 22 0 8 success 3634420-dirty release IPO VTR_ASSERT_LEVEL=2 GNU 9.5.0 on Linux-5.10.35-v8 x86_64 2023-11-11T22:36:55 gh-actions-runner-vtr-auto-spawned38 /root/vtr-verilog-to-routing/vtr-verilog-to-routing 77752 22 19 2459 1781 1 1417 132 18 18 324 mult_36 auto 38.4 MiB 0.91 8901 22577 4985 14993 2599 75.9 MiB 0.76 0.01 7.8713 -549.689 -7.8713 7.8713 1.41 0.0044721 0.00400453 0.37567 0.335486 70 15022 26 8.18539e+06 4.3894e+06 1.34436e+06 4149.26 18.64 2.63309 2.3407 37264 347768 -1 13242 23 9518 11089 1869023 398865 0 0 1869023 398865 10194 9636 0 0 76816 71405 0 0 102665 82788 0 0 10196 9695 0 0 837549 113400 0 0 831603 111941 0 0 10194 0 0 701 5045 4474 13769 940 130 8.87728 8.87728 -957.043 -8.87728 0 0 1.69344e+06 5226.66 0.81 0.83 0.44 -1 -1 0.81 0.299514 0.271162 594 551 513 19 0 0
134134
k6_frac_2uripple_N8_22nm.xml fir_nopipe_29.v common 27.15 vpr 76.10 MiB 0.14 12824 -1 -1 1 0.46 -1 -1 40700 -1 -1 85 22 0 9 success 3634420-dirty release IPO VTR_ASSERT_LEVEL=2 GNU 9.5.0 on Linux-5.10.35-v8 x86_64 2023-11-11T22:36:55 gh-actions-runner-vtr-auto-spawned38 /root/vtr-verilog-to-routing/vtr-verilog-to-routing 77928 22 19 2565 1853 1 1485 135 22 22 484 mult_36 auto 38.7 MiB 0.98 9689 25047 6275 16269 2503 76.1 MiB 0.94 0.01 7.43624 -544.661 -7.43624 7.43624 2.37 0.00627739 0.005399 0.475538 0.415759 70 16428 27 1.33067e+07 4.81483e+06 2.06816e+06 4273.05 14.91 2.30064 2.03522 56434 539830 -1 14001 25 11439 13263 2233851 474457 0 0 2233851 474457 12595 11730 0 0 97078 90555 0 0 128940 103685 0 0 12598 11816 0 0 988671 129989 0 0 993969 126682 0 0 12595 0 0 1181 5046 6091 28215 698 2 8.73683 8.73683 -847.048 -8.73683 0 0 2.60483e+06 5381.88 1.40 1.01 0.68 -1 -1 1.40 0.349618 0.316208 619 570 532 19 0 0
135135
k6_frac_2uripple_N8_22nm.xml fir_nopipe_30.v common 25.19 vpr 76.62 MiB 0.14 12956 -1 -1 1 0.47 -1 -1 39948 -1 -1 89 22 0 9 success 3634420-dirty release IPO VTR_ASSERT_LEVEL=2 GNU 9.5.0 on Linux-5.10.35-v8 x86_64 2023-11-11T22:36:55 gh-actions-runner-vtr-auto-spawned38 /root/vtr-verilog-to-routing/vtr-verilog-to-routing 78460 22 19 2639 1910 1 1523 139 22 22 484 mult_36 auto 39.2 MiB 1.02 9640 28859 6707 18502 3650 76.6 MiB 1.13 0.01 7.43624 -520.251 -7.43624 7.43624 2.32 0.00629213 0.00540153 0.557969 0.48787 70 16649 34 1.33067e+07 4.87369e+06 2.06816e+06 4273.05 12.67 2.06295 1.82406 56434 539830 -1 14184 24 12418 14250 2862133 602975 0 0 2862133 602975 13565 12580 0 0 104860 98182 0 0 141217 112467 0 0 13569 12703 0 0 1300740 182621 0 0 1288182 184422 0 0 13565 0 0 1174 4689 4837 20323 761 3 8.95347 8.95347 -846.506 -8.95347 0 0 2.60483e+06 5381.88 1.35 1.16 0.68 -1 -1 1.35 0.337838 0.304321 639 589 551 19 0 0
136-
k6_frac_2uripple_N8_22nm.xml fir_nopipe_31.v common 29.27 vpr 77.28 MiB 0.15 13268 -1 -1 1 0.50 -1 -1 40004 -1 -1 93 22 0 9 success 3634420-dirty release IPO VTR_ASSERT_LEVEL=2 GNU 9.5.0 on Linux-5.10.35-v8 x86_64 2023-11-11T22:36:55 gh-actions-runner-vtr-auto-spawned38 /root/vtr-verilog-to-routing/vtr-verilog-to-routing 79136 22 19 2744 1981 1 1590 143 22 22 484 mult_36 auto 39.9 MiB 1.02 10213 28491 6600 18816 3075 77.3 MiB 1.04 0.01 7.49539 -582.535 -7.49539 7.49539 2.26 0.00571464 0.00518578 0.46636 0.42051 66 19056 43 1.33067e+07 4.93255e+06 1.96511e+06 4060.15 17.03 2.09287 1.85069 54986 507526 -1 15439 26 13348 15703 3065311 631596 0 0 3065311 631596 14541 13592 0 0 110840 103858 0 0 151041 119264 0 0 14544 13652 0 0 1379224 189774 0 0 1395121 191456 0 0 14541 0 0 1223 6898 7095 21649 1209 28 9.15632 9.15632 -1101.43 -9.15632 0 0 2.45963e+06 5081.88 1.27 1.24 0.60 -1 -1 1.27 0.360304 0.325056 665 608 570 19 0 0
136+
k6_frac_2uripple_N8_22nm.xml fir_nopipe_31.v common 29.27 vpr 77.28 MiB 0.15 13268 -1 -1 1 0.50 -1 -1 40004 -1 -1 93 22 0 9 success 3634420-dirty release IPO VTR_ASSERT_LEVEL=2 GNU 9.5.0 on Linux-5.10.35-v8 x86_64 2023-11-11T22:36:55 gh-actions-runner-vtr-auto-spawned38 /root/vtr-verilog-to-routing/vtr-verilog-to-routing 79136 22 19 2744 1981 1 1590 143 22 22 484 mult_36 auto 39.9 MiB 1.02 10213 28491 6600 18816 3075 77.3 MiB 1.04 0.01 7.49539 -582.535 -7.49539 7.49539 2.26 0.00571464 0.00518578 0.46636 0.42051 70 19056 43 1.33067e+07 4.93255e+06 1.96511e+06 4060.15 17.03 2.09287 1.85069 54986 507526 -1 15439 26 13348 15703 3065311 631596 0 0 3065311 631596 14541 13592 0 0 110840 103858 0 0 151041 119264 0 0 14544 13652 0 0 1379224 189774 0 0 1395121 191456 0 0 14541 0 0 1223 6898 7095 21649 1209 28 9.15632 9.15632 -1101.43 -9.15632 0 0 2.45963e+06 5081.88 1.27 1.24 0.60 -1 -1 1.27 0.360304 0.325056 665 608 570 19 0 0
137137
k6_frac_2uripple_N8_22nm.xml fir_nopipe_32.v common 91.23 vpr 77.48 MiB 0.15 13384 -1 -1 1 0.55 -1 -1 40200 -1 -1 96 22 0 9 success 3634420-dirty release IPO VTR_ASSERT_LEVEL=2 GNU 9.5.0 on Linux-5.10.35-v8 x86_64 2023-11-11T22:36:55 gh-actions-runner-vtr-auto-spawned38 /root/vtr-verilog-to-routing/vtr-verilog-to-routing 79340 22 19 2818 2038 1 1627 146 22 22 484 mult_36 auto 40.3 MiB 1.09 10325 30482 7786 19419 3277 77.5 MiB 1.10 0.01 7.52039 -582.013 -7.52039 7.52039 2.22 0.00673795 0.00600573 0.559271 0.496011 66 18458 33 1.33067e+07 4.9767e+06 1.96511e+06 4060.15 78.92 4.50174 3.97192 54986 507526 -1 15293 24 12697 14781 2882895 607845 0 0 2882895 607845 13913 12967 0 0 106785 100349 0 0 141821 114087 0 0 13919 13073 0 0 1294441 181143 0 0 1312016 186226 0 0 13913 0 0 1241 5665 5902 20707 932 59 9.34202 9.34202 -1030.73 -9.34202 0 0 2.45963e+06 5081.88 1.31 1.11 0.62 -1 -1 1.31 0.310599 0.281128 684 627 589 19 0 0
138138
k6_frac_2uripple_N8_22nm.xml fir_nopipe_33.v common 26.53 vpr 78.12 MiB 0.16 13808 -1 -1 1 0.56 -1 -1 40348 -1 -1 100 22 0 10 success 3634420-dirty release IPO VTR_ASSERT_LEVEL=2 GNU 9.5.0 on Linux-5.10.35-v8 x86_64 2023-11-11T22:36:55 gh-actions-runner-vtr-auto-spawned38 /root/vtr-verilog-to-routing/vtr-verilog-to-routing 79992 22 19 2923 2109 1 1695 151 22 22 484 mult_36 auto 40.9 MiB 0.97 10491 33835 8574 21105 4156 78.1 MiB 1.20 0.01 7.94064 -597.141 -7.94064 7.94064 2.29 0.00674974 0.00577428 0.614694 0.531941 64 19070 50 1.33067e+07 5.43155e+06 1.90554e+06 3937.06 14.02 2.63693 2.32895 54502 494576 -1 15787 25 13858 15489 2824485 600452 0 0 2824485 600452 14633 14088 0 0 112285 105253 0 0 152161 121338 0 0 14640 14194 0 0 1278006 170780 0 0 1252760 174799 0 0 14633 0 0 801 4949 5286 21186 894 34 9.95291 9.95291 -1096.7 -9.95291 0 0 2.40101e+06 4960.76 1.27 1.19 0.59 -1 -1 1.27 0.380018 0.342807 710 646 608 19 0 0
139139
k6_frac_2uripple_N8_22nm.xml fir_nopipe_34.v common 38.28 vpr 78.56 MiB 0.16 14048 -1 -1 1 0.58 -1 -1 40192 -1 -1 101 22 0 10 success 3634420-dirty release IPO VTR_ASSERT_LEVEL=2 GNU 9.5.0 on Linux-5.10.35-v8 x86_64 2023-11-11T22:36:55 gh-actions-runner-vtr-auto-spawned38 /root/vtr-verilog-to-routing/vtr-verilog-to-routing 80444 22 19 2997 2166 1 1734 152 22 22 484 mult_36 auto 41.4 MiB 1.33 10939 30122 6941 19995 3186 78.6 MiB 1.07 0.01 7.88963 -601.708 -7.88963 7.88963 2.34 0.00551573 0.0049006 0.494171 0.437728 66 19440 28 1.33067e+07 5.44627e+06 1.96511e+06 4060.15 25.16 3.23147 2.86271 54986 507526 -1 16262 25 13499 15395 2906042 608239 0 0 2906042 608239 14574 13765 0 0 115250 108127 0 0 152837 123878 0 0 14585 13883 0 0 1312936 172636 0 0 1295860 175950 0 0 14574 0 0 1098 5319 5331 20493 889 64 9.72351 9.72351 -1073.66 -9.72351 0 0 2.45963e+06 5081.88 1.32 1.22 0.63 -1 -1 1.32 0.385734 0.348973 729 665 627 19 0 0

0 commit comments

Comments
 (0)