Skip to content

Commit c60fde5

Browse files
[RouterLookahead] Router Lookahead Report
Added an option to generate a report on the router lookahead. This reports profiles the router lookahead by performing a set of trial routes from source RR nodes to all target RR nodes and comparing the estimated cost from the router lookahead to the actual cost of the path. Notably, this report tries to show the mean squared error of the router lookahead and the maximum overestimation of the router lookahead. The mean squared error is a measure of how accurate the router lookahead is. The more accurate the router lookahead is, the faster the path search will be (with less loss in quality). The max overestimation is a measure of the admissibility of the router lookahead heuristic. The more the router lookahead overestimates, the worse the quality of the path found (theoretically).
1 parent 7840430 commit c60fde5

File tree

10 files changed

+393
-1
lines changed

10 files changed

+393
-1
lines changed

doc/src/vpr/command_line_usage.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,6 +1840,17 @@ The following options are only valid when the router is in timing-driven mode (t
18401840

18411841
**Default:** ``map``
18421842

1843+
.. option:: --generate_router_lookahead_report {on | off}
1844+
1845+
If turned on, generates a detailed report on the router lookahead: report_router_lookahead.rpt
1846+
1847+
This report contains information on how accurate the router lookahead is and
1848+
if and when it overestimates the cost from a node to a target node. It does
1849+
this by doing a set of trial routes and comparing the estimated cost from the
1850+
router lookahead to the actual cost of the route path.
1851+
1852+
**Default:** ``off``
1853+
18431854
.. option:: --router_initial_acc_cost_chan_congestion_threshold <float>
18441855

18451856
Utilization threshold above which initial accumulated routing cost (acc_cost) is increased to penalize congested channels.

libs/librrgraph/src/base/rr_node_types.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,31 @@ enum class e_rr_type : unsigned char {
3232
NUM_RR_TYPES
3333
};
3434

35+
/**
36+
* @brief Get the string representation of the given node type. This is useful
37+
* for logging the type of an RR node.
38+
*/
39+
inline std::string get_rr_node_type_str(e_rr_type type) {
40+
switch (type) {
41+
case e_rr_type::SOURCE:
42+
return "SOURCE";
43+
case e_rr_type::SINK:
44+
return "SINK";
45+
case e_rr_type::IPIN:
46+
return "IPIN";
47+
case e_rr_type::OPIN:
48+
return "OPIN";
49+
case e_rr_type::CHANX:
50+
return "CHANX";
51+
case e_rr_type::CHANY:
52+
return "CHANY";
53+
case e_rr_type::NUM_RR_TYPES:
54+
return "NUM_RR_TYPES";
55+
default:
56+
return "UNKNOWN";
57+
}
58+
}
59+
3560
/// Used to iterate for different e_rr_type values in range-based for loops.
3661
constexpr std::array<e_rr_type, (size_t)e_rr_type::NUM_RR_TYPES> RR_TYPES = {{e_rr_type::SOURCE, e_rr_type::SINK, e_rr_type::IPIN,
3762
e_rr_type::OPIN, e_rr_type::CHANX, e_rr_type::CHANY}};

vpr/src/base/SetupVPR.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,8 @@ static void SetupRouterOpts(const t_options& Options, t_router_opts* RouterOpts)
516516
RouterOpts->has_choke_point = Options.router_opt_choke_points;
517517
RouterOpts->custom_3d_sb_fanin_fanout = Options.custom_3d_sb_fanin_fanout;
518518
RouterOpts->with_timing_analysis = Options.timing_analysis;
519+
520+
RouterOpts->generate_router_lookahead_report = Options.generate_router_lookahead_report.value();
519521
}
520522

