-
Notifications
You must be signed in to change notification settings - Fork 430
Adding routing struggle metric #3339
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
base: master
Are you sure you want to change the base?
Changes from all commits
d3e4d3c
aba6197
a3d9784
f9673e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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" | ||
|
|
@@ -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. | ||
|
|
@@ -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; | ||
|
|
@@ -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) { | ||
| for (int i = 3; i < static_cast<int>(per_iter_heap_ops_count.size()); i++) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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"); | ||
|
|
||
|
|
@@ -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 ", | ||
|
|
||
There was a problem hiding this comment.
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.