Skip to content

Commit 68877d9

Browse files
committed
vpr: Fix congestion costs for non-configurably connected nodes
Previously the router would add the congestion cost of an entire non-configurably connected node set *each* time a node from that set was expanded. This could substantially over-cost nodes such nodes if the router's partial path traversed through multiple nodes in the set. We now only add the congestion cost (for the entire set) once (when the router first expands into the set). Any other nodes which are in the set (i.e. reached by non-configurable edges) have no additional congestion cost added.
1 parent fc2651c commit 68877d9

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

vpr/src/route/route_timing.cpp

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ static void generate_route_timing_reports(const t_router_opts& router_opts,
299299

300300
static void prune_unused_non_configurable_nets(CBRR& connections_inf);
301301

302+
static bool same_non_config_node_set(int from_node, int to_node);
303+
302304
/************************ Subroutine definitions *****************************/
303305
bool try_timing_driven_route(const t_router_opts& router_opts,
304306
const t_analysis_opts& analysis_opts,
@@ -2023,9 +2025,27 @@ static void evaluate_timing_driven_node_costs(t_heap* to,
20232025
//Second, we adjust the Tdel to account for the delay caused by the internal capacitance.
20242026
Tdel += Rdel_adjust * switch_Cinternal;
20252027

2028+
bool reached_configurably = device_ctx.rr_nodes[from_node].edge_is_configurable(iconn);
2029+
2030+
float cong_cost = 0.;
2031+
if (reached_configurably) {
2032+
cong_cost = get_rr_cong_cost(to_node);
2033+
} else {
2034+
//Reached by a non-configurable edge.
2035+
//Therefore the from_node and to_node are part of the same non-configurable node set.
2036+
VTR_ASSERT_SAFE_MSG(same_non_config_node_set(from_node, to_node),
2037+
"Non-configurably connected edges should be part of the same node set");
2038+
2039+
//The congestion cost of all nodes in the set has already been accounted for (when
2040+
//the current path first expanded a node in the set). Therefore do *not* re-add the congestion
2041+
//cost.
2042+
cong_cost = 0.;
2043+
}
2044+
20262045
//Update the backward cost (upstream already included)
2027-
to->backward_path_cost += (1. - cost_params.criticality) * get_rr_cong_cost(to_node); //Congestion cost
2028-
to->backward_path_cost += cost_params.criticality * Tdel; //Delay cost
2046+
to->backward_path_cost += (1. - cost_params.criticality) * cong_cost; //Congestion cost
2047+
to->backward_path_cost += cost_params.criticality * Tdel; //Delay cost
2048+
20292049
if (cost_params.bend_cost != 0.) {
20302050
t_rr_type from_type = device_ctx.rr_nodes[from_node].type();
20312051
t_rr_type to_type = device_ctx.rr_nodes[to_node].type();
@@ -2865,3 +2885,18 @@ static void prune_unused_non_configurable_nets(CBRR& connections_inf) {
28652885
free_route_tree(rt_root);
28662886
}
28672887
}
2888+
2889+
//Returns true if both nodes are part of the same non-configurable edge set
2890+
static bool same_non_config_node_set(int from_node, int to_node) {
2891+
auto& device_ctx = g_vpr_ctx.device();
2892+
2893+
auto from_itr = device_ctx.rr_node_to_non_config_node_set.find(from_node);
2894+
auto to_itr = device_ctx.rr_node_to_non_config_node_set.find(to_node);
2895+
2896+
if (from_itr == device_ctx.rr_node_to_non_config_node_set.end()
2897+
|| to_itr == device_ctx.rr_node_to_non_config_node_set.end()) {
2898+
return false; //Not part of a non-config node set
2899+
}
2900+
2901+
return from_itr->second == to_itr->second; //Check for same non-config set IDs
2902+
}

0 commit comments

Comments
 (0)