Skip to content

Commit e429303

Browse files
committed
[VPR] Deploy find_channel_nodes() to router lookahead map functions
1 parent 5034a9f commit e429303

File tree

3 files changed

+10
-22
lines changed

3 files changed

+10
-22
lines changed

vpr/src/device/rr_spatial_lookup.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ RRNodeId RRSpatialLookup::find_node(int x,
7777
std::vector<RRNodeId> RRSpatialLookup::find_channel_nodes(int x,
7878
int y,
7979
t_rr_type type) const {
80+
/* TODO: The implementation of this API should be worked
81+
* when rr_node_indices adapts RRNodeId natively!
82+
*/
8083
std::vector<RRNodeId> channel_nodes;
8184

8285
/* Pre-check: the x, y, type are valid! Otherwise, return an empty vector */

vpr/src/route/router_lookahead_map.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ static RRNodeId get_start_node(int start_x, int start_y, int target_x, int targe
547547
const auto& temp_rr_graph = device_ctx.rr_graph; //TODO rename to rr_graph once the rr_graph below is unneeded
548548
auto& rr_graph = device_ctx.rr_nodes;
549549

550-
int result = UNDEFINED;
550+
RRNodeId result = RRNodeId::INVALID();
551551

552552
if (rr_type != CHANX && rr_type != CHANY) {
553553
VPR_FATAL_ERROR(VPR_ERROR_ROUTE, "Must start lookahead routing from CHANX or CHANY node\n");
@@ -561,19 +561,11 @@ static RRNodeId get_start_node(int start_x, int start_y, int target_x, int targe
561561

562562
int start_lookup_x = start_x;
563563
int start_lookup_y = start_y;
564-
if (rr_type == CHANX) {
565-
//Bizarely, rr_node_indices stores CHANX with swapped x/y...
566-
std::swap(start_lookup_x, start_lookup_y);
567-
}
568564

569-
const std::vector<int>& channel_node_list = device_ctx.rr_node_indices[rr_type][start_lookup_x][start_lookup_y][0];
570565

571566
/* find first node in channel that has specified segment index and goes in the desired direction */
572-
for (unsigned itrack = 0; itrack < channel_node_list.size(); itrack++) {
573-
int node_ind = channel_node_list[itrack];
574-
if (node_ind < 0) continue;
575-
576-
RRNodeId node_id(node_ind);
567+
for (const RRNodeId& node_id : device_ctx.rr_graph.node_lookup().find_channel_nodes(start_lookup_x, start_lookup_y, rr_type)) {
568+
if (!node_id) continue;
577569

578570
VTR_ASSERT(temp_rr_graph.node_type(node_id) == rr_type);
579571

@@ -583,15 +575,15 @@ static RRNodeId get_start_node(int start_x, int start_y, int target_x, int targe
583575

584576
if ((node_direction == direction || node_direction == BI_DIRECTION) && node_seg_ind == seg_index) {
585577
/* found first track that has the specified segment index and goes in the desired direction */
586-
result = node_ind;
578+
result = node_id;
587579
if (track_offset == 0) {
588580
break;
589581
}
590582
track_offset -= 2;
591583
}
592584
}
593585

594-
return RRNodeId(result);
586+
return result;
595587
}
596588

597589
/* runs Dijkstra's algorithm from specified node until all nodes have been visited. Each time a pin is visited, the delay/congestion information

vpr/src/route/router_lookahead_map_utils.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,6 @@ t_chan_ipins_delays compute_router_chan_ipin_lookahead() {
382382

383383
chan_ipins_delays.resize(device_ctx.physical_tile_types.size());
384384

385-
std::vector<int> rr_nodes_at_loc;
386-
387385
//We assume that the routing connectivity of each instance of a physical tile is the same,
388386
//and so only measure one instance of each type
389387
for (auto tile_type : device_ctx.physical_tile_types) {
@@ -406,13 +404,8 @@ t_chan_ipins_delays compute_router_chan_ipin_lookahead() {
406404
for (int ix = min_x; ix < max_x; ix++) {
407405
for (int iy = min_y; iy < max_y; iy++) {
408406
for (auto rr_type : {CHANX, CHANY}) {
409-
rr_nodes_at_loc.clear();
410-
411-
get_rr_node_indices(device_ctx.rr_node_indices, ix, iy, rr_type, &rr_nodes_at_loc);
412-
for (int inode : rr_nodes_at_loc) {
413-
if (inode < 0) continue;
414-
415-
RRNodeId node_id(inode);
407+
for (const RRNodeId& node_id : device_ctx.rr_graph.node_lookup().find_channel_nodes(ix, iy, rr_type)) {
408+
if (!node_id) continue;
416409

417410
//Find the IPINs which are reachable from the wires within the bounding box
418411
//around the selected tile location

0 commit comments

Comments
 (0)