Skip to content

Commit a137fbe

Browse files
authored
Merge pull request #2456 from verilog-to-routing/route_log_msg
Routing Stats
2 parents 3c61f36 + 024fd36 commit a137fbe

File tree

6 files changed

+53
-165
lines changed

6 files changed

+53
-165
lines changed

vpr/src/route/connection_router.cpp

Lines changed: 46 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,17 @@ static bool relevant_node_to_target(const RRGraphView* rr_graph,
2525
RRNodeId node_to_add,
2626
RRNodeId target_node);
2727

28-
static void update_router_stats(const DeviceContext& device_ctx,
29-
const RRGraphView* rr_graph,
30-
RouterStats* router_stats,
28+
#ifdef VTR_ENABLE_DEBUG_LOGGING
29+
static void update_router_stats(RouterStats* router_stats,
30+
bool is_push,
3131
RRNodeId rr_node_id,
32-
bool is_push);
32+
const RRGraphView* rr_graph);
33+
#else
34+
static void update_router_stats(RouterStats* router_stats,
35+
bool is_push,
36+
RRNodeId /*rr_node_id*/,
37+
const RRGraphView* /*rr_graph*/);
38+
#endif
3339

3440
/** return tuple <found_path, retry_with_full_bb, cheapest> */
3541
template<typename Heap>
@@ -73,7 +79,7 @@ std::tuple<bool, t_heap*> ConnectionRouter<Heap>::timing_driven_route_connection
7379
//Re-add route nodes from the existing route tree to the heap.
7480
//They need to be repushed onto the heap since each node's cost is target specific.
7581

76-
add_route_tree_to_heap(rt_root, sink_node, cost_params, false);
82+
add_route_tree_to_heap(rt_root, sink_node, cost_params);
7783
heap_.build_heap(); // via sifting down everything
7884

7985
RRNodeId source_node = rt_root.inode;
@@ -137,7 +143,6 @@ std::tuple<bool, bool, t_heap> ConnectionRouter<Heap>::timing_driven_route_conne
137143

138144
// re-explore route tree from root to add any new nodes (buildheap afterwards)
139145
// route tree needs to be repushed onto the heap since each node's cost is target specific
140-
router_stats_->add_high_fanout_rt++;
141146
t_bb high_fanout_bb = add_high_fanout_route_tree_to_heap(rt_root, sink_node, cost_params, spatial_rt_lookup, net_bounding_box);
142147
heap_.build_heap();
143148

