Skip to content

Commit c4fea44

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 bbffacf commit c4fea44

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
@@ -300,6 +300,8 @@ static void generate_route_timing_reports(const t_router_opts& router_opts,
300300

301301
static void prune_unused_non_configurable_nets(CBRR& connections_inf);
302302

303+
static bool same_non_config_node_set(int from_node, int to_node);
304+
303305
/************************ Subroutine definitions *****************************/
304306
bool try_timing_driven_route(const t_router_opts& router_opts,
305307
const t_analysis_opts& analysis_opts,
@@ -1958,9 +1960,27 @@ static void evaluate_timing_driven_node_costs(t_heap* to,
19581960
float Rdel = to->R_upstream - 0.5 * node_R; //Only consider half node's resistance for delay
19591961
float Tdel = switch_Tdel + Rdel * node_C;
19601962

1963+
bool reached_configurably = device_ctx.rr_nodes[from_node].edge_is_configurable(iconn);
1964+
1965+
float cong_cost = 0.;
1966+
if (reached_configurably) {
1967+
cong_cost = get_rr_cong_cost(to_node);
1968+
} else {
1969+
//Reached by a non-configurable edge.
1970+
//Therefore the from_node and to_node are part of the same non-configurable node set.
1971+
VTR_ASSERT_SAFE_MSG(same_non_config_node_set(from_node, to_node),
1972+
"Non-configurably connected edges should be part of the same node set");
1973+
1974+
//The congestion cost of all nodes in the set has already been accounted for (when
1975+
//the current path first expanded a node in the set). Therefore do *not* re-add the congestion
1976+
//cost.
1977+
cong_cost = 0.;
1978+
}
1979+
19611980
//Update the backward cost (upstream already included)
1962-
to->backward_path_cost += (1. - cost_params.criticality) * get_rr_cong_cost(to_node); //Congestion cost
1963-
to->backward_path_cost += cost_params.criticality * Tdel; //Delay cost
1981+
to->backward_path_cost += (1. - cost_params.criticality) * cong_cost; //Congestion cost
1982+
to->backward_path_cost += cost_params.criticality * Tdel; //Delay cost
1983+
19641984
if (cost_params.bend_cost != 0.) {
19651985
t_rr_type from_type = device_ctx.rr_nodes[from_node].type();
19661986
t_rr_type to_type = device_ctx.rr_nodes[to_node].type();
@@ -2764,3 +2784,18 @@ static void prune_unused_non_configurable_nets(CBRR& connections_inf) {
27642784
free_route_tree(rt_root);
27652785
}
27662786
}
2787+
2788+
//Returns true if both nodes are part of the same non-configurable edge set
2789+
static bool same_non_config_node_set(int from_node, int to_node) {
2790+
auto& device_ctx = g_vpr_ctx.device();
2791+
2792+
auto from_itr = device_ctx.rr_node_to_non_config_node_set.find(from_node);
2793+
auto to_itr = device_ctx.rr_node_to_non_config_node_set.find(to_node);
2794+
2795+
if (from_itr == device_ctx.rr_node_to_non_config_node_set.end()
2796+
|| to_itr == device_ctx.rr_node_to_non_config_node_set.end()) {
2797+
return false; //Not part of a non-config node set
2798+
}
2799+
2800+
return from_itr->second == to_itr->second; //Check for same non-config set IDs
2801+
}

0 commit comments

Comments
 (0)