@@ -360,30 +360,6 @@ static void build_rr_graph(e_graph_type graph_type,
360360static int get_delayless_switch_id (const t_det_routing_arch& det_routing_arch,
361361 bool load_rr_graph);
362362
363- /* *
364- * @brief Adds and connects non-3D scatter–gather (SG) links to the RR graph.
365- *
366- * For each bottleneck link, this function creates a corresponding RR node
367- * representing the non-3D SG link, and records edges between the node and
368- * gather and scatter wires. The edges are stored in `non_3d_sg_rr_edges_to_create`
369- * for deferred creation.
370- *
371- * @param rr_graph_builder Reference to the RR graph builder.
372- * @param sg_links List of scatter–gather bottleneck links.
373- * @param sg_node_indices RR node IDs and track numbers for SG links.
374- * @param chan_details_x Channel details for CHANX segments.
375- * @param chan_details_y Channel details for CHANY segments.
376- * @param num_seg_types_x Number of segment types in the X direction.
377- * @param non_3d_sg_rr_edges_to_create Set collecting RR edges to create later.
378- */
379- static void add_and_connect_non_3d_sg_links (RRGraphBuilder& rr_graph_builder,
380- const std::vector<t_bottleneck_link>& sg_links,
381- const std::vector<std::pair<RRNodeId, int >>& sg_node_indices,
382- const t_chan_details& chan_details_x,
383- const t_chan_details& chan_details_y,
384- size_t num_seg_types_x,
385- t_rr_edge_info_set& non_3d_sg_rr_edges_to_create);
386-
387363/* *
388364 * @brief Calculates the routing channel width at each grid location.
389365 *
@@ -2001,92 +1977,6 @@ static void build_rr_chan(RRGraphBuilder& rr_graph_builder,
20011977 }
20021978}
20031979
2004- static void add_and_connect_non_3d_sg_links (RRGraphBuilder& rr_graph_builder,
2005- const std::vector<t_bottleneck_link>& sg_links,
2006- const std::vector<std::pair<RRNodeId, int >>& sg_node_indices,
2007- const t_chan_details& chan_details_x,
2008- const t_chan_details& chan_details_y,
2009- size_t num_seg_types_x,
2010- t_rr_edge_info_set& non_3d_sg_rr_edges_to_create) {
2011- // Each SG link should have a corresponding RR node index
2012- VTR_ASSERT (sg_links.size () == sg_node_indices.size ());
2013- const size_t num_links = sg_links.size ();
2014-
2015- for (size_t i = 0 ; i < num_links; i++) {
2016-
2017- const t_bottleneck_link& link = sg_links[i];
2018-
2019- int xlow, xhigh, ylow, yhigh;
2020- Direction direction;
2021- e_rr_type chan_type;
2022- const t_physical_tile_loc& src_loc = link.gather_loc ;
2023- const t_physical_tile_loc& dst_loc = link.scatter_loc ;
2024-
2025- // Step 1: Determine the link’s direction and its spatial span.
2026- // SG links are confined to one layer (non-3D), but can run in X or Y.
2027- VTR_ASSERT_SAFE (src_loc.layer_num == dst_loc.layer_num );
2028- const int layer = src_loc.layer_num ;
2029- compute_non_3d_sg_link_geometry (src_loc, dst_loc, chan_type, xlow, xhigh, ylow, yhigh,direction);
2030-
2031- // Retrieve the node ID and track number allocated earlier
2032- const RRNodeId node_id = sg_node_indices[i].first ;
2033- const int track_num = sg_node_indices[i].second ;
2034-
2035- // Step 2: Assign coordinates
2036- rr_graph_builder.set_node_layer (node_id, layer, layer);
2037- rr_graph_builder.set_node_coordinates (node_id, xlow, ylow, xhigh, yhigh);
2038- rr_graph_builder.set_node_capacity (node_id, 1 );
2039-
2040- // Step 3: Set cost index based on segment type and orientation
2041- const size_t cons_index = link.chan_type == e_rr_type::CHANX ? CHANX_COST_INDEX_START + link.parallel_segment_index
2042- : CHANX_COST_INDEX_START + num_seg_types_x + link.parallel_segment_index ;
2043- rr_graph_builder.set_node_cost_index (node_id, RRIndexedDataId (cons_index));
2044-
2045- // Step 4: Assign electrical characteristics
2046- const NodeRCIndex rc_index = find_create_rr_rc_data (link.R_metal , link.C_metal , g_vpr_ctx.mutable_device ().rr_rc_data );
2047- rr_graph_builder.set_node_rc_index (node_id, rc_index);
2048- // Step 5: Set node type, track number, and direction
2049- rr_graph_builder.set_node_type (node_id, link.chan_type );
2050- rr_graph_builder.set_node_track_num (node_id, track_num);
2051- rr_graph_builder.set_node_direction (node_id, direction);
2052-
2053- // Step 6: Add incoming edges from gather (fanin) channel wires
2054- // Each gather wire connects to this SG link node using the SG wire switch.
2055- for (const t_sg_candidate& gather_wire : link.gather_fanin_connections ) {
2056- const t_physical_tile_loc& chan_loc = gather_wire.chan_loc .location ;
2057- e_rr_type gather_chan_type = gather_wire.chan_loc .chan_type ;
2058-
2059- // Locate the source RR node for this gather wire
2060- RRNodeId gather_node = rr_graph_builder.node_lookup ().find_node (chan_loc.layer_num ,
2061- chan_loc.x ,
2062- chan_loc.y ,
2063- gather_chan_type,
2064- gather_wire.wire_switchpoint .wire );
2065- // Record deferred edge creation (gather_node --> sg_node)
2066- non_3d_sg_rr_edges_to_create.emplace_back (gather_node, node_id, link.arch_wire_switch , false );
2067- }
2068-
2069- // Step 7: Add outgoing edges to scatter (fanout) channel wires
2070- // Each scatter wire connects from this SG link node outward.
2071- for (const t_sg_candidate& scatter_wire : link.scatter_fanout_connections ) {
2072- const t_physical_tile_loc& chan_loc = scatter_wire.chan_loc .location ;
2073- e_rr_type scatter_chan_type = scatter_wire.chan_loc .chan_type ;
2074- const t_chan_details& chan_details = (scatter_chan_type == e_rr_type::CHANX) ? chan_details_x : chan_details_y;
2075-
2076- // Locate the destination RR node for this scatter wire
2077- RRNodeId scatter_node = rr_graph_builder.node_lookup ().find_node (chan_loc.layer_num ,
2078- chan_loc.x ,
2079- chan_loc.y ,
2080- scatter_chan_type,
2081- scatter_wire.wire_switchpoint .wire );
2082- // Determine which architecture switch this edge should use
2083- int switch_index = chan_details[chan_loc.x ][chan_loc.y ][scatter_wire.wire_switchpoint .wire ].arch_wire_switch ();
2084- // Record deferred edge creation (sg_node --> scatter_node)
2085- non_3d_sg_rr_edges_to_create.emplace_back (node_id, scatter_node, switch_index, false );
2086- }
2087- }
2088- }
2089-
20901980void alloc_and_load_edges (RRGraphBuilder& rr_graph_builder, const t_rr_edge_info_set& rr_edges_to_create) {
20911981 rr_graph_builder.alloc_and_load_edges (&rr_edges_to_create);
20921982}
0 commit comments