@@ -215,11 +220,10 @@ t_heap* ConnectionRouter<Heap>::timing_driven_route_connection_from_heap(RRNodeI
215220
while (!heap_.is_empty_heap()) {
216221
// cheapest t_heap in current route tree to be expanded on
217222
cheapest = heap_.get_heap_head();
218-
update_router_stats(device_ctx,
219-
rr_graph_,
220-
router_stats_,
223+
update_router_stats(router_stats_,
224+
false,
221225
cheapest->index,
222-
false);
226+
rr_graph_);
223227

224228
RRNodeId inode = cheapest->index;
225229
VTR_LOGV_DEBUG(router_debug_, " Popping node %d (cost: %g)\n",
@@ -274,7 +278,7 @@ vtr::vector<RRNodeId, t_heap> ConnectionRouter<Heap>::timing_driven_find_all_sho
274278

275279
// Add the route tree to the heap with no specific target node
276280
RRNodeId target_node = RRNodeId::INVALID();
277-
add_route_tree_to_heap(rt_root, target_node, cost_params, false);
281+
add_route_tree_to_heap(rt_root, target_node, cost_params);
278282
heap_.build_heap(); // via sifting down everything
279283

280284
auto res = timing_driven_find_all_shortest_paths_from_heap(cost_params, bounding_box);
@@ -305,11 +309,10 @@ vtr::vector<RRNodeId, t_heap> ConnectionRouter<Heap>::timing_driven_find_all_sho
305309
while (!heap_.is_empty_heap()) {
306310
// cheapest t_heap in current route tree to be expanded on
307311
t_heap* cheapest = heap_.get_heap_head();
308-
update_router_stats(g_vpr_ctx.device(),
309-
rr_graph_,
310-
router_stats_,
312+
update_router_stats(router_stats_,
313+
false,
311314
cheapest->index,
312-
false);
315+
rr_graph_);
313316

314317
RRNodeId inode = cheapest->index;
315318
VTR_LOGV_DEBUG(router_debug_, " Popping node %d (cost: %g)\n",
@@ -614,11 +617,10 @@ void ConnectionRouter<Heap>::timing_driven_add_to_heap(const t_conn_cost_params
614617
}
615618

616619
heap_.add_to_heap(next_ptr);
617-
update_router_stats(device_ctx,
618-
rr_graph_,
619-
router_stats_,
620+
update_router_stats(router_stats_,
621+
true,
620622
to_node,
621-
true);
623+
rr_graph_);
622624

623625
} else {
624626
VTR_LOGV_DEBUG(router_debug_, " Didn't expand to %d (%s)\n", to_node, describe_rr_node(device_ctx.rr_graph, device_ctx.grid, device_ctx.rr_indexed_data, to_node, is_flat_).c_str());
@@ -852,18 +854,11 @@ template<typename Heap>
852854
void ConnectionRouter<Heap>::add_route_tree_to_heap(
853855
const RouteTreeNode& rt_node,
854856
RRNodeId target_node,
855-
const t_conn_cost_params cost_params,
856-
bool from_high_fanout) {
857+
const t_conn_cost_params cost_params) {
857858
/* Puts the entire partial routing below and including rt_node onto the heap *
858859
* (except for those parts marked as not to be expanded) by calling itself *
859860
* recursively. */
860861

861-
if (from_high_fanout) {
862-
router_stats_->add_all_rt_from_high_fanout++;
863-
} else {
864-
router_stats_->add_all_rt++;
865-
}
866-
867862
/* Pre-order depth-first traversal */
868863
// IPINs and SINKS are not re_expanded
869864
if (rt_node.re_expand) {
@@ -872,8 +867,7 @@ void ConnectionRouter<Heap>::add_route_tree_to_heap(
872867
}
873868
add_route_tree_node_to_heap(rt_node,
874869
target_node,
875-
cost_params,
876-
false);
870+
cost_params);
877871
}
878872

879873
for (const RouteTreeNode& child_node : rt_node.child_nodes()) {
@@ -883,14 +877,12 @@ void ConnectionRouter<Heap>::add_route_tree_to_heap(
883877
target_node)) {
884878
add_route_tree_to_heap(child_node,
885879
target_node,
886-
cost_params,
887-
from_high_fanout);
880+
cost_params);
888881
}
889882
} else {
890883
add_route_tree_to_heap(child_node,
891884
target_node,
892-
cost_params,
893-
from_high_fanout);
885+
cost_params);
894886
}
895887
}
896888
}
@@ -903,8 +895,7 @@ template<typename Heap>
903895
void ConnectionRouter<Heap>::add_route_tree_node_to_heap(
904896
const RouteTreeNode& rt_node,
905897
RRNodeId target_node,
906-
const t_conn_cost_params cost_params,
907-
bool is_high_fanout) {
898+
const t_conn_cost_params cost_params) {
908899
const auto& device_ctx = g_vpr_ctx.device();
909900
const RRNodeId inode = rt_node.inode;
910901
float backward_path_cost = cost_params.criticality * rt_node.Tdel;
@@ -939,18 +930,14 @@ void ConnectionRouter<Heap>::add_route_tree_node_to_heap(
939930
backward_path_cost, R_upstream, rt_node.Tdel, &rcv_path_manager);
940931
}
941932

942-
update_router_stats(device_ctx,
943-
rr_graph_,
944-
router_stats_,
933+
update_router_stats(router_stats_,
934+
true,
945935
inode,
946-
true);
936+
rr_graph_);
947937

938+
#ifdef VTR_ENABLE_DEBUG_LOGGING
948939
router_stats_->rt_node_pushes[rr_graph_->node_type(inode)]++;
949-
if (is_high_fanout) {
950-
router_stats_->rt_node_high_fanout_pushes[rr_graph_->node_type(inode)]++;
951-
} else {
952-
router_stats_->rt_node_entire_tree_pushes[rr_graph_->node_type(inode)]++;
953-
}
940+
#endif
954941
}
955942

