Skip to content

Routing Stats #2456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 46 additions & 50 deletions vpr/src/route/connection_router.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@ static bool relevant_node_to_target(const RRGraphView* rr_graph,
RRNodeId node_to_add,
RRNodeId target_node);

static void update_router_stats(const DeviceContext& device_ctx,
const RRGraphView* rr_graph,
RouterStats* router_stats,
#ifdef VTR_ENABLE_DEBUG_LOGGING
static void update_router_stats(RouterStats* router_stats,
bool is_push,
RRNodeId rr_node_id,
bool is_push);
const RRGraphView* rr_graph);
#else
static void update_router_stats(RouterStats* router_stats,
bool is_push,
RRNodeId /*rr_node_id*/,
const RRGraphView* /*rr_graph*/);
#endif

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

add_route_tree_to_heap(rt_root, sink_node, cost_params, false);
add_route_tree_to_heap(rt_root, sink_node, cost_params);
heap_.build_heap(); // via sifting down everything

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

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

Expand Down Expand Up @@ -215,11 +220,10 @@ t_heap* ConnectionRouter<Heap>::timing_driven_route_connection_from_heap(RRNodeI
while (!heap_.is_empty_heap()) {
// cheapest t_heap in current route tree to be expanded on
cheapest = heap_.get_heap_head();
update_router_stats(device_ctx,
rr_graph_,
router_stats_,
update_router_stats(router_stats_,
false,
cheapest->index,
false);
rr_graph_);

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

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

auto res = timing_driven_find_all_shortest_paths_from_heap(cost_params, bounding_box);
Expand Down Expand Up @@ -305,11 +309,10 @@ vtr::vector<RRNodeId, t_heap> ConnectionRouter<Heap>::timing_driven_find_all_sho
while (!heap_.is_empty_heap()) {
// cheapest t_heap in current route tree to be expanded on
t_heap* cheapest = heap_.get_heap_head();
update_router_stats(g_vpr_ctx.device(),
rr_graph_,
router_stats_,
update_router_stats(router_stats_,
false,
cheapest->index,
false);
rr_graph_);

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

heap_.add_to_heap(next_ptr);
update_router_stats(device_ctx,
rr_graph_,
router_stats_,
update_router_stats(router_stats_,
true,
to_node,
true);
rr_graph_);

} else {
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());
Expand Down Expand Up @@ -852,18 +854,11 @@ template<typename Heap>
void ConnectionRouter<Heap>::add_route_tree_to_heap(
const RouteTreeNode& rt_node,
RRNodeId target_node,
const t_conn_cost_params cost_params,
bool from_high_fanout) {
const t_conn_cost_params cost_params) {
/* Puts the entire partial routing below and including rt_node onto the heap *
* (except for those parts marked as not to be expanded) by calling itself *
* recursively. */

if (from_high_fanout) {
router_stats_->add_all_rt_from_high_fanout++;
} else {
router_stats_->add_all_rt++;
}

/* Pre-order depth-first traversal */
// IPINs and SINKS are not re_expanded
if (rt_node.re_expand) {
Expand All @@ -872,8 +867,7 @@ void ConnectionRouter<Heap>::add_route_tree_to_heap(
}
add_route_tree_node_to_heap(rt_node,
target_node,
cost_params,
false);
cost_params);
}

for (const RouteTreeNode& child_node : rt_node.child_nodes()) {
Expand All @@ -883,14 +877,12 @@ void ConnectionRouter<Heap>::add_route_tree_to_heap(
target_node)) {
add_route_tree_to_heap(child_node,
target_node,
cost_params,
from_high_fanout);
cost_params);
}
} else {
add_route_tree_to_heap(child_node,
target_node,
cost_params,
from_high_fanout);
cost_params);
}
}
}
Expand All @@ -903,8 +895,7 @@ template<typename Heap>
void ConnectionRouter<Heap>::add_route_tree_node_to_heap(
const RouteTreeNode& rt_node,
RRNodeId target_node,
const t_conn_cost_params cost_params,
bool is_high_fanout) {
const t_conn_cost_params cost_params) {
const auto& device_ctx = g_vpr_ctx.device();
const RRNodeId inode = rt_node.inode;
float backward_path_cost = cost_params.criticality * rt_node.Tdel;
Expand Down Expand Up @@ -939,18 +930,14 @@ void ConnectionRouter<Heap>::add_route_tree_node_to_heap(
backward_path_cost, R_upstream, rt_node.Tdel, &rcv_path_manager);
}

update_router_stats(device_ctx,
rr_graph_,
router_stats_,
update_router_stats(router_stats_,
true,
inode,
true);
rr_graph_);

