Skip to content

Commit 355f0cb

Browse files
author
Nathan Shreve
committed
Comment edits
1 parent f7ec2fd commit 355f0cb

File tree

8 files changed

+57
-51
lines changed

8 files changed

+57
-51
lines changed

libs/librrgraph/src/base/check_rr_graph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ void check_rr_node(const RRGraphView& rr_graph,
409409
vtr::Rect<int> tile_bb = grid.get_tile_bb({xlow, ylow, layer_num});
410410
if (xlow < tile_bb.xmin() || ylow < tile_bb.ymin() || xhigh > tile_bb.xmax() || yhigh > tile_bb.ymax()) {
411411
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
412-
"in check_rr_node: node %d (type %d) has endpoints (%d,%d) and (%d,%d)\n", inode, rr_type, xlow, ylow, xhigh, yhigh);
412+
"in check_rr_node: node %d (type %d) has endpoints (%d,%d) and (%d,%d), which is outside the bounds of the grid tile containing it.\n", inode, rr_type, xlow, ylow, xhigh, yhigh);
413413
}
414414
break;
415415
}

libs/librrgraph/src/base/rr_graph_utils.cpp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,23 @@
66
#include "rr_graph_obj.h"
77
#include "rr_graph_builder.h"
88

9-
// Add "cluster-edge" IPINs to sink_ipins
10-
static void walk_cluster_recursive(const RRGraphView& rr_graph,
11-
const vtr::vector<RRNodeId, std::vector<RREdgeId>>& fanins,
9+
/*
10+
* @brief Walk backwards from origin SINK, and insert all cluster-edge IPINs to which origin is connected to sink_ipins
11+
*
12+
* @param rr_graph
13+
* @param fanins A vector where, at each node index, is a vector of edges which are fanins of that node
14+
* @param sink_ipins The set in which cluster-edge IPINs will be collected; should be empty
15+
* @param curr The current node in recursion; originally, should be the same as origin
16+
* @param origin The SINK whose cluster-edge IPINs are to be collected
17+
*/
18+
static void rr_walk_cluster_recursive(const RRGraphView& rr_graph,
19+
const vtr::vector<RRNodeId, std::vector<RREdgeId>>& fanins,
20+
std::unordered_set<RRNodeId>& sink_ipins,
21+
const RRNodeId curr,
22+
const RRNodeId origin);
23+
24+
static void rr_walk_cluster_recursive(const RRGraphView& rr_graph,
25+
const vtr::vector<RRNodeId, std::vector<RREdgeId>>& fanins,
1226
std::unordered_set<RRNodeId>& sink_ipins,
1327
const RRNodeId curr,
1428
const RRNodeId origin) {
@@ -37,7 +51,7 @@ static void walk_cluster_recursive(const RRGraphView& rr_graph,
3751
}
3852

3953
// If the parent node is intra-cluster, keep going "backward"
40-
walk_cluster_recursive(rr_graph, fanins, sink_ipins, parent, origin);
54+
rr_walk_cluster_recursive(rr_graph, fanins, sink_ipins, parent, origin);
4155
}
4256
}
4357