956943
/* Expand bb by inode's extents and clip against net_bb */
@@ -1034,7 +1021,7 @@ t_bb ConnectionRouter<Heap>::add_high_fanout_route_tree_to_heap(
10341021
continue;
10351022
}
10361023
// Put the node onto the heap
1037-
add_route_tree_node_to_heap(rt_node, target_node, cost_params, true);
1024+
add_route_tree_node_to_heap(rt_node, target_node, cost_params);
10381025

10391026
// Expand HF BB to include the node (clip by original BB)
10401027
expand_highfanout_bounding_box(highfanout_bb, net_bounding_box, rr_node_to_add, rr_graph_);
@@ -1065,7 +1052,7 @@ t_bb ConnectionRouter<Heap>::add_high_fanout_route_tree_to_heap(
10651052
}
10661053

10671054
if (nodes_added == 0) { //If the target bin, and it's surrounding bins were empty, just add the full route tree
1068-
add_route_tree_to_heap(rt_root, target_node, cost_params, true);
1055+
add_route_tree_to_heap(rt_root, target_node, cost_params);
10691056
return net_bounding_box;
10701057
} else {
10711058
//We found nearby routing, replace original bounding box to be localized around that routing
@@ -1113,17 +1100,25 @@ static inline bool relevant_node_to_target(const RRGraphView* rr_graph,
11131100
return false;
11141101
}
11151102

1116-
static inline void update_router_stats(const DeviceContext& device_ctx,
1117-
const RRGraphView* rr_graph,
1118-
RouterStats* router_stats,
1103+
#ifdef VTR_ENABLE_DEBUG_LOGGING
1104+
static inline void update_router_stats(RouterStats* router_stats,
1105+
bool is_push,
11191106
RRNodeId rr_node_id,
1120-
bool is_push) {
1107+
const RRGraphView* rr_graph) {
1108+
#else
1109+
static inline void update_router_stats(RouterStats* router_stats,
1110+
bool is_push,
1111+
RRNodeId /*rr_node_id*/,
1112+
const RRGraphView* /*rr_graph*/) {
1113+
#endif
11211114
if (is_push) {
11221115
router_stats->heap_pushes++;
11231116
} else {
11241117
router_stats->heap_pops++;
11251118
}
11261119

1120+
#ifdef VTR_ENABLE_DEBUG_LOGGING
1121+
const auto& device_ctx = g_vpr_ctx.device();
11271122
auto node_type = rr_graph->node_type(rr_node_id);
11281123
VTR_ASSERT(node_type != NUM_RR_TYPES);
11291124
t_physical_tile_type_ptr physical_type = device_ctx.grid.get_physical_type({rr_graph->node_xlow(rr_node_id),
@@ -1150,6 +1145,7 @@ static inline void update_router_stats(const DeviceContext& device_ctx,
11501145
router_stats->intra_cluster_node_type_cnt_pops[node_type]++;
11511146
}
11521147
}
1148+
#endif
11531149
}
11541150

11551151
std::unique_ptr<ConnectionRouterInterface> make_connection_router(e_heap_type heap_type,

vpr/src/route/connection_router.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,7 @@ class ConnectionRouter : public ConnectionRouterInterface {
239239
//used as branch-points for further routing.
240240
void add_route_tree_to_heap(const RouteTreeNode& rt_node,
241241
RRNodeId target_node,
242-
const t_conn_cost_params cost_params,
243-
bool from_high_fanout);
242+
const t_conn_cost_params cost_params);
244243

245244
// Evaluate node costs using the RCV algorith
246245
float compute_node_cost_using_rcv(const t_conn_cost_params cost_params,
@@ -257,8 +256,7 @@ class ConnectionRouter : public ConnectionRouterInterface {
257256
void add_route_tree_node_to_heap(
258257
const RouteTreeNode& rt_node,
259258
RRNodeId target_node,
260-
const t_conn_cost_params cost_params,
261-
bool is_high_fanout);
259+
const t_conn_cost_params cost_params);
262260

263261
t_bb add_high_fanout_route_tree_to_heap(
264262
const RouteTreeNode& rt_root,

vpr/src/route/route.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,11 @@ bool route(const Netlist<>& net_list,
601601
VTR_ASSERT(router_stats.heap_pushes >= router_stats.intra_cluster_node_pushes);
602602
VTR_ASSERT(router_stats.heap_pops >= router_stats.intra_cluster_node_pops);
603603
VTR_LOG(
604-
"Router Stats: total_nets_routed: %zu total_connections_routed: %zu total_heap_pushes: %zu total_heap_pops: %zu "
604+
"Router Stats: total_nets_routed: %zu total_connections_routed: %zu total_heap_pushes: %zu total_heap_pops: %zu ",
605+
router_stats.nets_routed, router_stats.connections_routed, router_stats.heap_pushes, router_stats.heap_pops);
606+
#ifdef VTR_ENABLE_DEBUG_LOGGING
607+
VTR_LOG(
605608
"total_internal_heap_pushes: %zu total_internal_heap_pops: %zu total_external_heap_pushes: %zu total_external_heap_pops: %zu ",
606-
router_stats.nets_routed, router_stats.connections_routed, router_stats.heap_pushes, router_stats.heap_pops,
607609
router_stats.intra_cluster_node_pushes, router_stats.intra_cluster_node_pops,
608610
router_stats.inter_cluster_node_pushes, router_stats.inter_cluster_node_pops);
609611
for (int node_type_idx = 0; node_type_idx < t_rr_type::NUM_RR_TYPES; node_type_idx++) {
@@ -612,13 +614,8 @@ bool route(const Netlist<>& net_list,
612614
VTR_LOG("total_internal_%s_pushes: %zu ", rr_node_typename[node_type_idx], router_stats.intra_cluster_node_type_cnt_pushes[node_type_idx]);
613615
VTR_LOG("total_internal_%s_pops: %zu ", rr_node_typename[node_type_idx], router_stats.intra_cluster_node_type_cnt_pops[node_type_idx]);
614616
VTR_LOG("rt_node_%s_pushes: %zu ", rr_node_typename[node_type_idx], router_stats.rt_node_pushes[node_type_idx]);
615-
VTR_LOG("rt_node_%s_high_fanout_pushes: %zu ", rr_node_typename[node_type_idx], router_stats.rt_node_high_fanout_pushes[node_type_idx]);
616-
VTR_LOG("rt_node_%s_entire_tree_pushes: %zu ", rr_node_typename[node_type_idx], router_stats.rt_node_entire_tree_pushes[node_type_idx]);
617617
}
618-
619-
VTR_LOG("total_number_of_adding_all_rt: %zu ", router_stats.add_all_rt);
620-
VTR_LOG("total_number_of_adding_high_fanout_rt: %zu ", router_stats.add_high_fanout_rt);
621-
VTR_LOG("total_number_of_adding_all_rt_from_calling_high_fanout_rt: %zu ", router_stats.add_all_rt_from_high_fanout);
618+
#endif
622619
VTR_LOG("\n");
623620

624621
return success;

vpr/src/route/router_stats.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ struct RouterStats {
4545

4646
// For debugging purposes
4747
size_t rt_node_pushes[t_rr_type::NUM_RR_TYPES] = {0};
48-
size_t rt_node_high_fanout_pushes[t_rr_type::NUM_RR_TYPES] = {0};
49-
size_t rt_node_entire_tree_pushes[t_rr_type::NUM_RR_TYPES] = {0};
50-
51-
size_t add_all_rt_from_high_fanout = 0;
52-
size_t add_high_fanout_rt = 0;
53-
size_t add_all_rt = 0;
5448

5549
/** Add rhs's stats to mine */
5650
void combine(RouterStats& rhs) {
@@ -68,12 +62,7 @@ struct RouterStats {
6862
intra_cluster_node_type_cnt_pushes[node_type_idx] += rhs.intra_cluster_node_type_cnt_pushes[node_type_idx];
6963
intra_cluster_node_type_cnt_pops[node_type_idx] += rhs.intra_cluster_node_type_cnt_pops[node_type_idx];
7064
rt_node_pushes[node_type_idx] += rhs.rt_node_pushes[node_type_idx];
71-
rt_node_high_fanout_pushes[node_type_idx] += rhs.rt_node_high_fanout_pushes[node_type_idx];
72-
rt_node_entire_tree_pushes[node_type_idx] += rhs.rt_node_entire_tree_pushes[node_type_idx];
7365
}
74-
add_all_rt += rhs.add_all_rt;
75-
add_all_rt_from_high_fanout += rhs.add_all_rt_from_high_fanout;
76-
add_high_fanout_rt += rhs.add_high_fanout_rt;
7766
}
7867
};
7968

vtr_flow/parse/parse_config/common/vpr.route_fixed_chan_width.txt

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -8,59 +8,6 @@ total_nets_routed;vpr.out;Router Stats: total_nets_routed: (\d+) .*
88
total_connections_routed;vpr.out;Router Stats: .*total_connections_routed: (\d+) .*
99
total_heap_pushes;vpr.out;Router Stats: .*total_heap_pushes: (\d+) .*
1010
total_heap_pops;vpr.out;Router Stats: .*total_heap_pops: (\d+)
11-
total_internal_heap_pushes;vpr.out;Router Stats: .*total_internal_heap_pushes: (\d+) .*
12-
total_internal_heap_pops;vpr.out;Router Stats: .*total_internal_heap_pops: (\d+) .*
13-
total_external_heap_pushes;vpr.out;Router Stats: .*total_external_heap_pushes: (\d+) .*
14-
total_external_heap_pops;vpr.out;Router Stats: .*total_external_heap_pops: (\d+) .*
15-
total_external_SOURCE_pushes;vpr.out;Router Stats: .*total_external_SOURCE_pushes: (\d+) .*
16-
total_external_SOURCE_pops;vpr.out;Router Stats: .*total_external_SOURCE_pops: (\d+) .*
17-
total_internal_SOURCE_pushes;vpr.out;Router Stats: .*total_internal_SOURCE_pushes: (\d+) .*
18-
total_internal_SOURCE_pops;vpr.out;Router Stats: .*total_internal_SOURCE_pops: (\d+) .*
19-
total_external_SINK_pushes;vpr.out;Router Stats: .*total_external_SINK_pushes: (\d+) .*
20-
total_external_SINK_pops;vpr.out;Router Stats: .*total_external_SINK_pops: (\d+) .*
21-
total_internal_SINK_pushes;vpr.out;Router Stats: .*total_internal_SINK_pushes: (\d+) .*
22-
total_internal_SINK_pops;vpr.out;Router Stats: .*total_internal_SINK_pops: (\d+) .*
23-
total_external_IPIN_pushes;vpr.out;Router Stats: .*total_external_IPIN_pushes: (\d+) .*
24-
total_external_IPIN_pops;vpr.out;Router Stats: .*total_external_IPIN_pops: (\d+) .*
25-
total_internal_IPIN_pushes;vpr.out;Router Stats: .*total_internal_IPIN_pushes: (\d+) .*
26-
total_internal_IPIN_pops;vpr.out;Router Stats: .*total_internal_IPIN_pops: (\d+) .*
27-
total_external_OPIN_pushes;vpr.out;Router Stats: .*total_external_OPIN_pushes: (\d+) .*
28-
total_external_OPIN_pops;vpr.out;Router Stats: .*total_external_OPIN_pops: (\d+) .*
29-
total_internal_OPIN_pushes;vpr.out;Router Stats: .*total_internal_OPIN_pushes: (\d+) .*
30-
total_internal_OPIN_pops;vpr.out;Router Stats: .*total_internal_OPIN_pops: (\d+) .*
31-
total_external_CHANX_pushes;vpr.out;Router Stats: .*total_external_CHANX_pushes: (\d+) .*
32-
total_external_CHANX_pops;vpr.out;Router Stats: .*total_external_CHANX_pops: (\d+) .*
33-
total_internal_CHANX_pushes;vpr.out;Router Stats: .*total_internal_CHANX_pushes: (\d+) .*
34-
total_internal_CHANX_pops;vpr.out;Router Stats: .*total_internal_CHANX_pops: (\d+) .*
35-
total_external_CHANY_pushes;vpr.out;Router Stats: .*total_external_CHANY_pushes: (\d+) .*
36-
total_external_CHANY_pops;vpr.out;Router Stats: .*total_external_CHANY_pops: (\d+) .*
37-
total_internal_CHANY_pushes;vpr.out;Router Stats: .*total_internal_CHANY_pushes: (\d+) .*
38-
total_internal_CHANY_pops;vpr.out;Router Stats: .*total_internal_CHANY_pops: (\d+) .*
39-
40-
rt_node_SOURCE_pushes;vpr.out;Router Stats: .*rt_node_SOURCE_pushes: (\d+) .*
41-
rt_node_SINK_pushes;vpr.out;Router Stats: .*rt_node_SINK_pushes: (\d+) .*
42-
rt_node_IPIN_pushes;vpr.out;Router Stats: .*rt_node_IPIN_pushes: (\d+) .*
43-
rt_node_OPIN_pushes;vpr.out;Router Stats: .*rt_node_OPIN_pushes: (\d+) .*
44-
rt_node_CHANX_pushes;vpr.out;Router Stats: .*rt_node_CHANX_pushes: (\d+) .*
45-
rt_node_CHANY_pushes;vpr.out;Router Stats: .*rt_node_CHANY_pushes: (\d+) .*
46-
47-
rt_node_SOURCE_high_fanout_pushes;vpr.out;Router Stats: .*rt_node_SOURCE_high_fanout_pushes: (\d+) .*
48-
rt_node_SINK_high_fanout_pushes;vpr.out;Router Stats: .*rt_node_SINK_high_fanout_pushes: (\d+) .*
49-
rt_node_IPIN_high_fanout_pushes;vpr.out;Router Stats: .*rt_node_IPIN_high_fanout_pushes: (\d+) .*
50-
rt_node_OPIN_high_fanout_pushes;vpr.out;Router Stats: .*rt_node_OPIN_high_fanout_pushes: (\d+) .*
51-
rt_node_CHANX_high_fanout_pushes;vpr.out;Router Stats: .*rt_node_CHANX_high_fanout_pushes: (\d+) .*
52-
rt_node_CHANY_high_fanout_pushes;vpr.out;Router Stats: .*rt_node_CHANY_high_fanout_pushes: (\d+) .*
53-
54-
rt_node_SOURCE_entire_tree_pushes;vpr.out;Router Stats: .*rt_node_SOURCE_entire_tree_pushes: (\d+) .*
55-
rt_node_SINK_entire_tree_pushes;vpr.out;Router Stats: .*rt_node_SINK_entire_tree_pushes: (\d+) .*
56-
rt_node_IPIN_entire_tree_pushes;vpr.out;Router Stats: .*rt_node_IPIN_entire_tree_pushes: (\d+) .*
57-
rt_node_OPIN_entire_tree_pushes;vpr.out;Router Stats: .*rt_node_OPIN_entire_tree_pushes: (\d+) .*
58-
rt_node_CHANX_entire_tree_pushes;vpr.out;Router Stats: .*rt_node_CHANX_entire_tree_pushes: (\d+) .*
59-
rt_node_CHANY_entire_tree_pushes;vpr.out;Router Stats: .*rt_node_CHANY_entire_tree_pushes: (\d+) .*
60-
61-
adding_all_rt;vpr.out;Router Stats: .*total_number_of_adding_all_rt: (\d+) .*
62-
adding_high_fanout_rt;vpr.out;Router Stats: .*total_number_of_adding_high_fanout_rt: (\d+) .*
63-
total_number_of_adding_all_rt_from_calling_high_fanout_rt;vpr.out;Router Stats: .*total_number_of_adding_all_rt_from_calling_high_fanout_rt: (\d+) .*
6411

6512
#Area Metrics
6613
logic_block_area_total;vpr.out;\s*Total logic block area .*: (.*)

0 commit comments

Comments
 (0)