Skip to content

Commit edc0d17

Browse files
litghostkmurray
authored andcommitted
Update comments on pruning functions.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
1 parent 2f3c530 commit edc0d17

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

vpr/src/route/route_tree_timing.cpp

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,9 +1028,41 @@ static t_rt_node* prune_route_tree_recurr(t_rt_node* node, CBRR& connections_inf
10281028
// 3. The node set is not active
10291029
//
10301030
// Then prune this node.
1031+
//
10311032
if (non_config_node_set_usage != nullptr && node_set != -1 && device_ctx.rr_switch_inf[node->parent_switch].configurable() && (*non_config_node_set_usage)[node_set] == 0) {
10321033
// This node should be pruned, re-prune edges once more.
1033-
return prune_route_tree_recurr(node, connections_inf, /*force_prune=*/false, non_config_node_set_usage);
1034+
//
1035+
// If the following is true:
1036+
//
1037+
// - The node set is unused
1038+
// (e.g. (*non_config_node_set_usage)[node_set] == 0)
1039+
// - This particular node still had children
1040+
// (which is true by virtue of being in this else statement)
1041+
//
1042+
// Then that indicates that the node set became unused during the
1043+
// pruning. One or more of the children of this node will be
1044+
// pruned if prune_route_tree_recurr is called again, and
1045+
// eventually the whole node will be prunable.
1046+
//
1047+
// Consider the following graph:
1048+
//
1049+
// 1 -> 2
1050+
// 2 -> 3 [non-configurable]
1051+
// 2 -> 4 [non-configurable]
1052+
// 3 -> 5
1053+
// 4 -> 6
1054+
//
1055+
// Assume that nodes 5 and 6 do not connect to a sink, so they
1056+
// will be pruned (as normal). When prune_route_tree_recurr
1057+
// visits 2 for the first time, node 3 or 4 will remain. This is
1058+
// because when prune_route_tree_recurr visits 3 or 4, it will
1059+
// not have visited 4 or 3 (respectively). As a result, either
1060+
// node 3 or 4 will not be pruned on the first pass, because the
1061+
// node set usage count will be > 0. However after
1062+
// prune_route_tree_recurr visits 2, 3 and 4, the node set usage
1063+
// will be 0, so everything can be pruned.
1064+
return prune_route_tree_recurr(node, connections_inf,
1065+
/*force_prune=*/false, non_config_node_set_usage);
10341066
}
10351067

10361068
//An unpruned intermediate node

vpr/src/route/route_tree_timing.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,17 @@ t_rt_node* traceback_to_route_tree(t_trace* head);
5151
t_rt_node* traceback_to_route_tree(t_trace* head, std::vector<int>* non_config_node_set_usage);
5252
t_trace* traceback_from_route_tree(ClusterNetId inet, const t_rt_node* root, int num_remaining_sinks);
5353

54+
// Prune route tree
55+
//
56+
// Note that non-configurable node will not be pruned unless the node is
57+
// being totally ripped up, or the node is congested.
5458
t_rt_node* prune_route_tree(t_rt_node* rt_root, CBRR& connections_inf);
59+
60+
// Prune route tree
61+
//
62+
// Note that non-configurable nodes will be pruned if
63+
// non_config_node_set_usage is provided. prune_route_tree will update
64+
// non_config_node_set_usage after pruning.
5565
t_rt_node* prune_route_tree(t_rt_node* rt_root, CBRR& connections_inf, std::vector<int>* non_config_node_set_usage);
5666

5767
void pathfinder_update_cost_from_route_tree(const t_rt_node* rt_root, int add_or_sub, float pres_fac);

0 commit comments

Comments
 (0)