From ba95e7c186faa42de7b16a4295e1d8e1d5ea1e9b Mon Sep 17 00:00:00 2001 From: Joshua Fife Date: Tue, 3 Sep 2024 22:27:47 -0600 Subject: [PATCH 1/2] fixed issue with warning being thrown for short switch types. --- .../utils/alloc_and_load_rr_indexed_data.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp b/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp index 7eb6ded1579..74e1e063c13 100644 --- a/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp +++ b/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp @@ -29,7 +29,7 @@ static float get_delay_normalization_fac(const vtr::vector& rr_indexed_data); -static void calculate_average_switch(const RRGraphView& rr_graph, int inode, double& avg_switch_R, double& avg_switch_T, double& avg_switch_Cinternal, int& num_switches, short& buffered, vtr::vector>& fan_in_list); +static void calculate_average_switch(const RRGraphView& rr_graph, int inode, double& avg_switch_R, double& avg_switch_T, double& avg_switch_Cinternal, int& num_switches, int& num_shorts, short& buffered, vtr::vector>& fan_in_list); static void fixup_rr_indexed_data_T_values(vtr::vector& rr_indexed_data, size_t num_segment); @@ -546,12 +546,15 @@ static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph, double avg_switch_T = 0; double avg_switch_Cinternal = 0; int num_switches = 0; + int num_shorts = 0; short buffered = UNDEFINED; - calculate_average_switch(rr_graph, (size_t)rr_id, avg_switch_R, avg_switch_T, avg_switch_Cinternal, num_switches, buffered, fan_in_list); + calculate_average_switch(rr_graph, (size_t)rr_id, avg_switch_R, avg_switch_T, avg_switch_Cinternal, num_switches, num_shorts, buffered, fan_in_list); if (num_switches == 0) { - VTR_LOG_WARN("Node: %d with RR_type: %s at Location:%s, had no out-going switches\n", rr_id, - rr_graph.node_type_string(rr_id), node_cords.c_str()); + if (num_shorts == 0) { + VTR_LOG_WARN("Node: %d with RR_type: %s at Location:%s, had no out-going switches\n", rr_id, + rr_graph.node_type_string(rr_id), node_cords.c_str()); + } continue; } VTR_ASSERT(num_switches > 0); @@ -638,20 +641,24 @@ static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph, * It is not safe to assume that each node of the same wire type has the same switches with the same * delays, therefore we take their average to take into account the possible differences */ -static void calculate_average_switch(const RRGraphView& rr_graph, int inode, double& avg_switch_R, double& avg_switch_T, double& avg_switch_Cinternal, int& num_switches, short& buffered, vtr::vector>& fan_in_list) { +static void calculate_average_switch(const RRGraphView& rr_graph, int inode, double& avg_switch_R, double& avg_switch_T, double& avg_switch_Cinternal, int& num_switches, int& num_shorts, short& buffered, vtr::vector>& fan_in_list) { auto node = RRNodeId(inode); avg_switch_R = 0; avg_switch_T = 0; avg_switch_Cinternal = 0; num_switches = 0; + num_shorts = 0; buffered = UNDEFINED; for (const auto& edge : fan_in_list[node]) { /* want to get C/R/Tdel/Cinternal of switches that connect this track segment to other track segments */ if (rr_graph.node_type(node) == CHANX || rr_graph.node_type(node) == CHANY) { int switch_index = rr_graph.rr_nodes().edge_switch(edge); - if (rr_graph.rr_switch_inf(RRSwitchId(switch_index)).type() == SwitchType::SHORT) continue; + if (rr_graph.rr_switch_inf(RRSwitchId(switch_index)).type() == SwitchType::SHORT) { + num_shorts++; + continue; + } avg_switch_R += rr_graph.rr_switch_inf(RRSwitchId(switch_index)).R; avg_switch_T += rr_graph.rr_switch_inf(RRSwitchId(switch_index)).Tdel; From 694e76da9847f6036cfcec906ac951dffdd72db3 Mon Sep 17 00:00:00 2001 From: Joshua Fife Date: Wed, 15 Jan 2025 22:15:38 -0700 Subject: [PATCH 2/2] fixed assert problem --- .../src/utils/alloc_and_load_rr_indexed_data.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp b/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp index 52c5632c9b3..1cfdba42f92 100644 --- a/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp +++ b/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp @@ -546,18 +546,13 @@ static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph, calculate_average_switch(rr_graph, (size_t)rr_id, avg_switch_R, avg_switch_T, avg_switch_Cinternal, num_switches, num_shorts, buffered, fan_in_list); if (num_switches == 0) { -<<<<<<< HEAD if (num_shorts == 0) { VTR_LOG_WARN("Node: %d with RR_type: %s at Location:%s, had no out-going switches\n", rr_id, rr_graph.node_type_string(rr_id), node_cords.c_str()); } -======= - VTR_LOG_WARN("Node: %d with RR_type: %s at Location:%s, had no incoming switches\n", rr_id, - rr_graph.node_type_string(rr_id), node_cords.c_str()); ->>>>>>> upstream/master continue; - } - VTR_ASSERT(num_switches > 0); + } + VTR_ASSERT(num_switches > 0 || num_shorts > 0); num_nodes_of_index[cost_index]++; C_total[cost_index].push_back(rr_graph.node_C(rr_id));