#ifdef VTR_ENABLE_DEBUG_LOGGING
router_stats_->rt_node_pushes[rr_graph_->node_type(inode)]++;
if (is_high_fanout) {
router_stats_->rt_node_high_fanout_pushes[rr_graph_->node_type(inode)]++;
} else {
router_stats_->rt_node_entire_tree_pushes[rr_graph_->node_type(inode)]++;
}
#endif
}

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

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

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

static inline void update_router_stats(const DeviceContext& device_ctx,
const RRGraphView* rr_graph,
RouterStats* router_stats,
#ifdef VTR_ENABLE_DEBUG_LOGGING
static inline void update_router_stats(RouterStats* router_stats,
bool is_push,
RRNodeId rr_node_id,
bool is_push) {
const RRGraphView* rr_graph) {
#else
static inline void update_router_stats(RouterStats* router_stats,
bool is_push,
RRNodeId /*rr_node_id*/,
const RRGraphView* /*rr_graph*/) {
#endif
if (is_push) {
router_stats->heap_pushes++;
} else {
router_stats->heap_pops++;
}

#ifdef VTR_ENABLE_DEBUG_LOGGING
const auto& device_ctx = g_vpr_ctx.device();
auto node_type = rr_graph->node_type(rr_node_id);
VTR_ASSERT(node_type != NUM_RR_TYPES);
t_physical_tile_type_ptr physical_type = device_ctx.grid.get_physical_type({rr_graph->node_xlow(rr_node_id),
Expand All @@ -1150,6 +1145,7 @@ static inline void update_router_stats(const DeviceContext& device_ctx,
router_stats->intra_cluster_node_type_cnt_pops[node_type]++;
}
}
#endif
}

std::unique_ptr<ConnectionRouterInterface> make_connection_router(e_heap_type heap_type,
Expand Down
6 changes: 2 additions & 4 deletions vpr/src/route/connection_router.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,7 @@ class ConnectionRouter : public ConnectionRouterInterface {
//used as branch-points for further routing.
void add_route_tree_to_heap(const RouteTreeNode& rt_node,
RRNodeId target_node,
const t_conn_cost_params cost_params,
bool from_high_fanout);
const t_conn_cost_params cost_params);

// Evaluate node costs using the RCV algorith
float compute_node_cost_using_rcv(const t_conn_cost_params cost_params,
Expand All @@ -257,8 +256,7 @@ class ConnectionRouter : public ConnectionRouterInterface {
void add_route_tree_node_to_heap(
const RouteTreeNode& rt_node,
RRNodeId target_node,
const t_conn_cost_params cost_params,
bool is_high_fanout);
const t_conn_cost_params cost_params);

t_bb add_high_fanout_route_tree_to_heap(
const RouteTreeNode& rt_root,
Expand Down
13 changes: 5 additions & 8 deletions vpr/src/route/route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,9 +601,11 @@ bool route(const Netlist<>& net_list,
VTR_ASSERT(router_stats.heap_pushes >= router_stats.intra_cluster_node_pushes);
VTR_ASSERT(router_stats.heap_pops >= router_stats.intra_cluster_node_pops);
VTR_LOG(
"Router Stats: total_nets_routed: %zu total_connections_routed: %zu total_heap_pushes: %zu total_heap_pops: %zu "
"Router Stats: total_nets_routed: %zu total_connections_routed: %zu total_heap_pushes: %zu total_heap_pops: %zu ",
router_stats.nets_routed, router_stats.connections_routed, router_stats.heap_pushes, router_stats.heap_pops);
#ifdef VTR_ENABLE_DEBUG_LOGGING
VTR_LOG(
"total_internal_heap_pushes: %zu total_internal_heap_pops: %zu total_external_heap_pushes: %zu total_external_heap_pops: %zu ",
router_stats.nets_routed, router_stats.connections_routed, router_stats.heap_pushes, router_stats.heap_pops,
router_stats.intra_cluster_node_pushes, router_stats.intra_cluster_node_pops,
router_stats.inter_cluster_node_pushes, router_stats.inter_cluster_node_pops);
for (int node_type_idx = 0; node_type_idx < t_rr_type::NUM_RR_TYPES; node_type_idx++) {
Expand All @@ -612,13 +614,8 @@ bool route(const Netlist<>& net_list,
VTR_LOG("total_internal_%s_pushes: %zu ", rr_node_typename[node_type_idx], router_stats.intra_cluster_node_type_cnt_pushes[node_type_idx]);
VTR_LOG("total_internal_%s_pops: %zu ", rr_node_typename[node_type_idx], router_stats.intra_cluster_node_type_cnt_pops[node_type_idx]);
VTR_LOG("rt_node_%s_pushes: %zu ", rr_node_typename[node_type_idx], router_stats.rt_node_pushes[node_type_idx]);
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]);
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]);
}

VTR_LOG("total_number_of_adding_all_rt: %zu ", router_stats.add_all_rt);
VTR_LOG("total_number_of_adding_high_fanout_rt: %zu ", router_stats.add_high_fanout_rt);
VTR_LOG("total_number_of_adding_all_rt_from_calling_high_fanout_rt: %zu ", router_stats.add_all_rt_from_high_fanout);
#endif
VTR_LOG("\n");

return success;
Expand Down
11 changes: 0 additions & 11 deletions vpr/src/route/router_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ struct RouterStats {

// For debugging purposes
size_t rt_node_pushes[t_rr_type::NUM_RR_TYPES] = {0};
size_t rt_node_high_fanout_pushes[t_rr_type::NUM_RR_TYPES] = {0};
size_t rt_node_entire_tree_pushes[t_rr_type::NUM_RR_TYPES] = {0};

size_t add_all_rt_from_high_fanout = 0;
size_t add_high_fanout_rt = 0;
size_t add_all_rt = 0;

/** Add rhs's stats to mine */
void combine(RouterStats& rhs) {
Expand All @@ -68,12 +62,7 @@ struct RouterStats {
intra_cluster_node_type_cnt_pushes[node_type_idx] += rhs.intra_cluster_node_type_cnt_pushes[node_type_idx];
intra_cluster_node_type_cnt_pops[node_type_idx] += rhs.intra_cluster_node_type_cnt_pops[node_type_idx];
rt_node_pushes[node_type_idx] += rhs.rt_node_pushes[node_type_idx];
rt_node_high_fanout_pushes[node_type_idx] += rhs.rt_node_high_fanout_pushes[node_type_idx];
rt_node_entire_tree_pushes[node_type_idx] += rhs.rt_node_entire_tree_pushes[node_type_idx];
}
add_all_rt += rhs.add_all_rt;
add_all_rt_from_high_fanout += rhs.add_all_rt_from_high_fanout;
add_high_fanout_rt += rhs.add_high_fanout_rt;
}
};

Expand Down
53 changes: 0 additions & 53 deletions vtr_flow/parse/parse_config/common/vpr.route_fixed_chan_width.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,59 +8,6 @@ total_nets_routed;vpr.out;Router Stats: total_nets_routed: (\d+) .*
total_connections_routed;vpr.out;Router Stats: .*total_connections_routed: (\d+) .*
total_heap_pushes;vpr.out;Router Stats: .*total_heap_pushes: (\d+) .*
total_heap_pops;vpr.out;Router Stats: .*total_heap_pops: (\d+)
total_internal_heap_pushes;vpr.out;Router Stats: .*total_internal_heap_pushes: (\d+) .*
total_internal_heap_pops;vpr.out;Router Stats: .*total_internal_heap_pops: (\d+) .*
total_external_heap_pushes;vpr.out;Router Stats: .*total_external_heap_pushes: (\d+) .*
total_external_heap_pops;vpr.out;Router Stats: .*total_external_heap_pops: (\d+) .*
total_external_SOURCE_pushes;vpr.out;Router Stats: .*total_external_SOURCE_pushes: (\d+) .*
total_external_SOURCE_pops;vpr.out;Router Stats: .*total_external_SOURCE_pops: (\d+) .*
total_internal_SOURCE_pushes;vpr.out;Router Stats: .*total_internal_SOURCE_pushes: (\d+) .*
total_internal_SOURCE_pops;vpr.out;Router Stats: .*total_internal_SOURCE_pops: (\d+) .*
total_external_SINK_pushes;vpr.out;Router Stats: .*total_external_SINK_pushes: (\d+) .*
total_external_SINK_pops;vpr.out;Router Stats: .*total_external_SINK_pops: (\d+) .*
total_internal_SINK_pushes;vpr.out;Router Stats: .*total_internal_SINK_pushes: (\d+) .*
total_internal_SINK_pops;vpr.out;Router Stats: .*total_internal_SINK_pops: (\d+) .*
total_external_IPIN_pushes;vpr.out;Router Stats: .*total_external_IPIN_pushes: (\d+) .*
total_external_IPIN_pops;vpr.out;Router Stats: .*total_external_IPIN_pops: (\d+) .*
total_internal_IPIN_pushes;vpr.out;Router Stats: .*total_internal_IPIN_pushes: (\d+) .*
total_internal_IPIN_pops;vpr.out;Router Stats: .*total_internal_IPIN_pops: (\d+) .*
total_external_OPIN_pushes;vpr.out;Router Stats: .*total_external_OPIN_pushes: (\d+) .*
total_external_OPIN_pops;vpr.out;Router Stats: .*total_external_OPIN_pops: (\d+) .*
total_internal_OPIN_pushes;vpr.out;Router Stats: .*total_internal_OPIN_pushes: (\d+) .*
total_internal_OPIN_pops;vpr.out;Router Stats: .*total_internal_OPIN_pops: (\d+) .*
total_external_CHANX_pushes;vpr.out;Router Stats: .*total_external_CHANX_pushes: (\d+) .*
total_external_CHANX_pops;vpr.out;Router Stats: .*total_external_CHANX_pops: (\d+) .*
total_internal_CHANX_pushes;vpr.out;Router Stats: .*total_internal_CHANX_pushes: (\d+) .*
total_internal_CHANX_pops;vpr.out;Router Stats: .*total_internal_CHANX_pops: (\d+) .*
total_external_CHANY_pushes;vpr.out;Router Stats: .*total_external_CHANY_pushes: (\d+) .*
total_external_CHANY_pops;vpr.out;Router Stats: .*total_external_CHANY_pops: (\d+) .*
total_internal_CHANY_pushes;vpr.out;Router Stats: .*total_internal_CHANY_pushes: (\d+) .*
total_internal_CHANY_pops;vpr.out;Router Stats: .*total_internal_CHANY_pops: (\d+) .*

rt_node_SOURCE_pushes;vpr.out;Router Stats: .*rt_node_SOURCE_pushes: (\d+) .*
rt_node_SINK_pushes;vpr.out;Router Stats: .*rt_node_SINK_pushes: (\d+) .*
rt_node_IPIN_pushes;vpr.out;Router Stats: .*rt_node_IPIN_pushes: (\d+) .*
rt_node_OPIN_pushes;vpr.out;Router Stats: .*rt_node_OPIN_pushes: (\d+) .*
rt_node_CHANX_pushes;vpr.out;Router Stats: .*rt_node_CHANX_pushes: (\d+) .*
rt_node_CHANY_pushes;vpr.out;Router Stats: .*rt_node_CHANY_pushes: (\d+) .*

rt_node_SOURCE_high_fanout_pushes;vpr.out;Router Stats: .*rt_node_SOURCE_high_fanout_pushes: (\d+) .*
rt_node_SINK_high_fanout_pushes;vpr.out;Router Stats: .*rt_node_SINK_high_fanout_pushes: (\d+) .*
rt_node_IPIN_high_fanout_pushes;vpr.out;Router Stats: .*rt_node_IPIN_high_fanout_pushes: (\d+) .*
rt_node_OPIN_high_fanout_pushes;vpr.out;Router Stats: .*rt_node_OPIN_high_fanout_pushes: (\d+) .*
rt_node_CHANX_high_fanout_pushes;vpr.out;Router Stats: .*rt_node_CHANX_high_fanout_pushes: (\d+) .*
rt_node_CHANY_high_fanout_pushes;vpr.out;Router Stats: .*rt_node_CHANY_high_fanout_pushes: (\d+) .*

rt_node_SOURCE_entire_tree_pushes;vpr.out;Router Stats: .*rt_node_SOURCE_entire_tree_pushes: (\d+) .*
rt_node_SINK_entire_tree_pushes;vpr.out;Router Stats: .*rt_node_SINK_entire_tree_pushes: (\d+) .*
rt_node_IPIN_entire_tree_pushes;vpr.out;Router Stats: .*rt_node_IPIN_entire_tree_pushes: (\d+) .*
rt_node_OPIN_entire_tree_pushes;vpr.out;Router Stats: .*rt_node_OPIN_entire_tree_pushes: (\d+) .*
rt_node_CHANX_entire_tree_pushes;vpr.out;Router Stats: .*rt_node_CHANX_entire_tree_pushes: (\d+) .*
rt_node_CHANY_entire_tree_pushes;vpr.out;Router Stats: .*rt_node_CHANY_entire_tree_pushes: (\d+) .*

adding_all_rt;vpr.out;Router Stats: .*total_number_of_adding_all_rt: (\d+) .*
adding_high_fanout_rt;vpr.out;Router Stats: .*total_number_of_adding_high_fanout_rt: (\d+) .*
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+) .*

#Area Metrics
logic_block_area_total;vpr.out;\s*Total logic block area .*: (.*)
Expand Down
Loading