Skip to content

Commit 129fd88

Browse files
committed
[libs][rr_graph] print a warning if IPIN switch block doesn't match the one specified in architecture file
1 parent 57837db commit 129fd88

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ static void load_rr_indexed_data_base_costs(const RRGraphView& rr_graph,
2929

3030
static float get_delay_normalization_fac(const vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data, const bool echo_enabled, const char* echo_file_name);
3131

32-
static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph, vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data);
32+
static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph,
33+
const RRSwitchId wire_to_ipin_switch,
34+
vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data);
3335

3436
/**
3537
* @brief Computes average R, Tdel, and Cinternal of fan-in switches for a given node.
@@ -85,7 +87,7 @@ void alloc_and_load_rr_indexed_data(const RRGraphView& rr_graph,
8587
const std::vector<t_segment_inf>& segment_inf_y,
8688
const std::vector<t_segment_inf>& segment_inf_z,
8789
vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data,
88-
RRSwitchId wire_to_ipin_switch,
90+
const RRSwitchId wire_to_ipin_switch,
8991
e_base_cost_type base_cost_type,
9092
const bool echo_enabled,
9193
const char* echo_file_name) {
@@ -156,7 +158,9 @@ void alloc_and_load_rr_indexed_data(const RRGraphView& rr_graph,
156158
rr_indexed_data[index].seg_index = seg_ptr->seg_index;
157159
}
158160

159-
load_rr_indexed_data_T_values(rr_graph, rr_indexed_data);
161+
load_rr_indexed_data_T_values(rr_graph,
162+
wire_to_ipin_switch,
163+
rr_indexed_data);
160164

161165
fixup_rr_indexed_data_T_values(rr_indexed_data, total_num_segment);
162166

@@ -511,6 +515,7 @@ static float get_delay_normalization_fac(const vtr::vector<RRIndexedDataId, t_rr
511515
* - Placement Delay Matrix computation
512516
*/
513517
static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph,
518+
const RRSwitchId wire_to_ipin_switch,
514519
vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data) {
515520
vtr::vector<RRNodeId, std::vector<RREdgeId>> fan_in_list = get_fan_in_list(rr_graph);
516521

@@ -529,7 +534,7 @@ static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph,
529534
vtr::vector<RRIndexedDataId, std::vector<float>> switch_Cinternal_total(rr_indexed_data.size());
530535
vtr::vector<RRIndexedDataId, short> switches_buffered(rr_indexed_data.size(), LIBRRGRAPH_UNDEFINED_VAL);
531536

532-
std::map<short, int> ipin_switch_count;
537+
std::map<short, size_t> ipin_switch_count;
533538

534539
// Walk through the RR graph and collect all R and C values of all the nodes,
535540
// as well as their fan-in switches R, T_del, and Cinternal values.
@@ -601,15 +606,22 @@ static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph,
601606
}
602607
}
603608

604-
int most_frequent_ipin_switch = -1;
609+
short most_frequent_ipin_switch = -1;
610+
size_t most_frequent_ipin_switch_count = 0;
605611
for (const auto& [switch_index, count] : ipin_switch_count) {
606612
if (count > most_frequent_ipin_switch_count) {
607613
most_frequent_ipin_switch = switch_index;
614+
most_frequent_ipin_switch_count = count;
608615
}
609616
}
610617
VTR_ASSERT(most_frequent_ipin_switch != -1);
611618
rr_indexed_data[RRIndexedDataId(IPIN_COST_INDEX)].T_linear = rr_graph.rr_switch_inf(RRSwitchId(most_frequent_ipin_switch)).Tdel;
612-
619+
short wire_to_ipin_switch_index = static_cast<short>(size_t(wire_to_ipin_switch));
620+
if (most_frequent_ipin_switch != wire_to_ipin_switch_index) {
621+
VTR_LOG_WARN("Most frequent ipin switch %d is not the same as the wire_to_ipin_switch %d\n",
622+
most_frequent_ipin_switch,
623+
wire_to_ipin_switch_index);
624+
}
613625

614626
unsigned num_occurences_of_no_instances_with_cost_index = 0;
615627
for (size_t cost_index = CHANX_COST_INDEX_START; cost_index < rr_indexed_data.size(); cost_index++) {

0 commit comments

Comments
 (0)