Skip to content
Open
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
33 changes: 31 additions & 2 deletions vpr/src/route/route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "place_and_route.h"
#include "read_route.h"
#include "route.h"
#include <cstddef>
#include "route_common.h"
#include "route_debug.h"
#include "route_profiling.h"
Expand Down Expand Up @@ -251,6 +252,8 @@ bool route(const Netlist<>& net_list,

int rcv_finished_count = RCV_FINISH_EARLY_COUNTDOWN;

std::vector<size_t> per_iter_heap_ops_count;

print_route_status_header();
#ifndef NO_GRAPHICS
// Reset router iteration in the current route attempt.
Expand Down Expand Up @@ -286,6 +289,7 @@ bool route(const Netlist<>& net_list,

/* Route each net */
RouteIterResults iter_results = netlist_router->route_netlist(itry, pres_fac, worst_negative_slack);
per_iter_heap_ops_count.push_back(iter_results.stats.heap_pushes + iter_results.stats.heap_pops);

if (!iter_results.is_routable) { /* Disconnected RRG */
return false;
Expand Down Expand Up @@ -578,6 +582,31 @@ bool route(const Netlist<>& net_list,
// profiling::time_on_criticality_analysis();
}

// Calculates the number of iterations with high heap ops.
// This is defined as an iteration that has more heap operations than the maximum of the previous three iterations.
int num_high_heap_ops_iters = 0;
if (per_iter_heap_ops_count.size() > 4) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this if statement needed? Is there a problem when the size is equal to 4? The below for loop will not execute if the size is 3 or less anyways due to the upper-bound condition.

for (int i = 3; i < static_cast<int>(per_iter_heap_ops_count.size()); i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment for readability: Instead of casting the size into an int, why not make "i" and "j" both size_t type?

size_t max_heap_ops = 0;
for (int j = i - 3; j < i; j++) {
max_heap_ops = std::max(max_heap_ops, per_iter_heap_ops_count[j]);
}
if (per_iter_heap_ops_count[i] >= max_heap_ops) {
num_high_heap_ops_iters++;
}
}
}

// Calculates the routing struggle ratio.
// This ratio is defined as the number of iterations with high heap ops
// (i.e., iterations having more heap operations than the maximum of the previous three iterations
// divided by the total number of iterations.
// For more details, see TODO: routing struggle paper is not published yet.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has the paper not been published yet?

float routing_struggle_ratio = 0.0;
if (per_iter_heap_ops_count.size() > 4) {
routing_struggle_ratio = static_cast<float>(num_high_heap_ops_iters) / static_cast<float>(per_iter_heap_ops_count.size() - 3);
}

/* Write out partition tree logs (no-op if debug option not set) */
PartitionTreeDebug::write("partition_tree.log");

Expand Down Expand Up @@ -624,8 +653,8 @@ 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.nets_routed, router_stats.connections_routed, router_stats.heap_pushes, router_stats.heap_pops);
"Router Stats: total_nets_routed: %zu total_connections_routed: %zu total_heap_pushes: %zu total_heap_pops: %zu routing_struggle_ratio: %.2f ",
router_stats.nets_routed, router_stats.connections_routed, router_stats.heap_pushes, router_stats.heap_pops, routing_struggle_ratio);
if constexpr (VTR_ENABLE_DEBUG_LOGGING_CONST_EXPR) {
VTR_LOG(
"total_internal_heap_pushes: %zu total_internal_heap_pops: %zu total_external_heap_pushes: %zu total_external_heap_pops: %zu ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ avg_routed_wiresegment;vpr.out;\s.*average wire segments per net: (.*)
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_heap_pops;vpr.out;Router Stats: .*total_heap_pops: (\d+) .*
routing_struggle;vpr.out;Router Stats: .*routing_struggle_ratio: (.*)

#Area Metrics
logic_block_area_total;vpr.out;\s*Total logic block area .*: (.*)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ crit_path_total_nets_routed;vpr.crit_path.out;.* total_nets_routed: (\d+)
crit_path_total_connections_routed;vpr.crit_path.out;.* total_connections_routed: (\d+)
crit_path_total_heap_pushes;vpr.crit_path.out;.* total_heap_pushes: (\d+)
crit_path_total_heap_pops;vpr.crit_path.out;.* total_heap_pops: (\d+)
crit_path_routing_struggle;vpr.crit_path.out;.* routing_struggle_ratio: (.*)

#VPR Analysis (final implementation) Metrics
critical_path_delay;vpr.crit_path.out;Final critical path delay \(least slack\): (.*) ns
Expand Down