Skip to content

Commit ae302cf

Browse files
authored
Merge pull request #3346 from verilog-to-routing/ipin_base_cost
Setting IPIN Tdel
2 parents 61e648b + ecc8cfe commit ae302cf

File tree

10 files changed

+59
-24
lines changed

10 files changed

+59
-24
lines changed

libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <algorithm>
44
#include <cmath> /* Needed only for sqrt call (remove if sqrt removed) */
5+
#include <cstddef>
56
#include <fstream>
67
#include <iomanip>
78
#include <numeric>
@@ -28,7 +29,9 @@ static void load_rr_indexed_data_base_costs(const RRGraphView& rr_graph,
2829

2930
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);
3031

31-
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);
3235

3336
/**
3437
* @brief Computes average R, Tdel, and Cinternal of fan-in switches for a given node.
@@ -49,7 +52,7 @@ static void calculate_average_switch(const RRGraphView& rr_graph,
4952
int& num_switches,
5053
int& num_shorts,
5154
short& buffered,
52-
vtr::vector<RRNodeId, std::vector<RREdgeId>>& fan_in_list);
55+
const vtr::vector<RRNodeId, std::vector<RREdgeId>>& fan_in_list);
5356

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

@@ -84,7 +87,7 @@ void alloc_and_load_rr_indexed_data(const RRGraphView& rr_graph,
8487
const std::vector<t_segment_inf>& segment_inf_y,
8588
const std::vector<t_segment_inf>& segment_inf_z,
8689
vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data,
87-
RRSwitchId wire_to_ipin_switch,
90+
const RRSwitchId wire_to_ipin_switch,
8891
e_base_cost_type base_cost_type,
8992
const bool echo_enabled,
9093
const char* echo_file_name) {
@@ -108,9 +111,6 @@ void alloc_and_load_rr_indexed_data(const RRGraphView& rr_graph,
108111
rr_indexed_data[RRIndexedDataId(i)].C_load = 0.;
109112
}
110113

111-
//TODO: SM: IPIN t_linear assumes wire_to_ipin_switch which corresponds to within die switch connection
112-
rr_indexed_data[RRIndexedDataId(IPIN_COST_INDEX)].T_linear = rr_graph.rr_switch_inf(wire_to_ipin_switch).Tdel;
113-
114114
std::vector<int> ortho_costs = find_ortho_cost_index(rr_graph, segment_inf_x, segment_inf_y, e_parallel_axis::X_AXIS);
115115

116116
/* AA: The code below should replace find_ortho_cost_index call once we deprecate the CLASSIC lookahead as it is the only lookahead
@@ -158,7 +158,9 @@ void alloc_and_load_rr_indexed_data(const RRGraphView& rr_graph,
158158
rr_indexed_data[index].seg_index = seg_ptr->seg_index;
159159
}
160160

161-
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);
162164

163165
fixup_rr_indexed_data_T_values(rr_indexed_data, total_num_segment);
164166

@@ -513,6 +515,7 @@ static float get_delay_normalization_fac(const vtr::vector<RRIndexedDataId, t_rr
513515
* - Placement Delay Matrix computation
514516
*/
515517
static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph,
518+
const RRSwitchId wire_to_ipin_switch,
516519
vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data) {
517520
vtr::vector<RRNodeId, std::vector<RREdgeId>> fan_in_list = get_fan_in_list(rr_graph);
518521

@@ -531,12 +534,24 @@ static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph,
531534
vtr::vector<RRIndexedDataId, std::vector<float>> switch_Cinternal_total(rr_indexed_data.size());
532535
vtr::vector<RRIndexedDataId, short> switches_buffered(rr_indexed_data.size(), LIBRRGRAPH_UNDEFINED_VAL);
533536

537+
size_t ipin_switch_count = 0;
538+
float ipin_switch_T_total = 0.;
539+
534540
// Walk through the RR graph and collect all R and C values of all the nodes,
535541
// as well as their fan-in switches R, T_del, and Cinternal values.
536542
// The median of R and C values for each cost index is assigned to the indexed data.
537543
for (const RRNodeId rr_id : rr_graph.nodes()) {
538544
e_rr_type rr_type = rr_graph.node_type(rr_id);
539545

546+
if (rr_type == e_rr_type::IPIN) {
547+
for (const RREdgeId edge : fan_in_list[rr_id]) {
548+
RRSwitchId rr_switch_id = RRSwitchId(rr_graph.edge_switch(edge));
549+
float switch_T_del = rr_graph.rr_switch_inf(rr_switch_id).Tdel;
550+
ipin_switch_T_total += switch_T_del;
551+
ipin_switch_count++;
552+
}
553+
}
554+
540555
if (!is_chanxy(rr_type) && !is_chanz(rr_type)) {
541556
continue;
542557
}
@@ -550,7 +565,15 @@ static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph,
550565
int num_switches = 0;
551566
int num_shorts = 0;
552567
short buffered = LIBRRGRAPH_UNDEFINED_VAL;
553-
calculate_average_switch(rr_graph, rr_id, avg_switch_R, avg_switch_T, avg_switch_Cinternal, num_switches, num_shorts, buffered, fan_in_list);
568+
calculate_average_switch(rr_graph,
569+
rr_id,
570+
avg_switch_R,
571+
avg_switch_T,
572+
avg_switch_Cinternal,
573+
num_switches,
574+
num_shorts,
575+
buffered,
576+
fan_in_list);
554577

555578
if (num_switches == 0) {
556579
if (num_shorts == 0) {
@@ -590,6 +613,18 @@ static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph,
590613
}
591614
}
592615

616+
// Set the T_linear value for the IPIN cost index
617+
{
618+
if (ipin_switch_count == 0) {
619+
VTR_LOG_WARN("No IPIN switches found. Setting T_linear to 0\n");
620+
float default_ipin_switch_T_del = rr_graph.rr_switch_inf(RRSwitchId(wire_to_ipin_switch)).Tdel;
621+
rr_indexed_data[RRIndexedDataId(IPIN_COST_INDEX)].T_linear = default_ipin_switch_T_del;
622+
} else {
623+
float average_ipin_switch_T_del = ipin_switch_T_total / ipin_switch_count;
624+
rr_indexed_data[RRIndexedDataId(IPIN_COST_INDEX)].T_linear = average_ipin_switch_T_del;
625+
}
626+
}
627+
593628
unsigned num_occurences_of_no_instances_with_cost_index = 0;
594629
for (size_t cost_index = CHANX_COST_INDEX_START; cost_index < rr_indexed_data.size(); cost_index++) {
595630
if (num_nodes_of_index[RRIndexedDataId(cost_index)] == 0) { // Segments don't exist.
@@ -650,7 +685,7 @@ static void calculate_average_switch(const RRGraphView& rr_graph,
650685
int& num_switches,
651686
int& num_shorts,
652687
short& buffered,
653-
vtr::vector<RRNodeId, std::vector<RREdgeId>>& fan_in_list) {
688+
const vtr::vector<RRNodeId, std::vector<RREdgeId>>& fan_in_list) {
654689

655690
avg_switch_R = 0;
656691
avg_switch_T = 0;

libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void alloc_and_load_rr_indexed_data(const RRGraphView& rr_graph,
1212
const std::vector<t_segment_inf>& segment_inf_y,
1313
const std::vector<t_segment_inf>& segment_inf_z,
1414
vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data,
15-
RRSwitchId wire_to_ipin_switch,
15+
const RRSwitchId wire_to_ipin_switch,
1616
e_base_cost_type base_cost_type,
1717
const bool echo_enabled,
1818
const char* echo_file_name);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
arch circuit script_params vtr_flow_elapsed_time vtr_max_mem_stage vtr_max_mem error odin_synth_time max_odin_mem parmys_synth_time max_parmys_mem abc_depth abc_synth_time abc_cec_time abc_sec_time max_abc_mem ace_time max_ace_mem num_clb num_io num_memories num_mult vpr_status vpr_revision vpr_build_info vpr_compiler vpr_compiled hostname rundir max_vpr_mem num_primary_inputs num_primary_outputs num_pre_packed_nets num_pre_packed_blocks num_netlist_clocks num_post_packed_nets num_post_packed_blocks device_width device_height device_grid_tiles device_limiting_resources device_name pack_mem pack_time initial_placed_wirelength_est placed_wirelength_est total_swap accepted_swap rejected_swap aborted_swap place_mem place_time place_quench_time initial_placed_CPD_est placed_CPD_est placed_setup_TNS_est placed_setup_WNS_est placed_geomean_nonvirtual_intradomain_critical_path_delay_est place_delay_matrix_lookup_time place_quench_timing_analysis_time place_quench_sta_time place_total_timing_analysis_time place_total_sta_time ap_mem ap_time ap_full_legalizer_mem ap_full_legalizer_time routed_wirelength avg_routed_wirelength routed_wiresegment avg_routed_wiresegment total_nets_routed total_connections_routed total_heap_pushes total_heap_pops logic_block_area_total logic_block_area_used routing_area_total routing_area_per_tile crit_path_route_success_iteration num_rr_graph_nodes num_rr_graph_edges collapsed_nodes critical_path_delay geomean_nonvirtual_intradomain_critical_path_delay setup_TNS setup_WNS hold_TNS hold_WNS create_rr_graph_time create_intra_cluster_rr_graph_time adding_internal_edges route_mem crit_path_route_time crit_path_total_timing_analysis_time crit_path_total_sta_time router_lookahead_mem tile_lookahead_computation_time router_lookahead_computation_time
2-
k6_frac_N10_40nm.xml apex4.pre-vpr.blif common 2.64 vpr 75.26 MiB -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 135 9 -1 -1 success v8.0.0-13084-g071ad3865 release IPO VTR_ASSERT_LEVEL=2 GNU 13.3.0 on Linux-6.8.0-60-generic x86_64 2025-06-17T09:37:40 betzgrp-wintermute /home/pooladam/vtr-verilog-to-routing 77064 9 19 896 28 0 660 163 16 16 256 -1 mcnc_medium -1 -1 7727.83 7087 9508 603 6937 1968 75.3 MiB 2.09 0.00 6.3343 5.39115 -88.0884 -5.39115 nan 0.00 0.00133719 0.00116801 0.0488072 0.0445052 75.3 MiB 2.09 75.3 MiB 1.41 11108 16.8558 2920 4.43096 4709 24240 778883 128039 1.05632e+07 7.27569e+06 1.26944e+06 4958.75 19 28900 206586 -1 5.72644 nan -92.7439 -5.72644 0 0 0.13 -1 -1 75.3 MiB 0.25 0.223627 0.205422 31.2 MiB -1 0.04
2+
k6_frac_N10_40nm.xml apex4.pre-vpr.blif common 2.64 vpr 75.26 MiB -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 130 9 -1 -1 success v8.0.0-13084-g071ad3865 release IPO VTR_ASSERT_LEVEL=2 GNU 13.3.0 on Linux-6.8.0-60-generic x86_64 2025-06-17T09:37:40 betzgrp-wintermute /home/pooladam/vtr-verilog-to-routing 77064 9 19 896 28 0 660 163 16 16 256 -1 mcnc_medium -1 -1 7727.83 7087 9508 603 6937 1968 75.3 MiB 2.09 0.00 6.3343 5.39115 -88.0884 -5.39115 nan 0.00 0.00133719 0.00116801 0.0488072 0.0445052 75.3 MiB 2.09 75.3 MiB 1.41 11108 16.8558 2920 4.43096 4709 24240 778883 128039 1.05632e+07 7.27569e+06 1.26944e+06 4958.75 19 28900 206586 -1 5.72644 nan -92.7439 -5.72644 0 0 0.13 -1 -1 75.3 MiB 0.25 0.223627 0.205422 31.2 MiB -1 0.04
33
k6_frac_N10_40nm.xml des.pre-vpr.blif common 1.54 vpr 76.40 MiB -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 173 256 -1 -1 success v8.0.0-13084-g071ad3865 release IPO VTR_ASSERT_LEVEL=2 GNU 13.3.0 on Linux-6.8.0-60-generic x86_64 2025-06-17T09:37:40 betzgrp-wintermute /home/pooladam/vtr-verilog-to-routing 78236 256 245 954 501 0 760 674 22 22 484 -1 mcnc_large -1 -1 9292.95 7827 56800 1790 18880 36130 76.4 MiB 1.08 0.01 5.23911 4.45825 -854.38 -4.45825 nan 0.00 0.00195959 0.0018456 0.0499366 0.0472422 76.4 MiB 1.08 76.4 MiB 0.81 11106 14.6132 3086 4.06053 2658 7145 291226 67335 2.15576e+07 9.32366e+06 1.49107e+06 3080.73 14 47664 245996 -1 4.93512 nan -901.874 -4.93512 0 0 0.15 -1 -1 76.4 MiB 0.16 0.143878 0.136836 33.7 MiB -1 0.05
44
k6_frac_N10_40nm.xml seq.pre-vpr.blif common 2.76 vpr 76.48 MiB -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 147 41 -1 -1 success v8.0.0-13084-g071ad3865 release IPO VTR_ASSERT_LEVEL=2 GNU 13.3.0 on Linux-6.8.0-60-generic x86_64 2025-06-17T09:37:40 betzgrp-wintermute /home/pooladam/vtr-verilog-to-routing 78320 41 35 1006 76 0 714 223 16 16 256 -1 mcnc_medium -1 -1 9169.27 7694 8335 415 5173 2747 76.5 MiB 2.20 0.01 6.36629 5.23793 -151.219 -5.23793 nan 0.00 0.0015282 0.00132775 0.0366109 0.0336215 76.5 MiB 2.20 76.5 MiB 1.46 12142 17.0056 3244 4.54342 4212 22271 689032 117413 1.05632e+07 7.92242e+06 1.26944e+06 4958.75 16 28900 206586 -1 5.65269 nan -156.023 -5.65269 0 0 0.13 -1 -1 76.5 MiB 0.24 0.22311 0.205529 31.8 MiB -1 0.04

vtr_flow/tasks/regression_tests/vtr_reg_strong/strong_bidir/config/golden_results.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
k4_n4_v7_bidir.xml styr.blif common 1.37 vpr 62.60 MiB -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 72 10 -1 -1 success b2bdea1 Release VTR_ASSERT_LEVEL=3 GNU 13.3.0 on Linux-6.11.0-1015-azure x86_64 2025-06-18T23:25:54 pkrvmxyh4eaekms /home/runner/work/vtr-verilog-to-routing/vtr-verilog-to-routing 64104 10 10 253 263 1 171 92 11 11 121 clb auto 23.5 MiB 0.04 1829.24 1329 4646 728 3820 98 62.6 MiB 0.05 0.00 8.75156 5.65828 -74.3763 -5.65828 5.65828 0.08 0.000539066 0.000438929 0.0158895 0.0133045 -1 -1 -1 -1 14 1972 27 2.43e+06 2.16e+06 -1 -1 0.65 0.146019 0.12287 3402 27531 -1 1970 16 1168 4226 219209 27455 7.33108 7.33108 -92.5065 -7.33108 0 0 -1 -1 0.01 0.07 0.02 -1 -1 0.01 0.0241699 0.0213263
33
k4_n4_v7_longline_bidir.xml styr.blif common 1.77 vpr 63.19 MiB -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 72 10 -1 -1 success b2bdea1 Release VTR_ASSERT_LEVEL=3 GNU 13.3.0 on Linux-6.11.0-1015-azure x86_64 2025-06-18T23:25:54 pkrvmxyh4eaekms /home/runner/work/vtr-verilog-to-routing/vtr-verilog-to-routing 64704 10 10 253 263 1 171 92 11 11 121 clb auto 23.6 MiB 0.04 1829.24 1305 3404 389 2964 51 63.2 MiB 0.04 0.00 5.19817 4.46893 -53.8773 -4.46893 4.46893 0.09 0.000510361 0.000414222 0.0114433 0.00959255 -1 -1 -1 -1 18 2312 35 2.43e+06 2.16e+06 -1 -1 1.02 0.19335 0.161505 3282 34431 -1 2326 21 1300 4425 297597 37882 9.34193 9.34193 -107.688 -9.34193 0 0 -1 -1 0.02 0.09 0.03 -1 -1 0.02 0.0293867 0.0256624
44
k4_n4_v7_l1_bidir.xml styr.blif common 1.82 vpr 62.58 MiB -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 72 10 -1 -1 success b2bdea1 Release VTR_ASSERT_LEVEL=3 GNU 13.3.0 on Linux-6.11.0-1015-azure x86_64 2025-06-18T23:25:54 pkrvmxyh4eaekms /home/runner/work/vtr-verilog-to-routing/vtr-verilog-to-routing 64084 10 10 253 263 1 171 92 11 11 121 clb auto 23.7 MiB 0.04 1829.24 1283 8993 1996 6843 154 62.6 MiB 0.10 0.00 11.3865 6.82489 -85.7025 -6.82489 6.82489 0.10 0.000535759 0.000437145 0.0267342 0.0222548 -1 -1 -1 -1 10 1437 37 2.43e+06 2.16e+06 -1 -1 0.95 0.1205 0.101293 4482 22551 -1 1348 24 1290 4977 336418 74151 8.81482 8.81482 -100.507 -8.81482 0 0 -1 -1 0.01 0.12 0.02 -1 -1 0.01 0.0332838 0.0290833
5-
k4_n4_v7_bidir_pass_gate.xml styr.blif common 2.05 vpr 63.22 MiB -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 72 10 -1 -1 success b2bdea1 Release VTR_ASSERT_LEVEL=3 GNU 13.3.0 on Linux-6.11.0-1015-azure x86_64 2025-06-18T23:25:54 pkrvmxyh4eaekms /home/runner/work/vtr-verilog-to-routing/vtr-verilog-to-routing 64736 10 10 253 263 1 171 92 11 11 121 clb auto 23.6 MiB 0.04 1829.24 1294 4025 499 3414 112 63.2 MiB 0.05 0.00 4.50889 3.4607 -44.4554 -3.4607 3.4607 0.09 0.00054143 0.000441935 0.0136548 0.0114763 -1 -1 -1 -1 16 2079 28 2.43e+06 2.16e+06 -1 -1 1.10 0.148452 0.124941 3522 30407 -1 2152 25 1482 5545 978183 174036 26.5946 26.5946 -323.027 -26.5946 0 0 -1 -1 0.01 0.28 0.03 -1 -1 0.01 0.0329671 0.0287146
5+
k4_n4_v7_bidir_pass_gate.xml styr.blif common 2.05 vpr 63.22 MiB -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 72 10 -1 -1 success b2bdea1 Release VTR_ASSERT_LEVEL=3 GNU 13.3.0 on Linux-6.11.0-1015-azure x86_64 2025-06-18T23:25:54 pkrvmxyh4eaekms /home/runner/work/vtr-verilog-to-routing/vtr-verilog-to-routing 64736 10 10 253 263 1 171 92 11 11 121 clb auto 23.6 MiB 0.04 1829.24 1294 4025 499 3414 112 63.2 MiB 0.05 0.00 4.50889 3.4607 -44.4554 -3.4607 3.4607 0.09 0.00054143 0.000441935 0.0136548 0.0114763 -1 -1 -1 -1 16 2079 28 2.43e+06 2.16e+06 -1 -1 1.10 0.148452 0.124941 3522 30407 -1 2152 25 1482 5545 978183 174036 26.5946 26.5946 -260 -26.5946 0 0 -1 -1 0.01 0.28 0.03 -1 -1 0.01 0.0329671 0.0287146

0 commit comments

Comments
 (0)