Skip to content

fixed issue with warning being thrown for short switch types #2713

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

Merged
merged 3 commits into from
Jan 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static float get_delay_normalization_fac(const vtr::vector<RRIndexedDataId, t_rr

static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph, vtr::vector<RRIndexedDataId, t_rr_indexed_data>& 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<RRNodeId, std::vector<RREdgeId>>& 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<RRNodeId, std::vector<RREdgeId>>& fan_in_list);

static void fixup_rr_indexed_data_T_values(vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data, size_t num_segment);

Expand Down Expand Up @@ -541,15 +541,18 @@ 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 incoming 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);
}
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));
Expand Down Expand Up @@ -633,20 +636,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<RRNodeId, std::vector<RREdgeId>>& 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<RRNodeId, std::vector<RREdgeId>>& 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;
Expand Down
Loading