Skip to content

Commit e1f97f6

Browse files
committed
[vpr][route][crr] comment for removing dangling nodes
1 parent 2e768c7 commit e1f97f6

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

vpr/src/route/rr_graph_generation/tileable_rr_graph/crr_generator/data_frame_processor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct Cell {
4747
/**
4848
* @brief Simple dataframe implementation for processing switch template data
4949
*
50-
* This class provides pandas-like functionality for processing switch template files
50+
* This class provides functions for processing switch template files
5151
* containing switch block configuration data.
5252
*/
5353
class DataFrame {

vpr/src/route/rr_graph_generation/tileable_rr_graph/crr_generator/node_lookup_manager.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
namespace crrgenerator {
99

1010
/**
11-
* @brief Manages efficient node lookup and indexing for RR graphs
11+
* @brief Manages efficient node lookup and indexing for CRR graphs
1212
*
1313
* This class creates spatial indexes for nodes to enable fast lookup
1414
* by coordinates, type, and other attributes.
15+
* @note Eventually, this class should be removed and the lookup already created for
16+
* RR graph should be used.
1517
*/
1618
class NodeLookupManager {
1719
public:

vpr/src/route/rr_graph_generation/tileable_rr_graph/tileable_rr_graph_builder.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ void build_tileable_unidir_rr_graph(const std::vector<t_physical_tile_type>& typ
287287
// Allocate and load routing resource switches, which are derived from the switches from the architecture file,
288288
// based on their fanin in the rr graph. This routine also adjusts the rr nodes to point to these new rr switches
289289
device_ctx.rr_graph_builder.init_fan_in();
290+
// If requested, remove dangling chan nodes from the rr graph. This is done
291+
// before allocating and loading routing resource switches since removing these nodes
292+
// may affect the fanin of the switches.
290293
if (crr_opts.remove_dangling_nodes) {
291294
remove_dangling_chan_nodes(device_ctx.grid,
292295
device_ctx.rr_graph_builder);
@@ -333,6 +336,7 @@ static void remove_dangling_chan_nodes(const DeviceGrid& grid,
333336
RRSpatialLookup& node_lookup = rr_graph_builder.node_lookup();
334337
std::vector<RRNodeId> dangling_nodes;
335338

339+
// Iterate over chan nodes and find dangling ones
336340
for (size_t node_index = 0; node_index < rr_nodes.size(); ++node_index) {
337341
RRNodeId node = RRNodeId(node_index);
338342
if (rr_nodes.node_type(node) == e_rr_type::CHANX || rr_nodes.node_type(node) == e_rr_type::CHANY) {
@@ -342,7 +346,9 @@ static void remove_dangling_chan_nodes(const DeviceGrid& grid,
342346
}
343347
}
344348
rr_nodes.remove_nodes(dangling_nodes);
345-
349+
350+
// After removing dangling chan nodes, we need to update the node lookup
351+
// since some nodes may have been removed, and the node ids have changed
346352
node_lookup.clear();
347353
// Alloc the lookup table
348354
for (e_rr_type rr_type : RR_TYPES) {
@@ -353,7 +359,7 @@ static void remove_dangling_chan_nodes(const DeviceGrid& grid,
353359
NUM_2D_SIDES);
354360
}
355361

356-
// Add the correct node into the vector
362+
// Update other data structures realated to lookup after removing dangling chan nodes
357363
for (size_t node_index = 0; node_index < rr_nodes.size(); ++node_index) {
358364
RRNodeId node = RRNodeId(node_index);
359365
// Set track numbers as a node may have multiple ptc
@@ -365,5 +371,8 @@ static void remove_dangling_chan_nodes(const DeviceGrid& grid,
365371
rr_graph_builder.add_node_to_all_locs(node);
366372
}
367373
}
374+
375+
// Initialize the fanin of the rr graph since the fan-in of nodes connected to
376+
// remove nodes is changed
368377
rr_graph_builder.init_fan_in();
369378
}

0 commit comments

Comments
 (0)