Skip to content

Commit 2d6de4f

Browse files
Address PR comments on RR Graph changes
1 parent e9876b3 commit 2d6de4f

File tree

7 files changed

+47
-41
lines changed

7 files changed

+47
-41
lines changed

doc/src/arch/reference.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2750,7 +2750,7 @@ The number of any additional wires or muxes created by scatter-gather specificat
27502750
Overview of how scatter-gather patterns work. First, connections from a switchblock location are selected according to the specification.
27512751
These selected connection are then muxed and passed through the scatter-gather node, which is typically a wire segment. The scatter-gather node then fans out or scatters in another switchblock location.
27522752
2753-
.. note:: Scatter-Gather patterns are only supported for 3D architectures where the scatter-gather links are uni-directional and uni-directional 2D architectures. Bidirectional sg_links are not currently supported.
2753+
.. note:: Scatter-Gather patterns are only supported for uni-directional 3D and uni-directional 2D architectures. Bidirectional sg_links are not currently supported.
27542754
27552755
When instantiated, a scatter-gather pattern gathers connections from a switchblock and passes the connection through a multiplexer and the scatter-gather node which is typically a wire segment, then scatters or fans out somewhere else in the device. These patterns can be used to define 3D switchblocks. An example is shown below:
27562756

libs/librrgraph/src/base/rr_graph_storage.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ void t_rr_graph_storage::alloc_and_load_edges(const t_rr_edge_info_set* rr_edges
6060
}
6161

