From 92dfcc8d75bf7c954c466199fe47f4adcbc02efb Mon Sep 17 00:00:00 2001 From: Amin Mohaghegh Date: Fri, 21 Nov 2025 15:52:24 -0800 Subject: [PATCH 01/16] [vpr][power] use node type to determine whether edge is to IPIN --- vpr/src/power/power.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vpr/src/power/power.cpp b/vpr/src/power/power.cpp index 1adedffd27..1fb2ee970c 100644 --- a/vpr/src/power/power.cpp +++ b/vpr/src/power/power.cpp @@ -979,7 +979,8 @@ static void power_usage_routing(t_power_usage* power_usage, connectionbox_fanout = 0; switchbox_fanout = 0; for (t_edge_size iedge = 0; iedge < rr_graph.num_edges(rr_id); iedge++) { - if ((RRSwitchId)rr_graph.edge_switch(rr_id, iedge) == routing_arch.wire_to_rr_ipin_switch) { + RRNodeId edge_sink = rr_graph.edge_sink_node(rr_id, iedge); + if (rr_graph.node_type(edge_sink) == e_rr_type::IPIN) { connectionbox_fanout++; } else if (rr_graph.edge_switch(rr_id, iedge) == routing_arch.delayless_switch) { /* Do nothing */ @@ -1225,7 +1226,8 @@ void power_routing_init(const t_det_routing_arch& routing_arch) { case e_rr_type::CHANX: case e_rr_type::CHANY: for (t_edge_size iedge = 0; iedge < rr_graph.num_edges(rr_node_idx); iedge++) { - if ((RRSwitchId)rr_graph.edge_switch(rr_node_idx, iedge) == routing_arch.wire_to_rr_ipin_switch) { + RRNodeId edge_sink = rr_graph.edge_sink_node(rr_node_idx, iedge); + if (rr_graph.node_type(edge_sink) == e_rr_type::IPIN) { fanout_to_IPIN++; } else if (rr_graph.edge_switch(rr_node_idx, iedge) != routing_arch.delayless_switch) { fanout_to_seg++; From b5c4bdcee40911b6c44bc062abd70c1e628ef610 Mon Sep 17 00:00:00 2001 From: Amin Mohaghegh Date: Fri, 21 Nov 2025 16:04:21 -0800 Subject: [PATCH 02/16] [vpr][route] get ipin c from rr graph in add_rr_graph_C_from_switches --- .../route/rr_graph_generation/rr_graph_timing_params.cpp | 7 ++++--- vpr/src/route/rr_graph_generation/rr_graph_timing_params.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/vpr/src/route/rr_graph_generation/rr_graph_timing_params.cpp b/vpr/src/route/rr_graph_generation/rr_graph_timing_params.cpp index 48ca3a981f..6f9b04ae53 100644 --- a/vpr/src/route/rr_graph_generation/rr_graph_timing_params.cpp +++ b/vpr/src/route/rr_graph_generation/rr_graph_timing_params.cpp @@ -8,7 +8,7 @@ /****************** Subroutine definitions *********************************/ -void add_rr_graph_C_from_switches(float C_ipin_cblock) { +void add_rr_graph_C_from_switches() { /* This routine finishes loading the C elements of the rr_graph. It assumes * * that when you call it the CHANX and CHANY nodes have had their C set to * * their metal capacitance, and everything else has C set to 0. The graph * @@ -100,18 +100,19 @@ void add_rr_graph_C_from_switches(float C_ipin_cblock) { } /* End edge to CHANX or CHANY node. */ else if (to_rr_type == e_rr_type::IPIN) { + float ipin_c = rr_graph.rr_switch_inf(RRSwitchId(switch_index)).Cin; if (INCLUDE_TRACK_BUFFERS) { /* Implements sharing of the track to connection box buffer. * Such a buffer exists at every segment of the wire at which * at least one logic block input connects. */ icblock = seg_index_of_cblock(rr_graph, from_rr_type, to_node); if (cblock_counted[icblock] == false) { - rr_node_C[inode] += C_ipin_cblock; + rr_node_C[inode] += ipin_c; cblock_counted[icblock] = true; } } else { /* No track buffer. Simply add the capacitance onto the wire */ - rr_node_C[inode] += C_ipin_cblock; + rr_node_C[inode] += ipin_c; } } } /* End loop over all edges of a node. */ diff --git a/vpr/src/route/rr_graph_generation/rr_graph_timing_params.h b/vpr/src/route/rr_graph_generation/rr_graph_timing_params.h index e919edf9a2..45347f57f2 100644 --- a/vpr/src/route/rr_graph_generation/rr_graph_timing_params.h +++ b/vpr/src/route/rr_graph_generation/rr_graph_timing_params.h @@ -1,3 +1,3 @@ #pragma once -void add_rr_graph_C_from_switches(float C_ipin_cblock); +void add_rr_graph_C_from_switches(); From bbdd2cccc8863d05369d005d4dab2dd251473f76 Mon Sep 17 00:00:00 2001 From: Amin Mohaghegh Date: Sat, 22 Nov 2025 08:48:24 -0800 Subject: [PATCH 03/16] [vpr][route][area] pass the most freq used IPIN switch type to get_cblock_trans --- .../rr_graph_generation/rr_graph_area.cpp | 46 ++++++++++++++----- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/vpr/src/route/rr_graph_generation/rr_graph_area.cpp b/vpr/src/route/rr_graph_generation/rr_graph_area.cpp index a453f7b72a..dec6784c14 100644 --- a/vpr/src/route/rr_graph_generation/rr_graph_area.cpp +++ b/vpr/src/route/rr_graph_generation/rr_graph_area.cpp @@ -24,10 +24,9 @@ static const e_trans_area_eq trans_area_eq = AREA_IMPROVED_NMOS_ONLY; /************************ Subroutines local to this module *******************/ -static void count_bidir_routing_transistors(int num_switch, RRSwitchId wire_to_ipin_switch, float R_minW_nmos, float R_minW_pmos, const float trans_sram_bit); +static void count_bidir_routing_transistors(int num_switch, float R_minW_nmos, float R_minW_pmos, const float trans_sram_bit); static void count_unidir_routing_transistors(std::vector& segment_inf, - RRSwitchId wire_to_ipin_switch, float R_minW_nmos, float R_minW_pmos, const float trans_sram_bit, @@ -54,7 +53,6 @@ static float trans_per_R(float Rtrans, float R_minW_trans); void count_routing_transistors(enum e_directionality directionality, int num_switch, - RRSwitchId wire_to_ipin_switch, std::vector& segment_inf, float R_minW_nmos, float R_minW_pmos, @@ -75,11 +73,10 @@ void count_routing_transistors(enum e_directionality directionality, const float trans_sram_bit = 4.; if (directionality == BI_DIRECTIONAL) { - count_bidir_routing_transistors(num_switch, wire_to_ipin_switch, R_minW_nmos, R_minW_pmos, trans_sram_bit); + count_bidir_routing_transistors(num_switch, R_minW_nmos, R_minW_pmos, trans_sram_bit); } else { VTR_ASSERT(directionality == UNI_DIRECTIONAL); count_unidir_routing_transistors(segment_inf, - wire_to_ipin_switch, R_minW_nmos, R_minW_pmos, trans_sram_bit, @@ -87,7 +84,7 @@ void count_routing_transistors(enum e_directionality directionality, } } -static void count_bidir_routing_transistors(int num_switch, RRSwitchId wire_to_ipin_switch, float R_minW_nmos, float R_minW_pmos, const float trans_sram_bit) { +static void count_bidir_routing_transistors(int num_switch, float R_minW_nmos, float R_minW_pmos, const float trans_sram_bit) { /* Tri-state buffers are designed as a buffer followed by a pass transistor. * * I make Rbuffer = Rpass_transitor = 1/2 Rtri-state_buffer. * * I make the pull-up and pull-down sides of the buffer the same strength -- * @@ -164,6 +161,8 @@ static void count_bidir_routing_transistors(int num_switch, RRSwitchId wire_to_i sharable_switch_trans = alloc_and_load_sharable_switch_trans(num_switch, R_minW_nmos, R_minW_pmos); + + std::unordered_map ipin_switch_count; for (const RRNodeId from_rr_node : device_ctx.rr_graph.nodes()) { size_t from_node = (size_t)from_rr_node; @@ -206,6 +205,11 @@ static void count_bidir_routing_transistors(int num_switch, RRSwitchId wire_to_i break; case e_rr_type::IPIN: + RRSwitchId switch_id = RRSwitchId(rr_graph.edge_switch(RRNodeId(from_node), iedge)); + if (ipin_switch_count.find(switch_id) == ipin_switch_count.end()) { + ipin_switch_count[switch_id] = 0; + } + ipin_switch_count[switch_id]++; num_inputs_to_cblock[to_node]++; max_inputs_to_cblock = std::max(max_inputs_to_cblock, num_inputs_to_cblock[to_node]); @@ -285,8 +289,16 @@ static void count_bidir_routing_transistors(int num_switch, RRSwitchId wire_to_i /* Now add in the input connection block transistors. */ - input_cblock_trans = get_cblock_trans(num_inputs_to_cblock, wire_to_ipin_switch, - max_inputs_to_cblock, trans_sram_bit); + // Get most frequent ipin switch + RRSwitchId most_frequent_ipin_switch = std::max_element(ipin_switch_count.begin(), + ipin_switch_count.end(), + [](const auto& a, const auto& b) { + return a.second < b.second; + })->first; + input_cblock_trans = get_cblock_trans(num_inputs_to_cblock, + most_frequent_ipin_switch, + max_inputs_to_cblock, + trans_sram_bit); ntrans_sharing += input_cblock_trans; ntrans_no_sharing += input_cblock_trans; @@ -301,7 +313,6 @@ static void count_bidir_routing_transistors(int num_switch, RRSwitchId wire_to_i } static void count_unidir_routing_transistors(std::vector& /*segment_inf*/, - RRSwitchId wire_to_ipin_switch, float R_minW_nmos, float R_minW_pmos, const float trans_sram_bit, @@ -357,6 +368,7 @@ static void count_unidir_routing_transistors(std::vector& /*segme cblock_counted[k] = 0; ntrans = 0; + std::unordered_map ipin_switch_count; for (const RRNodeId from_rr_node : device_ctx.rr_graph.nodes()) { size_t from_node = size_t(from_rr_node); from_rr_type = rr_graph.node_type(from_rr_node); @@ -424,6 +436,11 @@ static void count_unidir_routing_transistors(std::vector& /*segme break; case e_rr_type::IPIN: + RRSwitchId switch_id = RRSwitchId(rr_graph.edge_switch(RRNodeId(from_node), iedge)); + if (ipin_switch_count.find(switch_id) == ipin_switch_count.end()) { + ipin_switch_count[switch_id] = 0; + } + ipin_switch_count[switch_id]++; num_inputs_to_cblock[to_node]++; max_inputs_to_cblock = std::max(max_inputs_to_cblock, num_inputs_to_cblock[to_node]); iseg = seg_index_of_cblock(rr_graph, from_rr_type, size_t(to_node)); @@ -471,8 +488,15 @@ static void count_unidir_routing_transistors(std::vector& /*segme /* Now add in the input connection block transistors. */ - input_cblock_trans = get_cblock_trans(num_inputs_to_cblock, wire_to_ipin_switch, - max_inputs_to_cblock, trans_sram_bit); + // Get most frequent ipin switch + RRSwitchId most_frequent_ipin_switch = std::max_element(ipin_switch_count.begin(), ipin_switch_count.end(), [](const auto& a, const auto& b) { + return a.second < b.second; + })->first; + + input_cblock_trans = get_cblock_trans(num_inputs_to_cblock, + most_frequent_ipin_switch, + max_inputs_to_cblock, + trans_sram_bit); delete[] cblock_counted; From 1d9030921b2e225a9f89c605f6d6a43fbab021df Mon Sep 17 00:00:00 2001 From: Amin Mohaghegh Date: Sat, 22 Nov 2025 09:09:43 -0800 Subject: [PATCH 04/16] [vpr][route][switch] remove rr_ipin switch from alloc_and_load_rr_switch_inf --- .../rr_graph_switch_utils.cpp | 23 +------------------ .../rr_graph_switch_utils.h | 5 +--- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/vpr/src/route/rr_graph_generation/rr_graph_switch_utils.cpp b/vpr/src/route/rr_graph_generation/rr_graph_switch_utils.cpp index 236e1f3e2d..7b496290b1 100644 --- a/vpr/src/route/rr_graph_generation/rr_graph_switch_utils.cpp +++ b/vpr/src/route/rr_graph_generation/rr_graph_switch_utils.cpp @@ -172,9 +172,7 @@ void alloc_and_load_rr_switch_inf(RRGraphBuilder& rr_graph_builder, t_arch_switch_fanin& switch_fanin_remap, const std::map& arch_sw_inf, const float R_minW_nmos, - const float R_minW_pmos, - const int wire_to_arch_ipin_switch, - RRSwitchId& wire_to_rr_ipin_switch) { + const float R_minW_pmos) { // we will potentially be creating a couple of versions of each arch switch where // each version corresponds to a different fan-in. We will need to fill device_ctx.rr_switch_inf // with this expanded list of switches. @@ -200,23 +198,4 @@ void alloc_and_load_rr_switch_inf(RRGraphBuilder& rr_graph_builder, // next, walk through rr nodes again and remap their switch indices to rr_switch_inf rr_graph_builder.remap_rr_node_switch_indices(arch_switch_fanins); - - // now we need to set the wire_to_rr_ipin_switch variable which points the detailed routing architecture - // to the representative ipin cblock switch. currently we're not allowing the specification of an ipin cblock switch - // with multiple fan-ins, so right now there's just one. May change in the future, in which case we'd need to - // return a representative switch - if (arch_switch_fanins[wire_to_arch_ipin_switch].count(UNDEFINED)) { - // only have one ipin cblock switch. OK. - wire_to_rr_ipin_switch = arch_switch_fanins[wire_to_arch_ipin_switch][UNDEFINED]; - } else if (arch_switch_fanins[wire_to_arch_ipin_switch].size() != 0) { - VPR_FATAL_ERROR(VPR_ERROR_ARCH, - "Not currently allowing an ipin cblock switch to have multiple fan-ins"); - } else { - // This likely indicates that no connection block has been constructed, indicating significant issues with - // the generated RR graph. - // Instead of throwing an error we issue a warning. This means that check_rr_graph() etc. will run to give more information - // and allow graphics to be brought up for users to debug their architectures. - wire_to_rr_ipin_switch = RRSwitchId::INVALID(); - VTR_LOG_WARN("No switch found for the ipin cblock in RR graph. Check if there is an error in arch file, or if no connection blocks are being built in RR graph\n"); - } } diff --git a/vpr/src/route/rr_graph_generation/rr_graph_switch_utils.h b/vpr/src/route/rr_graph_generation/rr_graph_switch_utils.h index f4d201b169..ab21401633 100644 --- a/vpr/src/route/rr_graph_generation/rr_graph_switch_utils.h +++ b/vpr/src/route/rr_graph_generation/rr_graph_switch_utils.h @@ -67,12 +67,9 @@ t_rr_switch_inf create_rr_switch_from_arch_switch(const t_arch_switch_inf& arch_ * @param R_minW_nmos Reference R for a minimum-width nMOS (for AUTO buf sizing). * @param R_minW_pmos Reference R for a minimum-width pMOS (for AUTO buf sizing). * @param wire_to_arch_ipin_switch Architecture index of the IPIN connection-block switch. - * @param wire_to_rr_ipin_switch Output: rr_switch index of the representative IPIN cblock switch. */ void alloc_and_load_rr_switch_inf(RRGraphBuilder& rr_graph_builder, t_arch_switch_fanin& switch_fanin_remap, const std::map& arch_sw_inf, const float R_minW_nmos, - const float R_minW_pmos, - const int wire_to_arch_ipin_switch, - RRSwitchId& wire_to_rr_ipin_switch); + const float R_minW_pmos); From 4cea4117c1db4d69f9b2b4db2676f5180a7e0c4d Mon Sep 17 00:00:00 2001 From: Amin Mohaghegh Date: Sat, 22 Nov 2025 09:10:25 -0800 Subject: [PATCH 05/16] [lib][rr_graph] remove ipin_switch from rr graph reader --- libs/librrgraph/src/io/rr_graph_reader.cpp | 4 -- libs/librrgraph/src/io/rr_graph_reader.h | 2 - .../src/io/rr_graph_uxsdcxx_serializer.h | 51 +------------------ libs/librrgraph/src/io/rr_graph_writer.cpp | 2 - .../utils/alloc_and_load_rr_indexed_data.cpp | 9 +--- .../utils/alloc_and_load_rr_indexed_data.h | 1 - 6 files changed, 3 insertions(+), 66 deletions(-) diff --git a/libs/librrgraph/src/io/rr_graph_reader.cpp b/libs/librrgraph/src/io/rr_graph_reader.cpp index ff0f8b9e4a..1a1072ef61 100644 --- a/libs/librrgraph/src/io/rr_graph_reader.cpp +++ b/libs/librrgraph/src/io/rr_graph_reader.cpp @@ -66,8 +66,6 @@ void load_rr_file(RRGraphBuilder* rr_graph_builder, const t_arch* arch, t_chan_width* chan_width, const e_base_cost_type base_cost_type, - RRSwitchId* wire_to_rr_ipin_switch, - int* wire_to_rr_ipin_switch_between_dice, const char* read_rr_graph_name, std::string* loaded_rr_graph_filename, bool read_edge_metadata, @@ -86,8 +84,6 @@ void load_rr_file(RRGraphBuilder* rr_graph_builder, RrGraphSerializer reader( graph_type, base_cost_type, - wire_to_rr_ipin_switch, - wire_to_rr_ipin_switch_between_dice, do_check_rr_graph, read_rr_graph_name, loaded_rr_graph_filename, diff --git a/libs/librrgraph/src/io/rr_graph_reader.h b/libs/librrgraph/src/io/rr_graph_reader.h index 1f3efbe2ae..824270c4e3 100644 --- a/libs/librrgraph/src/io/rr_graph_reader.h +++ b/libs/librrgraph/src/io/rr_graph_reader.h @@ -23,8 +23,6 @@ void load_rr_file(RRGraphBuilder* rr_graph_builder, const t_arch* arch, t_chan_width* chan_width, const e_base_cost_type base_cost_type, - RRSwitchId* wire_to_rr_ipin_switch, - int* wire_to_rr_ipin_switch_between_dice, const char* read_rr_graph_name, std::string* loaded_rr_graph_filename, bool read_edge_metadata, diff --git a/libs/librrgraph/src/io/rr_graph_uxsdcxx_serializer.h b/libs/librrgraph/src/io/rr_graph_uxsdcxx_serializer.h index 3f76fa47f2..f16f027af2 100644 --- a/libs/librrgraph/src/io/rr_graph_uxsdcxx_serializer.h +++ b/libs/librrgraph/src/io/rr_graph_uxsdcxx_serializer.h @@ -274,8 +274,6 @@ class RrGraphSerializer final : public uxsd::RrGraphBase { RrGraphSerializer( const e_graph_type graph_type, const enum e_base_cost_type base_cost_type, - RRSwitchId* wire_to_rr_ipin_switch, - int* wire_to_rr_ipin_switch_between_dice, bool do_check_rr_graph, const char* read_rr_graph_name, std::string* loaded_rr_graph_filename, @@ -297,9 +295,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase { MetadataStorage>* rr_edge_metadata, vtr::string_internment* strings, bool is_flat) - : wire_to_rr_ipin_switch_(wire_to_rr_ipin_switch) - , wire_to_rr_ipin_switch_between_dice_(wire_to_rr_ipin_switch_between_dice) - , chan_width_(chan_width) + : chan_width_(chan_width) , rr_nodes_(rr_nodes) , rr_graph_builder_(rr_graph_builder) , rr_graph_(rr_graph) @@ -1147,20 +1143,6 @@ class RrGraphSerializer final : public uxsd::RrGraphBase { return nullptr; } inline void finish_rr_graph_rr_edges(void*& /*ctx*/) final { - /*initialize a vector that keeps track of the number of wire to ipin switches - * There should be only one wire to ipin switch. In case there are more, make sure to - * store the most frequent switch */ - const auto& rr_graph = (*rr_graph_); - std::vector count_for_wire_to_ipin_switches; - count_for_wire_to_ipin_switches.resize(rr_switch_inf_->size(), 0); - //switch for same layer Track to IPIN connection - //first is index, second is count - std::pair most_frequent_switch(-1, 0); - //switch for different layer Track to IPIN connection - std::vector count_for_wire_to_ipin_switches_between_dice; - count_for_wire_to_ipin_switches_between_dice.resize(rr_switch_inf_->size(), 0); - std::pair most_frequent_switch_between_dice(-1,0); - // Partition the rr graph edges for efficient access to // configurable/non-configurable edge subsets. Must be done after RR // switches have been allocated. @@ -1183,36 +1165,8 @@ class RrGraphSerializer final : public uxsd::RrGraphBase { "switch_id %zu is larger than num_rr_switches %zu", switch_id, rr_switch_inf_->size()); } - auto node = (*rr_nodes_)[source_node]; - - /*Keeps track of the number of the specific type of switch that connects a wire to an ipin - * use the pair data structure to keep the maximum*/ - if (rr_graph.node_type(node.id()) == e_rr_type::CHANX || rr_graph.node_type(node.id()) == e_rr_type::CHANY) { - if(rr_graph.node_type(RRNodeId(sink_node)) == e_rr_type::IPIN){ - if (rr_graph.node_layer_low(RRNodeId(sink_node)) == rr_graph.node_layer_low(RRNodeId(source_node))) { - count_for_wire_to_ipin_switches[switch_id]++; - if (count_for_wire_to_ipin_switches[switch_id] > most_frequent_switch.second) { - most_frequent_switch.first = switch_id; - most_frequent_switch.second = count_for_wire_to_ipin_switches[switch_id]; - } - } else{ - VTR_ASSERT(rr_graph.node_layer_low(RRNodeId(sink_node)) != rr_graph.node_layer_low(RRNodeId(source_node))); - count_for_wire_to_ipin_switches_between_dice[switch_id]++; - if(count_for_wire_to_ipin_switches_between_dice[switch_id] > most_frequent_switch_between_dice.second){ - most_frequent_switch_between_dice.first = switch_id; - most_frequent_switch_between_dice.second = count_for_wire_to_ipin_switches_between_dice[switch_id]; - } - } - } - } } } - - VTR_ASSERT(wire_to_rr_ipin_switch_ != nullptr); - *wire_to_rr_ipin_switch_ = (RRSwitchId)most_frequent_switch.first; - - VTR_ASSERT(wire_to_rr_ipin_switch_between_dice_ != nullptr); - *wire_to_rr_ipin_switch_between_dice_ = most_frequent_switch_between_dice.first; } inline EdgeWalker get_rr_graph_rr_edges(void*& /*ctx*/) final { @@ -1844,7 +1798,6 @@ class RrGraphSerializer final : public uxsd::RrGraphBase { segment_inf_y_, segment_inf_z_, *rr_indexed_data_, - *wire_to_rr_ipin_switch_, base_cost_type_, echo_enabled_, echo_file_name_); @@ -2194,8 +2147,6 @@ class RrGraphSerializer final : public uxsd::RrGraphBase { std::array side_map_; // Output for loads, and constant data for writes. - RRSwitchId* wire_to_rr_ipin_switch_; - int* wire_to_rr_ipin_switch_between_dice_; t_chan_width* chan_width_; t_rr_graph_storage* rr_nodes_; RRGraphBuilder* rr_graph_builder_; diff --git a/libs/librrgraph/src/io/rr_graph_writer.cpp b/libs/librrgraph/src/io/rr_graph_writer.cpp index 341bb67c41..8cad15b6bd 100644 --- a/libs/librrgraph/src/io/rr_graph_writer.cpp +++ b/libs/librrgraph/src/io/rr_graph_writer.cpp @@ -42,8 +42,6 @@ void write_rr_graph(RRGraphBuilder* rr_graph_builder, RrGraphSerializer reader( /*graph_type=*/e_graph_type(), /*base_cost_type=*/e_base_cost_type(), - /*wire_to_rr_ipin_switch=*/nullptr, - /*wire_to_rr_ipin_switch_between_dice=*/nullptr, /*do_check_rr_graph=*/false, /*read_rr_graph_name=*/nullptr, /*read_rr_graph_filename=*/nullptr, 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 7eb5c5e005..cbd9dc7d37 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 @@ -30,7 +30,6 @@ static void load_rr_indexed_data_base_costs(const RRGraphView& rr_graph, static float get_delay_normalization_fac(const vtr::vector& rr_indexed_data, const bool echo_enabled, const char* echo_file_name); static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph, - const RRSwitchId wire_to_ipin_switch, vtr::vector& rr_indexed_data); /** @@ -87,7 +86,6 @@ void alloc_and_load_rr_indexed_data(const RRGraphView& rr_graph, const std::vector& segment_inf_y, const std::vector& segment_inf_z, vtr::vector& rr_indexed_data, - const RRSwitchId wire_to_ipin_switch, e_base_cost_type base_cost_type, const bool echo_enabled, const char* echo_file_name) { @@ -159,8 +157,7 @@ void alloc_and_load_rr_indexed_data(const RRGraphView& rr_graph, } load_rr_indexed_data_T_values(rr_graph, - wire_to_ipin_switch, - rr_indexed_data); + rr_indexed_data); fixup_rr_indexed_data_T_values(rr_indexed_data, total_num_segment); @@ -515,7 +512,6 @@ static float get_delay_normalization_fac(const vtr::vector& rr_indexed_data) { vtr::vector> fan_in_list = get_fan_in_list(rr_graph); @@ -617,8 +613,7 @@ static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph, { if (ipin_switch_count == 0) { VTR_LOG_WARN("No IPIN switches found. Setting T_linear to 0\n"); - float default_ipin_switch_T_del = rr_graph.rr_switch_inf(RRSwitchId(wire_to_ipin_switch)).Tdel; - rr_indexed_data[RRIndexedDataId(IPIN_COST_INDEX)].T_linear = default_ipin_switch_T_del; + rr_indexed_data[RRIndexedDataId(IPIN_COST_INDEX)].T_linear = 0.0; } else { float average_ipin_switch_T_del = ipin_switch_T_total / ipin_switch_count; rr_indexed_data[RRIndexedDataId(IPIN_COST_INDEX)].T_linear = average_ipin_switch_T_del; diff --git a/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.h b/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.h index 8d60ff93d1..b5411dc9d9 100644 --- a/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.h +++ b/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.h @@ -12,7 +12,6 @@ void alloc_and_load_rr_indexed_data(const RRGraphView& rr_graph, const std::vector& segment_inf_y, const std::vector& segment_inf_z, vtr::vector& rr_indexed_data, - const RRSwitchId wire_to_ipin_switch, e_base_cost_type base_cost_type, const bool echo_enabled, const char* echo_file_name); From fa2d648feddb1f2a070a29ccf448ca5ad9b9ca82 Mon Sep 17 00:00:00 2001 From: Amin Mohaghegh Date: Sat, 22 Nov 2025 09:10:50 -0800 Subject: [PATCH 06/16] [vpr][src] remove use cases of ipin_rr_switch --- vpr/src/base/stats.cpp | 9 +++++--- vpr/src/base/stats.h | 1 - vpr/src/base/vpr_api.cpp | 1 - vpr/src/base/vpr_types.h | 8 ------- .../route/rr_graph_generation/rr_graph.cpp | 22 +++++-------------- vpr/src/route/rr_graph_generation/rr_graph.h | 1 - .../rr_graph_generation/rr_graph_area.cpp | 11 +++++----- .../route/rr_graph_generation/rr_graph_area.h | 1 - .../tileable_rr_graph_builder.cpp | 9 +++++--- .../tileable_rr_graph_builder.h | 1 - 10 files changed, 23 insertions(+), 41 deletions(-) diff --git a/vpr/src/base/stats.cpp b/vpr/src/base/stats.cpp index 2e0cb1b8ff..7b484732d9 100644 --- a/vpr/src/base/stats.cpp +++ b/vpr/src/base/stats.cpp @@ -69,7 +69,6 @@ void routing_stats(const Netlist<>& net_list, float R_minW_pmos, float grid_logic_tile_area, e_directionality directionality, - RRSwitchId wire_to_ipin_switch, bool is_flat) { const DeviceContext& device_ctx = g_vpr_ctx.device(); auto& rr_graph = device_ctx.rr_graph; @@ -116,8 +115,12 @@ void routing_stats(const Netlist<>& net_list, VTR_LOG("\tTotal used logic block area: %g\n", used_area); if (route_type == e_route_type::DETAILED) { - count_routing_transistors(directionality, num_rr_switch, wire_to_ipin_switch, - segment_inf, R_minW_nmos, R_minW_pmos, is_flat); + count_routing_transistors(directionality, + num_rr_switch, + segment_inf, + R_minW_nmos, + R_minW_pmos, + is_flat); get_segment_usage_stats(segment_inf); } diff --git a/vpr/src/base/stats.h b/vpr/src/base/stats.h index d2c6b58fbd..aefc22a052 100644 --- a/vpr/src/base/stats.h +++ b/vpr/src/base/stats.h @@ -21,7 +21,6 @@ void routing_stats(const Netlist<>& net_list, float R_minW_pmos, float grid_logic_tile_area, e_directionality directionality, - RRSwitchId wire_to_ipin_switch, bool is_flat); void print_wirelen_prob_dist(bool is_flat); diff --git a/vpr/src/base/vpr_api.cpp b/vpr/src/base/vpr_api.cpp index 9dc4d353ae..1867659297 100644 --- a/vpr/src/base/vpr_api.cpp +++ b/vpr/src/base/vpr_api.cpp @@ -1500,7 +1500,6 @@ void vpr_analysis(const Netlist<>& net_list, vpr_setup.RoutingArch.R_minW_pmos, Arch.grid_logic_tile_area, vpr_setup.RoutingArch.directionality, - vpr_setup.RoutingArch.wire_to_rr_ipin_switch, is_flat); if (vpr_setup.TimingEnabled) { diff --git a/vpr/src/base/vpr_types.h b/vpr/src/base/vpr_types.h index 2d0c68b766..80a662ad5b 100644 --- a/vpr/src/base/vpr_types.h +++ b/vpr/src/base/vpr_types.h @@ -1493,14 +1493,6 @@ struct t_det_routing_arch { /// wires from another die to ipins in different die int wire_to_arch_ipin_switch_between_dice = -1; - /// keeps track of the type of RR graph switch - /// that connects wires to ipins in the RR graph - RRSwitchId wire_to_rr_ipin_switch; - - /// keeps track of the type of RR graph switch that connects wires - /// from another die to ipins in different die in the RR graph - int wire_to_rr_ipin_switch_between_dice = -1; - /// Resistance (in Ohms) of a minimum width nmos transistor. /// Used only in the FPGA area model. float R_minW_nmos; diff --git a/vpr/src/route/rr_graph_generation/rr_graph.cpp b/vpr/src/route/rr_graph_generation/rr_graph.cpp index cd4e3a5fd4..506a35aa97 100644 --- a/vpr/src/route/rr_graph_generation/rr_graph.cpp +++ b/vpr/src/route/rr_graph_generation/rr_graph.cpp @@ -366,7 +366,6 @@ static void build_rr_graph(e_graph_type graph_type, const std::vector& directs, const std::vector& scatter_gather_patterns, const std::vector& interposer_inf, - RRSwitchId& wire_to_rr_ipin_switch, bool is_flat, int* Warnings, const int route_verbosity); @@ -455,8 +454,6 @@ void create_rr_graph(e_graph_type graph_type, device_ctx.arch, &mutable_device_ctx.chan_width, router_opts.base_cost_type, - &det_routing_arch.wire_to_rr_ipin_switch, - &det_routing_arch.wire_to_arch_ipin_switch_between_dice, det_routing_arch.read_rr_graph_filename.c_str(), &mutable_device_ctx.loaded_rr_graph_filename, router_opts.read_rr_edge_metadata, @@ -492,7 +489,6 @@ void create_rr_graph(e_graph_type graph_type, directs, device_ctx.arch->scatter_gather_patterns, device_ctx.arch->grid_layout().layers, - det_routing_arch.wire_to_rr_ipin_switch, is_flat, Warnings, router_opts.route_verbosity); @@ -512,7 +508,6 @@ void create_rr_graph(e_graph_type graph_type, det_routing_arch.R_minW_pmos, router_opts.base_cost_type, directs, - det_routing_arch.wire_to_rr_ipin_switch, det_routing_arch.shrink_boundary, // Shrink to the smallest boundary, no routing wires for empty zone det_routing_arch.perimeter_cb, // Now I/O or any programmable blocks on perimeter can have full cb access (both cbx and cby) det_routing_arch.through_channel, // Allow/Prohibit through tracks across multi-height and multi-width grids @@ -693,7 +688,6 @@ static void build_rr_graph(e_graph_type graph_type, const std::vector& directs, const std::vector& scatter_gather_patterns, const std::vector& interposer_inf, - RRSwitchId& wire_to_rr_ipin_switch, bool is_flat, int* Warnings, const int route_verbosity) { @@ -1115,9 +1109,7 @@ static void build_rr_graph(e_graph_type graph_type, g_vpr_ctx.mutable_device().switch_fanin_remap, device_ctx.all_sw_inf, R_minW_nmos, - R_minW_pmos, - wire_to_arch_ipin_switch, - wire_to_rr_ipin_switch); + R_minW_pmos); // Partition the rr graph edges for efficient access to configurable/non-configurable // edge subsets. Must be done after RR switches have been allocated @@ -1126,7 +1118,7 @@ static void build_rr_graph(e_graph_type graph_type, // Save the channel widths for the newly constructed graph device_ctx.chan_width = nodes_per_chan; - rr_graph_externals(segment_inf, segment_inf_x, segment_inf_y, segment_inf_z, wire_to_rr_ipin_switch, base_cost_type); + rr_graph_externals(segment_inf, segment_inf_x, segment_inf_y, segment_inf_z, base_cost_type); const VibDeviceGrid vib_grid; check_rr_graph(device_ctx.rr_graph, @@ -1236,14 +1228,11 @@ void build_tile_rr_graph(RRGraphBuilder& rr_graph_builder, delayless_switch); t_arch_switch_fanin switch_fanin_remap; - RRSwitchId dummy_sw_id; alloc_and_load_rr_switch_inf(rr_graph_builder, switch_fanin_remap, sw_map, det_routing_arch.R_minW_nmos, - det_routing_arch.R_minW_pmos, - det_routing_arch.wire_to_arch_ipin_switch, - dummy_sw_id); + det_routing_arch.R_minW_pmos); rr_graph_builder.partition_edges(); } @@ -1251,7 +1240,6 @@ void rr_graph_externals(const std::vector& segment_inf, const std::vector& segment_inf_x, const std::vector& segment_inf_y, const std::vector& segment_inf_z, - RRSwitchId wire_to_rr_ipin_switch, e_base_cost_type base_cost_type) { const DeviceContext& device_ctx = g_vpr_ctx.device(); const RRGraphView& rr_graph = device_ctx.rr_graph; @@ -1260,9 +1248,9 @@ void rr_graph_externals(const std::vector& segment_inf, vtr::vector& rr_indexed_data = mutable_device_ctx.rr_indexed_data; bool echo_enabled = getEchoEnabled() && isEchoFileEnabled(E_ECHO_RR_GRAPH_INDEXED_DATA); const char* echo_file_name = getEchoFileName(E_ECHO_RR_GRAPH_INDEXED_DATA); - add_rr_graph_C_from_switches(rr_graph.rr_switch_inf(wire_to_rr_ipin_switch).Cin); + add_rr_graph_C_from_switches(); alloc_and_load_rr_indexed_data(rr_graph, grid, segment_inf, segment_inf_x, segment_inf_y, segment_inf_z, - rr_indexed_data, wire_to_rr_ipin_switch, base_cost_type, echo_enabled, echo_file_name); + rr_indexed_data, base_cost_type, echo_enabled, echo_file_name); //load_rr_index_segments(segment_inf.size()); } diff --git a/vpr/src/route/rr_graph_generation/rr_graph.h b/vpr/src/route/rr_graph_generation/rr_graph.h index fd4fefdc1e..96793b1b20 100644 --- a/vpr/src/route/rr_graph_generation/rr_graph.h +++ b/vpr/src/route/rr_graph_generation/rr_graph.h @@ -47,7 +47,6 @@ void rr_graph_externals(const std::vector& segment_inf, const std::vector& segment_inf_x, const std::vector& segment_inf_y, const std::vector& segment_inf_z, - RRSwitchId wire_to_rr_ipin_switch, e_base_cost_type base_cost_type); std::vector> alloc_and_load_actual_fc(const std::vector& types, diff --git a/vpr/src/route/rr_graph_generation/rr_graph_area.cpp b/vpr/src/route/rr_graph_generation/rr_graph_area.cpp index dec6784c14..f7eb729f89 100644 --- a/vpr/src/route/rr_graph_generation/rr_graph_area.cpp +++ b/vpr/src/route/rr_graph_generation/rr_graph_area.cpp @@ -205,11 +205,11 @@ static void count_bidir_routing_transistors(int num_switch, float R_minW_nmos, f break; case e_rr_type::IPIN: - RRSwitchId switch_id = RRSwitchId(rr_graph.edge_switch(RRNodeId(from_node), iedge)); - if (ipin_switch_count.find(switch_id) == ipin_switch_count.end()) { - ipin_switch_count[switch_id] = 0; + iswitch = rr_graph.edge_switch(RRNodeId(from_node), iedge); + if (ipin_switch_count.find(RRSwitchId(iswitch)) == ipin_switch_count.end()) { + ipin_switch_count[RRSwitchId(iswitch)] = 0; } - ipin_switch_count[switch_id]++; + ipin_switch_count[RRSwitchId(iswitch)]++; num_inputs_to_cblock[to_node]++; max_inputs_to_cblock = std::max(max_inputs_to_cblock, num_inputs_to_cblock[to_node]); @@ -369,6 +369,7 @@ static void count_unidir_routing_transistors(std::vector& /*segme ntrans = 0; std::unordered_map ipin_switch_count; + RRSwitchId switch_id; for (const RRNodeId from_rr_node : device_ctx.rr_graph.nodes()) { size_t from_node = size_t(from_rr_node); from_rr_type = rr_graph.node_type(from_rr_node); @@ -436,7 +437,7 @@ static void count_unidir_routing_transistors(std::vector& /*segme break; case e_rr_type::IPIN: - RRSwitchId switch_id = RRSwitchId(rr_graph.edge_switch(RRNodeId(from_node), iedge)); + switch_id = RRSwitchId(rr_graph.edge_switch(RRNodeId(from_node), iedge)); if (ipin_switch_count.find(switch_id) == ipin_switch_count.end()) { ipin_switch_count[switch_id] = 0; } diff --git a/vpr/src/route/rr_graph_generation/rr_graph_area.h b/vpr/src/route/rr_graph_generation/rr_graph_area.h index 014ef24717..51db3ab63c 100644 --- a/vpr/src/route/rr_graph_generation/rr_graph_area.h +++ b/vpr/src/route/rr_graph_generation/rr_graph_area.h @@ -5,7 +5,6 @@ void count_routing_transistors(enum e_directionality directionality, int num_switch, - RRSwitchId wire_to_ipin_switch, std::vector& segment_inf, float R_minW_nmos, float R_minW_pmos, diff --git a/vpr/src/route/rr_graph_generation/tileable_rr_graph/tileable_rr_graph_builder.cpp b/vpr/src/route/rr_graph_generation/tileable_rr_graph/tileable_rr_graph_builder.cpp index 4c9369b9d8..26d4f891d6 100644 --- a/vpr/src/route/rr_graph_generation/tileable_rr_graph/tileable_rr_graph_builder.cpp +++ b/vpr/src/route/rr_graph_generation/tileable_rr_graph/tileable_rr_graph_builder.cpp @@ -82,7 +82,6 @@ void build_tileable_unidir_rr_graph(const std::vector& typ const float R_minW_pmos, const e_base_cost_type& base_cost_type, const std::vector& directs, - RRSwitchId& wire_to_rr_ipin_switch, const bool& shrink_boundary, const bool& perimeter_cb, const bool& through_channel, @@ -276,7 +275,11 @@ void build_tileable_unidir_rr_graph(const std::vector& typ // Allocate and load routing resource switches, which are derived from the switches from the architecture file, // based on their fanin in the rr graph. This routine also adjusts the rr nodes to point to these new rr switches device_ctx.rr_graph_builder.init_fan_in(); - alloc_and_load_rr_switch_inf(device_ctx.rr_graph_builder, device_ctx.switch_fanin_remap, device_ctx.all_sw_inf, R_minW_nmos, R_minW_pmos, wire_to_arch_ipin_switch, wire_to_rr_ipin_switch); + alloc_and_load_rr_switch_inf(device_ctx.rr_graph_builder, + device_ctx.switch_fanin_remap, + device_ctx.all_sw_inf, + R_minW_nmos, + R_minW_pmos); // Save the channel widths for the newly constructed graph device_ctx.chan_width = chan_width; @@ -291,7 +294,7 @@ void build_tileable_unidir_rr_graph(const std::vector& typ // Allocate external data structures // a. cost_index // b. RC tree - rr_graph_externals(segment_inf, segment_inf_x, segment_inf_y, segment_inf_z, wire_to_rr_ipin_switch, base_cost_type); + rr_graph_externals(segment_inf, segment_inf_x, segment_inf_y, segment_inf_z, base_cost_type); // Sanitizer for the rr_graph, check connectivities of rr_nodes // Essential check for rr_graph, build look-up and diff --git a/vpr/src/route/rr_graph_generation/tileable_rr_graph/tileable_rr_graph_builder.h b/vpr/src/route/rr_graph_generation/tileable_rr_graph/tileable_rr_graph_builder.h index 5b3894fc5b..5ddb5667d6 100644 --- a/vpr/src/route/rr_graph_generation/tileable_rr_graph/tileable_rr_graph_builder.h +++ b/vpr/src/route/rr_graph_generation/tileable_rr_graph/tileable_rr_graph_builder.h @@ -27,7 +27,6 @@ void build_tileable_unidir_rr_graph(const std::vector& typ const float R_minW_pmos, const e_base_cost_type& base_cost_type, const std::vector& directs, - RRSwitchId& wire_to_rr_ipin_switch, const bool& shrink_boundary, const bool& perimeter_cb, const bool& through_channel, From aff8af4aade9f0d2f85939a3fed84cac6c5f499d Mon Sep 17 00:00:00 2001 From: Amin Mohaghegh Date: Sat, 22 Nov 2025 14:21:49 -0800 Subject: [PATCH 07/16] [vpr][route][rr_graph] fix uninitialized var --- vpr/src/route/rr_graph_generation/rr_graph_timing_params.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vpr/src/route/rr_graph_generation/rr_graph_timing_params.cpp b/vpr/src/route/rr_graph_generation/rr_graph_timing_params.cpp index 6f9b04ae53..601e1d0797 100644 --- a/vpr/src/route/rr_graph_generation/rr_graph_timing_params.cpp +++ b/vpr/src/route/rr_graph_generation/rr_graph_timing_params.cpp @@ -57,9 +57,8 @@ void add_rr_graph_C_from_switches() { for (t_edge_size iedge = 0; iedge < rr_graph.num_edges(rr_id); iedge++) { to_node = size_t(rr_graph.edge_sink_node(rr_id, iedge)); to_rr_type = rr_graph.node_type(RRNodeId(to_node)); - + switch_index = rr_graph.edge_switch(rr_id, iedge); if (to_rr_type == e_rr_type::CHANX || to_rr_type == e_rr_type::CHANY) { - switch_index = rr_graph.edge_switch(rr_id, iedge); Cin = rr_graph.rr_switch_inf(RRSwitchId(switch_index)).Cin; Cout = rr_graph.rr_switch_inf(RRSwitchId(switch_index)).Cout; buffered = rr_graph.rr_switch_inf(RRSwitchId(switch_index)).buffered(); From e7f5c8720bfe4bcaa7853f3279fe9fc6a7c3f273 Mon Sep 17 00:00:00 2001 From: Amin Mohaghegh Date: Sat, 22 Nov 2025 14:34:36 -0800 Subject: [PATCH 08/16] make format --- libs/librtlnumber/src/include/internal_bits.hpp | 8 ++++---- vpr/src/route/rr_graph_generation/rr_graph_area.cpp | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/libs/librtlnumber/src/include/internal_bits.hpp b/libs/librtlnumber/src/include/internal_bits.hpp index ba9bd6016e..48df47f515 100644 --- a/libs/librtlnumber/src/include/internal_bits.hpp +++ b/libs/librtlnumber/src/include/internal_bits.hpp @@ -27,14 +27,14 @@ constexpr short integer_t_size = (sizeof(integer_t) * 8); } #define unroll_1d(lut) \ - { lut[_0], lut[_1], lut[_x], lut[_z] } + {lut[_0], lut[_1], lut[_x], lut[_z]} #define unroll_2d(lut) \ - { unroll_1d(lut[_0]), unroll_1d(lut[_1]), unroll_1d(lut[_x]), unroll_1d(lut[_z]) } + {unroll_1d(lut[_0]), unroll_1d(lut[_1]), unroll_1d(lut[_x]), unroll_1d(lut[_z])} #define unroll_1d_invert(lut) \ - { l_not[lut[_0]], l_not[lut[_1]], l_not[lut[_x]], l_not[lut[_z]] } + {l_not[lut[_0]], l_not[lut[_1]], l_not[lut[_x]], l_not[lut[_z]]} #define unroll_2d_invert(lut) \ - { unroll_1d_invert(lut[_0]), unroll_1d_invert(lut[_1]), unroll_1d_invert(lut[_x]), unroll_1d_invert(lut[_z]) } + {unroll_1d_invert(lut[_0]), unroll_1d_invert(lut[_1]), unroll_1d_invert(lut[_x]), unroll_1d_invert(lut[_z])} namespace BitSpace { typedef uint8_t bit_value_t; diff --git a/vpr/src/route/rr_graph_generation/rr_graph_area.cpp b/vpr/src/route/rr_graph_generation/rr_graph_area.cpp index f7eb729f89..d0cfd8f1fc 100644 --- a/vpr/src/route/rr_graph_generation/rr_graph_area.cpp +++ b/vpr/src/route/rr_graph_generation/rr_graph_area.cpp @@ -161,7 +161,7 @@ static void count_bidir_routing_transistors(int num_switch, float R_minW_nmos, f sharable_switch_trans = alloc_and_load_sharable_switch_trans(num_switch, R_minW_nmos, R_minW_pmos); - + std::unordered_map ipin_switch_count; for (const RRNodeId from_rr_node : device_ctx.rr_graph.nodes()) { @@ -293,8 +293,9 @@ static void count_bidir_routing_transistors(int num_switch, float R_minW_nmos, f RRSwitchId most_frequent_ipin_switch = std::max_element(ipin_switch_count.begin(), ipin_switch_count.end(), [](const auto& a, const auto& b) { - return a.second < b.second; - })->first; + return a.second < b.second; + }) + ->first; input_cblock_trans = get_cblock_trans(num_inputs_to_cblock, most_frequent_ipin_switch, max_inputs_to_cblock, @@ -491,8 +492,8 @@ static void count_unidir_routing_transistors(std::vector& /*segme // Get most frequent ipin switch RRSwitchId most_frequent_ipin_switch = std::max_element(ipin_switch_count.begin(), ipin_switch_count.end(), [](const auto& a, const auto& b) { - return a.second < b.second; - })->first; + return a.second < b.second; + })->first; input_cblock_trans = get_cblock_trans(num_inputs_to_cblock, most_frequent_ipin_switch, From 8297b339c36f2ee9505c30cf656e9ef4fd755af1 Mon Sep 17 00:00:00 2001 From: Amin Mohaghegh Date: Sat, 22 Nov 2025 14:50:35 -0800 Subject: [PATCH 09/16] make format --- libs/librtlnumber/src/include/internal_bits.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/librtlnumber/src/include/internal_bits.hpp b/libs/librtlnumber/src/include/internal_bits.hpp index 48df47f515..59354ada41 100644 --- a/libs/librtlnumber/src/include/internal_bits.hpp +++ b/libs/librtlnumber/src/include/internal_bits.hpp @@ -27,14 +27,14 @@ constexpr short integer_t_size = (sizeof(integer_t) * 8); } #define unroll_1d(lut) \ - {lut[_0], lut[_1], lut[_x], lut[_z]} + { lut[_0], lut[_1], lut[_x], lut[_z]} #define unroll_2d(lut) \ - {unroll_1d(lut[_0]), unroll_1d(lut[_1]), unroll_1d(lut[_x]), unroll_1d(lut[_z])} + { unroll_1d(lut[_0]), unroll_1d(lut[_1]), unroll_1d(lut[_x]), unroll_1d(lut[_z])} #define unroll_1d_invert(lut) \ - {l_not[lut[_0]], l_not[lut[_1]], l_not[lut[_x]], l_not[lut[_z]]} + { l_not[lut[_0]], l_not[lut[_1]], l_not[lut[_x]], l_not[lut[_z]]} #define unroll_2d_invert(lut) \ - {unroll_1d_invert(lut[_0]), unroll_1d_invert(lut[_1]), unroll_1d_invert(lut[_x]), unroll_1d_invert(lut[_z])} + { unroll_1d_invert(lut[_0]), unroll_1d_invert(lut[_1]), unroll_1d_invert(lut[_x]), unroll_1d_invert(lut[_z])} namespace BitSpace { typedef uint8_t bit_value_t; From 03de4fb914d3640f5db5ddf696a0c90589e24564 Mon Sep 17 00:00:00 2001 From: Amin Mohaghegh Date: Sat, 22 Nov 2025 14:55:55 -0800 Subject: [PATCH 10/16] make format --- libs/librtlnumber/src/include/internal_bits.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/librtlnumber/src/include/internal_bits.hpp b/libs/librtlnumber/src/include/internal_bits.hpp index 59354ada41..ba9bd6016e 100644 --- a/libs/librtlnumber/src/include/internal_bits.hpp +++ b/libs/librtlnumber/src/include/internal_bits.hpp @@ -27,14 +27,14 @@ constexpr short integer_t_size = (sizeof(integer_t) * 8); } #define unroll_1d(lut) \ - { lut[_0], lut[_1], lut[_x], lut[_z]} + { lut[_0], lut[_1], lut[_x], lut[_z] } #define unroll_2d(lut) \ - { unroll_1d(lut[_0]), unroll_1d(lut[_1]), unroll_1d(lut[_x]), unroll_1d(lut[_z])} + { unroll_1d(lut[_0]), unroll_1d(lut[_1]), unroll_1d(lut[_x]), unroll_1d(lut[_z]) } #define unroll_1d_invert(lut) \ - { l_not[lut[_0]], l_not[lut[_1]], l_not[lut[_x]], l_not[lut[_z]]} + { l_not[lut[_0]], l_not[lut[_1]], l_not[lut[_x]], l_not[lut[_z]] } #define unroll_2d_invert(lut) \ - { unroll_1d_invert(lut[_0]), unroll_1d_invert(lut[_1]), unroll_1d_invert(lut[_x]), unroll_1d_invert(lut[_z])} + { unroll_1d_invert(lut[_0]), unroll_1d_invert(lut[_1]), unroll_1d_invert(lut[_x]), unroll_1d_invert(lut[_z]) } namespace BitSpace { typedef uint8_t bit_value_t; From eee4269ad38a48fe8045ed1f5d49ba611e0da5e0 Mon Sep 17 00:00:00 2001 From: Amin Mohaghegh Date: Tue, 25 Nov 2025 07:35:30 -0800 Subject: [PATCH 11/16] [lib][rr_graph] use std::ranges::max instead std::max --- libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 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 cbd9dc7d37..6490e9e4ba 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 @@ -156,8 +156,7 @@ void alloc_and_load_rr_indexed_data(const RRGraphView& rr_graph, rr_indexed_data[index].seg_index = seg_ptr->seg_index; } - load_rr_indexed_data_T_values(rr_graph, - rr_indexed_data); + load_rr_indexed_data_T_values(rr_graph, rr_indexed_data); fixup_rr_indexed_data_T_values(rr_indexed_data, total_num_segment); From f27ce5d5f86c11429358d934be48a7627cdf51ca Mon Sep 17 00:00:00 2001 From: Amin Mohaghegh Date: Tue, 25 Nov 2025 07:37:56 -0800 Subject: [PATCH 12/16] [lib][rr_graph] fix a typo --- .../rr_graph_generation/rr_graph_area.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/vpr/src/route/rr_graph_generation/rr_graph_area.cpp b/vpr/src/route/rr_graph_generation/rr_graph_area.cpp index d0cfd8f1fc..863bd1e63a 100644 --- a/vpr/src/route/rr_graph_generation/rr_graph_area.cpp +++ b/vpr/src/route/rr_graph_generation/rr_graph_area.cpp @@ -290,12 +290,11 @@ static void count_bidir_routing_transistors(int num_switch, float R_minW_nmos, f /* Now add in the input connection block transistors. */ // Get most frequent ipin switch - RRSwitchId most_frequent_ipin_switch = std::max_element(ipin_switch_count.begin(), - ipin_switch_count.end(), - [](const auto& a, const auto& b) { - return a.second < b.second; - }) - ->first; + std::pair most_frequent_ipin_switch_pair = std::ranges::max(ipin_switch_count, + {}, + [](const auto& p) { return p.second; }); + RRSwitchId most_frequent_ipin_switch = most_frequent_ipin_switch_pair.first; + input_cblock_trans = get_cblock_trans(num_inputs_to_cblock, most_frequent_ipin_switch, max_inputs_to_cblock, @@ -491,9 +490,10 @@ static void count_unidir_routing_transistors(std::vector& /*segme /* Now add in the input connection block transistors. */ // Get most frequent ipin switch - RRSwitchId most_frequent_ipin_switch = std::max_element(ipin_switch_count.begin(), ipin_switch_count.end(), [](const auto& a, const auto& b) { - return a.second < b.second; - })->first; + std::pair most_frequent_ipin_switch_pair = std::ranges::max(ipin_switch_count, + {}, + [](const auto& p) { return p.second; }); + RRSwitchId most_frequent_ipin_switch = most_frequent_ipin_switch_pair.first; input_cblock_trans = get_cblock_trans(num_inputs_to_cblock, most_frequent_ipin_switch, From 2f84367c7dd675f98f6f8d974f245362572182d4 Mon Sep 17 00:00:00 2001 From: Amin Mohaghegh Date: Tue, 25 Nov 2025 07:47:44 -0800 Subject: [PATCH 13/16] make format --- vpr/src/route/rr_graph_generation/rr_graph_area.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vpr/src/route/rr_graph_generation/rr_graph_area.cpp b/vpr/src/route/rr_graph_generation/rr_graph_area.cpp index 863bd1e63a..83acc693c7 100644 --- a/vpr/src/route/rr_graph_generation/rr_graph_area.cpp +++ b/vpr/src/route/rr_graph_generation/rr_graph_area.cpp @@ -291,8 +291,8 @@ static void count_bidir_routing_transistors(int num_switch, float R_minW_nmos, f // Get most frequent ipin switch std::pair most_frequent_ipin_switch_pair = std::ranges::max(ipin_switch_count, - {}, - [](const auto& p) { return p.second; }); + {}, + [](const auto& p) { return p.second; }); RRSwitchId most_frequent_ipin_switch = most_frequent_ipin_switch_pair.first; input_cblock_trans = get_cblock_trans(num_inputs_to_cblock, From 109e4755f9d3948fdc823e049adf28d35d1db502 Mon Sep 17 00:00:00 2001 From: Amin Mohaghegh Date: Tue, 25 Nov 2025 08:22:03 -0800 Subject: [PATCH 14/16] [vpr][route][crr] fix the problem with ranges::max_element --- .../rr_graph_generation/rr_graph_area.cpp | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/vpr/src/route/rr_graph_generation/rr_graph_area.cpp b/vpr/src/route/rr_graph_generation/rr_graph_area.cpp index 83acc693c7..f9570438a4 100644 --- a/vpr/src/route/rr_graph_generation/rr_graph_area.cpp +++ b/vpr/src/route/rr_graph_generation/rr_graph_area.cpp @@ -290,10 +290,12 @@ static void count_bidir_routing_transistors(int num_switch, float R_minW_nmos, f /* Now add in the input connection block transistors. */ // Get most frequent ipin switch - std::pair most_frequent_ipin_switch_pair = std::ranges::max(ipin_switch_count, - {}, - [](const auto& p) { return p.second; }); - RRSwitchId most_frequent_ipin_switch = most_frequent_ipin_switch_pair.first; + auto most_frequent_ipin_switch_it = std::ranges::max_element( + ipin_switch_count, + [](const auto& a, const auto& b) noexcept { return a.second < b.second; } + ); + VTR_ASSERT(most_frequent_ipin_switch_it != ipin_switch_count.end()); + RRSwitchId most_frequent_ipin_switch = most_frequent_ipin_switch_it->first; input_cblock_trans = get_cblock_trans(num_inputs_to_cblock, most_frequent_ipin_switch, @@ -490,10 +492,12 @@ static void count_unidir_routing_transistors(std::vector& /*segme /* Now add in the input connection block transistors. */ // Get most frequent ipin switch - std::pair most_frequent_ipin_switch_pair = std::ranges::max(ipin_switch_count, - {}, - [](const auto& p) { return p.second; }); - RRSwitchId most_frequent_ipin_switch = most_frequent_ipin_switch_pair.first; + auto most_frequent_ipin_switch_it = std::ranges::max_element( + ipin_switch_count, + [](const auto& a, const auto& b) noexcept { return a.second < b.second; } + ); + VTR_ASSERT(most_frequent_ipin_switch_it != ipin_switch_count.end()); + RRSwitchId most_frequent_ipin_switch = most_frequent_ipin_switch_it->first; input_cblock_trans = get_cblock_trans(num_inputs_to_cblock, most_frequent_ipin_switch, From b531af8078e61d1efa08b8e0776e968dea724ff5 Mon Sep 17 00:00:00 2001 From: Amin Mohaghegh Date: Tue, 25 Nov 2025 08:25:08 -0800 Subject: [PATCH 15/16] make format --- vpr/src/route/rr_graph_generation/rr_graph_area.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/vpr/src/route/rr_graph_generation/rr_graph_area.cpp b/vpr/src/route/rr_graph_generation/rr_graph_area.cpp index f9570438a4..dc970da0d3 100644 --- a/vpr/src/route/rr_graph_generation/rr_graph_area.cpp +++ b/vpr/src/route/rr_graph_generation/rr_graph_area.cpp @@ -292,8 +292,7 @@ static void count_bidir_routing_transistors(int num_switch, float R_minW_nmos, f // Get most frequent ipin switch auto most_frequent_ipin_switch_it = std::ranges::max_element( ipin_switch_count, - [](const auto& a, const auto& b) noexcept { return a.second < b.second; } - ); + [](const auto& a, const auto& b) noexcept { return a.second < b.second; }); VTR_ASSERT(most_frequent_ipin_switch_it != ipin_switch_count.end()); RRSwitchId most_frequent_ipin_switch = most_frequent_ipin_switch_it->first; @@ -494,8 +493,7 @@ static void count_unidir_routing_transistors(std::vector& /*segme // Get most frequent ipin switch auto most_frequent_ipin_switch_it = std::ranges::max_element( ipin_switch_count, - [](const auto& a, const auto& b) noexcept { return a.second < b.second; } - ); + [](const auto& a, const auto& b) noexcept { return a.second < b.second; }); VTR_ASSERT(most_frequent_ipin_switch_it != ipin_switch_count.end()); RRSwitchId most_frequent_ipin_switch = most_frequent_ipin_switch_it->first; From 03307ec857b2ece8ffd73b3c37bcde1941ccaabd Mon Sep 17 00:00:00 2001 From: Amin Mohaghegh Date: Tue, 25 Nov 2025 09:57:53 -0800 Subject: [PATCH 16/16] [vpr][route][rr_graph] change comparator-based range to projection-based --- vpr/src/route/rr_graph_generation/rr_graph_area.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/vpr/src/route/rr_graph_generation/rr_graph_area.cpp b/vpr/src/route/rr_graph_generation/rr_graph_area.cpp index dc970da0d3..96715ca4f2 100644 --- a/vpr/src/route/rr_graph_generation/rr_graph_area.cpp +++ b/vpr/src/route/rr_graph_generation/rr_graph_area.cpp @@ -290,9 +290,7 @@ static void count_bidir_routing_transistors(int num_switch, float R_minW_nmos, f /* Now add in the input connection block transistors. */ // Get most frequent ipin switch - auto most_frequent_ipin_switch_it = std::ranges::max_element( - ipin_switch_count, - [](const auto& a, const auto& b) noexcept { return a.second < b.second; }); + auto most_frequent_ipin_switch_it = std::ranges::max_element(ipin_switch_count, {}, [](const auto& p) noexcept { return p.second; }); VTR_ASSERT(most_frequent_ipin_switch_it != ipin_switch_count.end()); RRSwitchId most_frequent_ipin_switch = most_frequent_ipin_switch_it->first; @@ -491,9 +489,7 @@ static void count_unidir_routing_transistors(std::vector& /*segme /* Now add in the input connection block transistors. */ // Get most frequent ipin switch - auto most_frequent_ipin_switch_it = std::ranges::max_element( - ipin_switch_count, - [](const auto& a, const auto& b) noexcept { return a.second < b.second; }); + auto most_frequent_ipin_switch_it = std::ranges::max_element(ipin_switch_count, {}, [](const auto& p) noexcept { return p.second; }); VTR_ASSERT(most_frequent_ipin_switch_it != ipin_switch_count.end()); RRSwitchId most_frequent_ipin_switch = most_frequent_ipin_switch_it->first;