Skip to content

Commit a080780

Browse files
author
Nathan Shreve
committed
Merge branch 'improve_map_lookahead_exp0' into improve_map_lookahead
2 parents 789e0e8 + f33c14f commit a080780

File tree

4 files changed

+69
-0
lines changed

4 files changed

+69
-0
lines changed

libs/librrgraph/src/base/rr_graph_utils.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,16 @@ void set_sink_locs(const RRGraphView& rr_graph, RRGraphBuilder& rr_graph_builder
185185
auto x_avg = (short)round(std::accumulate(x_coords.begin(), x_coords.end(), 0.f) / (double)x_coords.size());
186186
auto y_avg = (short)round(std::accumulate(y_coords.begin(), y_coords.end(), 0.f) / (double)y_coords.size());
187187

188+
// Remove old indices from RRSpatialLookup
189+
for (size_t x = tile_xlow; x <= tile_xhigh; ++x) {
190+
for (size_t y = tile_ylow; y <= tile_yhigh; ++y) {
191+
if (x == (size_t)x_avg && y == (size_t)y_avg)
192+
continue;
193+
194+
rr_graph_builder.node_lookup().remove_node(node_id, tile_layer, x, y, SINK, sink_ptc);
195+
}
196+
}
197+
188198
// Save offset for this tile/ptc combo
189199
if (physical_type_offsets.find(tile_type) == physical_type_offsets.end())
190200
physical_type_offsets[tile_type] = {};

libs/librrgraph/src/base/rr_spatial_lookup.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,33 @@ void RRSpatialLookup::add_node(RRNodeId node,
258258
rr_node_indices_[type][layer][x][y][side][ptc] = int(size_t(node));
259259
}
260260

261+
void RRSpatialLookup::remove_node(RRNodeId node,
262+
int layer,
263+
int x,
264+
int y,
265+
t_rr_type type,
266+
int ptc,
267+
e_side side) {
268+
VTR_ASSERT(node);
269+
VTR_ASSERT_SAFE(4 == rr_node_indices_[type].ndims());
270+
VTR_ASSERT_SAFE(layer >= 0);
271+
VTR_ASSERT_SAFE(x >= 0);
272+
VTR_ASSERT_SAFE(y >= 0);
273+
VTR_ASSERT_SAFE(type != NUM_RR_TYPES);
274+
VTR_ASSERT_SAFE(ptc >= 0);
275+
VTR_ASSERT_SAFE(side != NUM_SIDES);
276+
277+
VTR_ASSERT_SAFE(!(type >= rr_node_indices_.size()));
278+
VTR_ASSERT_SAFE(!((size_t)layer >= rr_node_indices_[type].dim_size(0)));
279+
VTR_ASSERT_SAFE(!((size_t)x >= rr_node_indices_[type].dim_size(1)));
280+
VTR_ASSERT_SAFE(!((size_t)y >= rr_node_indices_[type].dim_size(2)));
281+
VTR_ASSERT_SAFE(!(side >= rr_node_indices_[type].dim_size(3)));
282+
VTR_ASSERT_SAFE(!((size_t)ptc >= rr_node_indices_[type][layer][x][y][side].size()));
283+
VTR_ASSERT_SAFE(!(rr_node_indices_[type][layer][x][y][side][ptc] == -1));
284+
285+
rr_node_indices_[type][layer][x][y][side][ptc] = -1;
286+
}
287+
261288
void RRSpatialLookup::mirror_nodes(const int layer,
262289
const vtr::Point<int>& src_coord,
263290
const vtr::Point<int>& des_coord,

libs/librrgraph/src/base/rr_spatial_lookup.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ class RRSpatialLookup {
159159
int ptc,
160160
e_side side = SIDES[0]);
161161

162+
void remove_node(RRNodeId node,
163+
int layer,
164+
int x,
165+
int y,
166+
t_rr_type type,
167+
int ptc,
168+
e_side side = SIDES[0]);
169+
162170
/**
163171
* @brief Mirror the last dimension of a look-up, i.e., a list of nodes, from a source coordinate to
164172
* a destination coordinate.

vpr/src/route/route_common.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "route_common.h"
88
#include "route_export.h"
99
#include "rr_graph.h"
10+
#include "re_cluster_util.h"
1011

1112
/* The numbering relation between the channels and clbs is: *
1213
* *
@@ -452,7 +453,30 @@ static vtr::vector<ParentNetId, std::vector<RRNodeId>> load_net_rr_terminals(con
452453
blk_loc.loc.y,
453454
(pin_count == 0 ? SOURCE : SINK), /* First pin is driver */
454455
iclass);
456+
457+
// SINK nodes do not cover their whole tile, so we need to check all coordinates in the tile.
458+
if (pin_count != 0 && inode == RRNodeId::INVALID()) {
459+
ClusterBlockId cluster_block_id;
460+
461+
if (is_flat)
462+
cluster_block_id = atom_to_cluster(AtomBlockId(size_t(block_id)));
463+
else
464+
cluster_block_id = ClusterBlockId(size_t(block_id));
465+
466+
auto tile_type = physical_tile_type(cluster_block_id);
467+
468+
for (int x = blk_loc.loc.x; x < blk_loc.loc.x + tile_type->width; ++x) {
469+
for (int y = blk_loc.loc.y; y < blk_loc.loc.y + tile_type->height; ++y) {
470+
inode = rr_graph.node_lookup().find_node(blk_loc.loc.layer, x, y, SINK, iclass);
471+
472+
if (inode != RRNodeId::INVALID())
473+
break;
474+
}
475+
}
476+
}
477+
455478
VTR_ASSERT(inode != RRNodeId::INVALID());
479+
456480
net_rr_terminals[net_id][pin_count] = inode;
457481
pin_count++;
458482
}

0 commit comments

Comments
 (0)