6262
void t_rr_graph_storage::remove_edges(std::vector<RREdgeId>& rr_edges_to_remove) {
63+
VTR_ASSERT(!edges_read_);
64+
6365
size_t starting_edge_count = edge_dest_node_.size();
6466

6567
// Sort and make sure all edge indices are unique

libs/librrgraph/src/base/rr_graph_view.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,8 @@ class RRGraphView {
589589
* for (t_edge_size edge : rr_graph.edges(node)) {
590590
* // Do something with the edge
591591
* }
592+
*
593+
* @note Iterating on the range returned by this function will not give you an RREdgeId, but instead gives you the index among a node's outgoing edges
592594
*/
593595
inline edge_idx_range edges(const RRNodeId& id) const {
594596
return vtr::make_range(edge_idx_iterator(0), edge_idx_iterator(num_edges(id)));

vpr/src/route/rr_graph_generation/interposer_cut.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ std::vector<RREdgeId> mark_interposer_cut_edges_for_removal(const RRGraphView& r
137137
}
138138

139139
/**
140-
* @brief Update a CHANY node's bounding box in RRGraph and SpatialLookup entries.
141-
* This function assumes that the channel node actually crosses the cut location and
142-
* might not function correctly otherwise.
143-
*
144-
* This is a low level function, you should use cut_channel_node that wraps this up in a nicer API.
145-
*/
140+
* @brief Update a CHANY node's bounding box in RRGraph and SpatialLookup entries.
141+
* This function assumes that the channel node actually crosses the cut location and
142+
* might not function correctly otherwise.
143+
*
144+
* This is a low level function, you should use cut_channel_node that wraps this up in a nicer API.
145+
*/
146146
static void cut_chan_y_node(RRNodeId node, int x_low, int y_low, int x_high, int y_high, int layer, int ptc_num, int cut_loc_y, Direction node_direction, RRGraphBuilder& rr_graph_builder, RRSpatialLookup& spatial_lookup) {
147147
if (node_direction == Direction::INC) {
148148
// Anything above cut_loc_y shouldn't exist

vpr/src/route/rr_graph_generation/interposer_cut.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ std::vector<RREdgeId> mark_interposer_cut_edges_for_removal(const RRGraphView& r
2020
* @param rr_graph_builder RRGraphBuilder, to modify the RRGraph.
2121
* @param sg_node_indices list of scatter-gather node IDs. We do not want to cut these nodes as they're allowed to cross an interposer cut line.
2222
*/
23-
void update_interposer_crossing_nodes_in_spatial_lookup_and_rr_graph_storage(const RRGraphView& rr_graph, const DeviceGrid& grid, RRGraphBuilder& rr_graph_builder, const std::vector<std::pair<RRNodeId, int>>& sg_node_indices);
23+
void update_interposer_crossing_nodes_in_spatial_lookup_and_rr_graph_storage(const RRGraphView& rr_graph, const DeviceGrid& grid, RRGraphBuilder& rr_graph_builder, const std::vector<std::pair<RRNodeId, int>>& sg_node_indices);

vpr/src/route/rr_graph_generation/rr_graph.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,14 +1669,16 @@ static std::function<void(t_chan_width*)> alloc_and_load_rr_graph(RRGraphBuilder
16691669
}
16701670
}
16711671
}
1672-
1672+
1673+
// If there are any interposer cuts, remove the edges and shorten the wires that cross interposer cut lines.
16731674
if (!grid.get_horizontal_interposer_cuts().empty() || !grid.get_vertical_interposer_cuts().empty()) {
16741675
std::vector<RREdgeId> interposer_edges = mark_interposer_cut_edges_for_removal(rr_graph, grid);
16751676
rr_graph_builder.remove_edges(interposer_edges);
16761677

16771678
update_interposer_crossing_nodes_in_spatial_lookup_and_rr_graph_storage(rr_graph, grid, rr_graph_builder, sg_node_indices);
16781679
}
1679-
1680+
1681+
// Add 2D scatter-gather link edges (the nodes have already been created at this point). These links are mostly used for interposer-crossing connections, but could also be used for other things.
16801682
add_and_connect_non_3d_sg_links(rr_graph_builder, sg_links, sg_node_indices, chan_details_x, chan_details_y, num_seg_types_x, rr_edges_to_create);
16811683
uniquify_edges(rr_edges_to_create);
16821684
alloc_and_load_edges(rr_graph_builder, rr_edges_to_create);

vpr/src/route/rr_graph_generation/rr_node_indices.cpp

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -518,12 +518,12 @@ bool verify_rr_node_indices(const DeviceGrid& grid,
518518
describe_rr_node(rr_graph, grid, rr_indexed_data, inode, is_flat).c_str());
519519
}
520520

521-
if (tile_loc.layer_num < rr_graph.node_layer_low(inode) && tile_loc.layer_num > rr_graph.node_layer_high(inode)) {
522-
VPR_ERROR(VPR_ERROR_ROUTE, "RR node layer does not match between rr_nodes and rr_node_indices (%s/%s): %s",
523-
rr_node_typename[rr_graph.node_type(inode)],
524-
rr_node_typename[rr_type],
525-
describe_rr_node(rr_graph, grid, rr_indexed_data, inode, is_flat).c_str());
526-
}
521+
if (tile_loc.layer_num < rr_graph.node_layer_low(inode) && tile_loc.layer_num > rr_graph.node_layer_high(inode)) {
522+
VPR_ERROR(VPR_ERROR_ROUTE, "RR node layer does not match between rr_nodes and rr_node_indices (%s/%s): %s",
523+
rr_node_typename[rr_graph.node_type(inode)],
524+
rr_node_typename[rr_type],
525+
describe_rr_node(rr_graph, grid, rr_indexed_data, inode, is_flat).c_str());
526+
}
527527

528528
if (rr_graph.node_type(inode) == e_rr_type::CHANX) {
529529
VTR_ASSERT_MSG(rr_graph.node_ylow(inode) == rr_graph.node_yhigh(inode), "CHANX should be horizontal");
@@ -596,35 +596,35 @@ bool verify_rr_node_indices(const DeviceGrid& grid,
596596
} else {
597597
VTR_ASSERT(rr_graph.node_type(inode) == e_rr_type::IPIN || rr_graph.node_type(inode) == e_rr_type::OPIN);
598598
/* As we allow a pin to be indexable on multiple sides,
599-
* This check code should be invalid
600-
* if (rr_node.xlow() != x) {
601-
* VPR_ERROR(VPR_ERROR_ROUTE, "RR node xlow does not match between rr_nodes and rr_node_indices (%d/%d): %s",
602-
* rr_node.xlow(),
603-
* x,
604-
* describe_rr_node(rr_graph, grid, rr_indexed_data, inode).c_str());
605-
* }
606-
*
607-
* if (rr_node.ylow() != y) {
608-
* VPR_ERROR(VPR_ERROR_ROUTE, "RR node ylow does not match between rr_nodes and rr_node_indices (%d/%d): %s",
609-
* rr_node.ylow(),
610-
* y,
611-
* describe_rr_node(rr_graph, grid, rr_indexed_data, inode).c_str());
612-
* }
613-
*/
599+
* This check code should be invalid
600+
* if (rr_node.xlow() != x) {
601+
* VPR_ERROR(VPR_ERROR_ROUTE, "RR node xlow does not match between rr_nodes and rr_node_indices (%d/%d): %s",
602+
* rr_node.xlow(),
603+
* x,
604+
* describe_rr_node(rr_graph, grid, rr_indexed_data, inode).c_str());
605+
* }
606+
*
607+
* if (rr_node.ylow() != y) {
608+
* VPR_ERROR(VPR_ERROR_ROUTE, "RR node ylow does not match between rr_nodes and rr_node_indices (%d/%d): %s",
609+
* rr_node.ylow(),
610+
* y,
611+
* describe_rr_node(rr_graph, grid, rr_indexed_data, inode).c_str());
612+
* }
613+
*/
614614
}
615615

616616
if (rr_type == e_rr_type::IPIN || rr_type == e_rr_type::OPIN) {
617617
/* As we allow a pin to be indexable on multiple sides,
618-
* This check code should be invalid
619-
* if (rr_node.side() != side) {
620-
* VPR_ERROR(VPR_ERROR_ROUTE, "RR node xlow does not match between rr_nodes and rr_node_indices (%s/%s): %s",
621-
* TOTAL_2D_SIDE_STRINGS[rr_node.side()],
622-
* TOTAL_2D_SIDE_STRINGS[side],
623-
* describe_rr_node(rr_graph, grid, rr_indexed_data, inode).c_str());
624-
* } else {
625-
* VTR_ASSERT(rr_node.side() == side);
626-
* }
627-
*/
618+
* This check code should be invalid
619+
* if (rr_node.side() != side) {
620+
* VPR_ERROR(VPR_ERROR_ROUTE, "RR node xlow does not match between rr_nodes and rr_node_indices (%s/%s): %s",
621+
* TOTAL_2D_SIDE_STRINGS[rr_node.side()],
622+
* TOTAL_2D_SIDE_STRINGS[side],
623+
* describe_rr_node(rr_graph, grid, rr_indexed_data, inode).c_str());
624+
* } else {
625+
* VTR_ASSERT(rr_node.side() == side);
626+
* }
627+
*/
628628
}
629629
}
630630
}

0 commit comments

Comments
 (0)