521523
static void SetupAnnealSched(const t_options& Options,

vpr/src/base/ShowSetup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ static void ShowRouterOpts(const t_router_opts& RouterOpts) {
383383
VTR_LOG("RouterOpts.router_profiler_astar_fac: %f\n", RouterOpts.router_profiler_astar_fac);
384384
VTR_LOG("RouterOpts.enable_parallel_connection_router: %s\n", RouterOpts.enable_parallel_connection_router ? "true" : "false");
385385
VTR_LOG("RouterOpts.post_target_prune_fac: %f\n", RouterOpts.post_target_prune_fac);
386-
VTR_LOG("RouterOpts.post_target_prune_offset: %f\n", RouterOpts.post_target_prune_offset);
386+
VTR_LOG("RouterOpts.post_target_prune_offset: %g\n", RouterOpts.post_target_prune_offset);
387387
VTR_LOG("RouterOpts.multi_queue_num_threads: %d\n", RouterOpts.multi_queue_num_threads);
388388
VTR_LOG("RouterOpts.multi_queue_num_queues: %d\n", RouterOpts.multi_queue_num_queues);
389389
VTR_LOG("RouterOpts.multi_queue_direct_draining: %s\n", RouterOpts.multi_queue_direct_draining ? "true" : "false");

vpr/src/base/read_options.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2936,6 +2936,16 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
29362936
.default_value("map")
29372937
.show_in(argparse::ShowIn::HELP_ONLY);
29382938

2939+
route_timing_grp.add_argument<bool, ParseOnOff>(args.generate_router_lookahead_report, "--generate_router_lookahead_report")
2940+
.help("If turned on, generates a detailed report on the router lookahead: report_router_lookahead.rpt\n"
2941+
"\n"
2942+
"This report contains information on how accurate the router lookahead is and "
2943+
"if and when it overestimates the cost from a node to a target node. It does "
2944+
"this by doing a set of trial routes and comparing the estimated cost from the "
2945+
"router lookahead to the actual cost of the route path.")
2946+
.default_value("off")
2947+
.show_in(argparse::ShowIn::HELP_ONLY);
2948+
29392949
route_timing_grp.add_argument<double>(args.router_initial_acc_cost_chan_congestion_threshold, "--router_initial_acc_cost_chan_congestion_threshold")
29402950
.help("Utilization threshold above which initial accumulated routing cost (acc_cost) "
29412951
"is increased to penalize congested channels. Used to bias routing away from "

vpr/src/base/read_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ struct t_options {
256256
argparse::ArgValue<int> router_debug_sink_rr;
257257
argparse::ArgValue<int> router_debug_iteration;
258258
argparse::ArgValue<e_router_lookahead> router_lookahead_type;
259+
argparse::ArgValue<bool> generate_router_lookahead_report;
259260
argparse::ArgValue<double> router_initial_acc_cost_chan_congestion_threshold;
260261
argparse::ArgValue<double> router_initial_acc_cost_chan_congestion_weight;
261262
argparse::ArgValue<int> router_max_convergence_count;

vpr/src/base/vpr_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,6 +1347,8 @@ struct t_router_opts {
13471347
e_rr_node_reorder_algorithm reorder_rr_graph_nodes_algorithm = DONT_REORDER;
13481348
int reorder_rr_graph_nodes_threshold = 0;
13491349
int reorder_rr_graph_nodes_seed = 1;
1350+
1351+
bool generate_router_lookahead_report;
13501352
};
13511353

13521354
struct t_analysis_opts {

vpr/src/route/route.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "route_profiling.h"
1111
#include "route_utils.h"
1212
#include "rr_graph.h"
13+
#include "router_lookahead_report.h"
1314
#include "vtr_time.h"
1415

1516
bool route(const Netlist<>& net_list,
@@ -152,6 +153,12 @@ bool route(const Netlist<>& net_list,
152153

153154
VTR_ASSERT(router_lookahead != nullptr);
154155

156+
// After the router lookahead has been fully created, generate the router
157+
// lookahead report if requested.
158+
if (router_opts.generate_router_lookahead_report) {
159+
generate_router_lookahead_report(router_lookahead, router_opts);
160+
}
161+
155162
/* Routing parameters */
156163
float pres_fac = router_opts.first_iter_pres_fac;
157164
update_draw_pres_fac(pres_fac); /* Typically 0 -> ignore cong. */

0 commit comments

Comments
 (0)