@@ -169,7 +183,7 @@ void rr_set_sink_locs(const RRGraphView& rr_graph, RRGraphBuilder& rr_graph_buil
169183
} else { /* We have not seen this tile type/ptc combo before */
170184
// The IPINs of the current SINK node
171185
std::unordered_set<RRNodeId> sink_ipins = {};
172-
walk_cluster_recursive(rr_graph, node_fanins, sink_ipins, node_id, node_id);
186+
rr_walk_cluster_recursive(rr_graph, node_fanins, sink_ipins, node_id, node_id);
173187

174188
/* Set SINK locations as average of collected IPINs */
175189

libs/librrgraph/src/base/rr_graph_utils.h

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,22 @@ struct t_cluster_pin_chain {
4444
};
4545

4646
/**
47-
* @brief Get node-to-node switches in a RRGraph
47+
* @brief Get switches in a RRGraph starting at from_node and ending at to_node.
4848
*
49-
* @return A vector of switch ids
49+
* @details
50+
* Uses RRGraphView::find_edges(), then converts these edges to switch IDs.
51+
*
52+
* @return A vector of switch IDs
5053
*/
5154
std::vector<RRSwitchId> find_rr_graph_switches(const RRGraph& rr_graph,
5255
const RRNodeId& from_node,
5356
const RRNodeId& to_node);
5457

5558
/**
56-
* @brief This function generates and returns a vector indexed by RRNodeId containing a list of fan-in edges for each node.
59+
* @brief This function generates and returns a vector indexed by RRNodeId containing a vector of fan-in edges for each node.
60+
*
61+
* @note
62+
* This function is CPU expensive; complexity O(E) where E is the number of edges in rr_graph
5763
*/
5864
vtr::vector<RRNodeId, std::vector<RREdgeId>> get_fan_in_list(const RRGraphView& rr_graph);
5965

@@ -62,17 +68,7 @@ vtr::vector<RRNodeId, std::vector<RREdgeId>> get_fan_in_list(const RRGraphView&
6268
*
6369
* @details
6470
* build_rr_graph() sets the location of SINK nodes to span the entire tile they are in. This function sets the location
65-
* of SINK nodes to be the average coordinate of the IPINs on their cluster block to which they are connected
66-
*
67-
* @warning
68-
* 1. Do not call this function if the RR graph will be written out.<BR>
69-
* 2. If using flat routing, this function must be called before building the intra-cluster RR graph.
70-
*
71-
* @todo
72-
* Either when writing out the RR graph after this function has been called, or reading in an RR graph produced in VPR
73-
* after this function was called, an error occurs (many IPINs have no fanins). The reason for this error has not been
74-
* determined. However, this is quite a big issue, as choosing to write out the RR graph now significantly increases
75-
* runtime!
71+
* of SINK nodes to be the average coordinate of the "cluster-edge" IPINs to which they are connected
7672
*/
7773
void rr_set_sink_locs(const RRGraphView& rr_graph, RRGraphBuilder& rr_graph_builder, const DeviceGrid& grid);
7874

@@ -83,7 +79,7 @@ void rr_set_sink_locs(const RRGraphView& rr_graph, RRGraphBuilder& rr_graph_buil
8379
int seg_index_of_cblock(const RRGraphView& rr_graph, t_rr_type from_rr_type, int to_node);
8480

8581
/**
86-
* @breif Returns the segment number (distance along the channel) of the switch box from from_node (CHANX or CHANY) to
82+
* @brief Returns the segment number (distance along the channel) of the switch box from from_node (CHANX or CHANY) to
8783
* to_node (CHANX or CHANY).
8884
*
8985
* @details
@@ -103,14 +99,4 @@ int seg_index_of_sblock(const RRGraphView& rr_graph, int from_node, int to_node)
10399
* @return limited_to_opin
104100
*/
105101
bool inter_layer_connections_limited_to_opin(const RRGraphView& rr_graph);
106-
107-
/**
108-
* @brief This function returns a rectangle which represents the bounding box of the tile at the given location.
109-
*
110-
* @param tile_loc
111-
* @param rr_graph
112-
* @param grid
113-
*
114-
* @return tile_bounding_box
115-
*/
116102
#endif

libs/librrgraph/src/base/rr_spatial_lookup.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ bool RRSpatialLookup::remove_node(RRNodeId node,
295295
VTR_ASSERT_SAFE(ptc >= 0);
296296
VTR_ASSERT_SAFE(side != NUM_SIDES);
297297

298+
// Check if the node given is in the spatial lookup at the given indices
298299
if (type >= rr_node_indices_.size()) return false;
299300
if ((size_t)layer >= rr_node_indices_[type].dim_size(0)) return false;
300301
if ((size_t)x >= rr_node_indices_[type].dim_size(1)) return false;
@@ -303,6 +304,8 @@ bool RRSpatialLookup::remove_node(RRNodeId node,
303304
if ((size_t)ptc >= rr_node_indices_[type][layer][x][y][side].size()) return false;
304305
if (rr_node_indices_[type][layer][x][y][side][ptc] != int(size_t(node))) return false;
305306

307+
// The node was in the spatial lookup; remove it. -1 corresponds to an invalid node id,
308+
// and so is treated as absent in the spatial lookup
306309
rr_node_indices_[type][layer][x][y][side][ptc] = -1;
307310
return true;
308311
}

libs/librrgraph/src/base/rr_spatial_lookup.h

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class RRSpatialLookup {
4242
* @brief Returns the index of the specified routing resource node.
4343
*
4444
* @param layer specified which FPGA die the node is located at (e.g. multi-die(3D) FPGA)
45-
* @param (x, y) are the grid location within the FPGA
45+
* @param (x, y) is the grid location within the FPGA
4646
* @param rr_type specifies the type of resource,
4747
* @param ptc gives a unique number of resources of that type (e.g. CHANX) at that (layer,x,y).
4848
*
@@ -80,7 +80,7 @@ class RRSpatialLookup {
8080
*
8181
* @param layer specifies which FPGA die the node is located at (e.g. multi-die(3D) FPGA)
8282
* @param (xlow, ylow) is the lower left corner of the grid location range to search within the FPGA
83-
* @param (xlow, ylow) is the top right corner of the grid location range to search within the FPGA
83+
* @param (xhigh, yhigh) is the top right corner of the grid location range to search within the FPGA
8484
* @param rr_type specifies the type of resource,
8585
* @param ptc gives a unique number of resources of that type (e.g. CHANX) at that (layer,x,y).
8686
*
@@ -102,7 +102,7 @@ class RRSpatialLookup {
102102
* @brief Returns the indices of the specified routing resource nodes, representing routing tracks in a channel.
103103
*
104104
* @param layer specified which FPGA die the node is located at (e.g. multi-die(3D) FPGA)
105-
* @param (x, y) are the coordinate of the routing channel within the FPGA
105+
* @param (x, y) is the coordinate of the routing channel within the FPGA
106106
* @param rr_type specifies the type of routing channel, either x-direction or y-direction
107107
*
108108
* @note
@@ -151,18 +151,19 @@ class RRSpatialLookup {
151151
e_side side = SIDES[0]);
152152

153153
/**
154-
* @brief Register a node in the fast look-up
154+
* @brief Register a node in the fast spatial lookup
155155
*
156156
* @note You must have a valid node id to register the node in the lookup
157157
*
158158
* @param layer specified which FPGA die the node is located at (e.g. multi-die(3D) FPGA)
159-
* @param (x, y) are the coordinate of the node to be indexable in the fast look-up
159+
* @param (x, y) is the coordinate of the node to be indexable in the fast spatial lookup
160160
* @param type is the type of a node
161-
* @param ptc is a feature number of a node, which can be
162-
* - the class number of a common SINK/SOURCE node of grid,
163-
* - pin index in a tile when type is OPIN/IPIN
161+
* @param ptc is a feature number of a node, which can be<BR>
162+
* - the class number of a common SINK/SOURCE node of grid,<BR>
163+
* - pin index in a tile when type is OPIN/IPIN<BR>
164164
* - track index in a routing channel when type is CHANX/CHANY
165-
* @param side is the side of node on the tile, applicable to OPIN/IPIN
165+
* @param side is the side of node on the tile, applicable to OPIN/IPIN; it is ignored for
166+
* other types, and hence has a default set
166167
*
167168
* @note a node added with this call will not create a node in the rr_graph_storage node list
168169
* You MUST add the node in the rr_graph_storage so that the node is valid
@@ -183,16 +184,17 @@ class RRSpatialLookup {
183184
e_side side = SIDES[0]);
184185

185186
/**
186-
* @brief Remove a node in the fast lookup.
187+
* @brief Remove a node in the fast spatial lookup.
187188
*
188189
* @param layer specified which FPGA die the node is located at (e.g. multi-die(3D) FPGA)
189-
* @param (x, y) are the coordinate of the node
190+
* @param (x, y) is the coordinate of the node
190191
* @param type is the type of a node
191-
* @param ptc is a feature number of a node, which can be
192-
* - the class number of a common SINK/SOURCE node of grid,
193-
* - pin index in a tile when type is OPIN/IPIN
192+
* @param ptc is a feature number of a node, which can be<BR>
193+
* - the class number of a common SINK/SOURCE node of grid,<BR>
194+
* - pin index in a tile when type is OPIN/IPIN<BR>
194195
* - track index in a routing channel when type is CHANX/CHANY
195-
* @param side is the side of node on the tile, applicable to OPIN/IPIN
196+
* @param side is the side of node on the tile, applicable to OPIN/IPIN; it is ignored for
197+
* other types, and hence has a default set
196198
*
197199
* @return success Whether the node was removed successfully. If the function returns false,
198200
* the node was not in the lookup at the indices provided.
@@ -209,7 +211,7 @@ class RRSpatialLookup {
209211
* @brief Mirror the last dimension of a look-up, i.e., a list of nodes, from a source coordinate to
210212
* a destination coordinate.
211213
*
212-
* This function is mostly need by SOURCE nodes which are indexable in multiple locations.
214+
* This function is mostly needed by SOURCE nodes which are indexable in multiple locations.
213215
* Considering a bounding box (layer, x, y)->(layer, x + width, y + height) of a multi-height and multi-width grid,
214216
* SOURCE nodes are indexable in any location inside the boundary.
215217
*

libs/libvtrutil/src/vtr_geometry.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,10 @@ class Rect {
208208
///@brief set ymax to a point
209209
void set_ymax(T ymax_val);
210210

211-
/// @brief += operator
211+
/// @brief += operator; translates all corners of the rectangle by rhs
212212
Rect<T>& operator+=(const Point<T>& rhs);
213213

214-
/// @brief -= operator
214+
/// @brief -= operator; translates all corners of the rectangle by -rhs
215215
Rect<T>& operator-=(const Point<T>& rhs);
216216

217217
///@brief Equivalent to `*this = bounding_box(*this, other)`

vpr/src/base/vpr_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ enum class e_router_lookahead {
123123
MAP,
124124
///@brief Similar to MAP, but use a sparse sampling of the chip
125125
COMPRESSED_MAP,
126-
///@breif Lookahead with a more extensive node sampling method
126+
///@brief Lookahead with a more extensive node sampling method
127127
EXTENDED_MAP,
128128
///@brief A no-operation lookahead which always returns zero
129129
NO_OP

vpr/src/route/check_route.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,8 @@ static bool check_adjacent(RRNodeId from_node, RRNodeId to_node, bool is_flat) {
301301
to_yhigh = rr_graph.node_yhigh(to_rr);
302302
to_ptc = rr_graph.node_ptc_num(to_rr);
303303

304-
// If to_node is SINK, use its tile coordinates
304+
// If to_node is a SINK, it could be anywhere within its containing device grid tile, and it is reasonable for
305+
// any input pins or within-cluster pins to reach it. Hence, treat its size as that of its containing tile.
305306
if (to_type == SINK) {
306307
vtr::Rect<int> tile_bb = device_ctx.grid.get_tile_bb({to_xlow, to_ylow, to_layer});
307308

0 commit comments

Comments
 (0)