Skip to content

Commit 8164438

Browse files
author
Nathan Shreve
committed
Fixed bug in add_classes_spatial_lookup()
1 parent fddbe8b commit 8164438

File tree

4 files changed

+20
-39
lines changed

4 files changed

+20
-39
lines changed

libs/librrgraph/src/base/rr_graph_utils.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,6 @@ void set_sink_locs(const RRGraphView& rr_graph, RRGraphBuilder& rr_graph_builder
142142

143143
// Helper fn. to remove old sink locations from RRSpatialLookup
144144
auto remove_sink_locs_from_lookup = [&](Offset bottom_left, Offset top_right, Offset new_sink_loc, RRNodeId node, size_t layer, size_t ptc) {
145-
if (rr_graph_builder.node_lookup().find_node((int)layer, (int)new_sink_loc.x(), (int)new_sink_loc.y(), SINK, (int)ptc) == RRNodeId::INVALID()) {
146-
rr_graph_builder.node_lookup().add_node(node, (int)layer, (int)new_sink_loc.x(), (int)new_sink_loc.y(), SINK, ptc);
147-
}
148-
149145
for (size_t x = bottom_left.x(); x <= top_right.x(); ++x) {
150146
for (size_t y = bottom_left.y(); y <= top_right.y(); ++y) {
151147
if (x == new_sink_loc.x() && y == new_sink_loc.y()) /* The new sink location */

vpr/src/route/route_common.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -456,18 +456,15 @@ static vtr::vector<ParentNetId, std::vector<RRNodeId>> load_net_rr_terminals(con
456456

457457
// SINK nodes do not cover their whole tile, so we need to check all coordinates in the tile.
458458
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);
459+
auto tile_type = g_vpr_ctx.device().grid.get_physical_type({blk_loc.loc.x, blk_loc.loc.y, blk_loc.loc.layer});
460+
size_t tile_xlow = blk_loc.loc.x - g_vpr_ctx.device().grid.get_width_offset({blk_loc.loc.x, blk_loc.loc.y, blk_loc.loc.layer});
461+
size_t tile_ylow = blk_loc.loc.y - g_vpr_ctx.device().grid.get_height_offset({blk_loc.loc.x, blk_loc.loc.y, blk_loc.loc.layer});
462+
size_t tile_xhigh = tile_xlow + tile_type->width - 1;
463+
size_t tile_yhigh = tile_ylow + tile_type->height - 1;
464+
465+
for (size_t x = tile_xlow; x <= tile_xhigh; ++x) {
466+
for (size_t y = tile_ylow; y <= tile_yhigh; ++y) {
467+
inode = rr_graph.node_lookup().find_node(blk_loc.loc.layer, (int)x, (int)y, SINK, iclass);
471468

472469
if (inode != RRNodeId::INVALID())
473470
break;

vpr/src/route/rr_graph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@ static void build_intra_cluster_rr_graph(const t_graph_type graph_type,
15021502

15031503
rr_graph_builder.partition_edges();
15041504

1505-
set_sink_locs(rr_graph, rr_graph_builder, grid);
1505+
//set_sink_locs(rr_graph, rr_graph_builder, grid);
15061506

15071507
rr_graph_builder.clear_temp_storage();
15081508

vpr/src/route/rr_graph2.cpp

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,35 +1295,23 @@ static void add_classes_spatial_lookup(RRGraphBuilder& rr_graph_builder,
12951295

12961296
for (auto class_num : class_num_vec) {
12971297
auto class_type = get_class_type_from_class_physical_num(physical_type_ptr, class_num);
1298+
e_rr_type node_type = SINK;
12981299
if (class_type == DRIVER) {
1299-
rr_graph_builder.node_lookup().add_node(RRNodeId(*index), layer, root_x, root_y, SOURCE, class_num);
1300+
node_type = SOURCE;
13001301
} else {
13011302
VTR_ASSERT(class_type == RECEIVER);
1302-
1303-
rr_graph_builder.node_lookup().add_node(RRNodeId(*index), layer, root_x, root_y, SINK, class_num);
13041303
}
1305-
++(*index);
1306-
}
13071304

1308-
//Copy the SOURCE/SINK nodes to all offset positions for blocks with width > 1 and/or height > 1
1309-
// This ensures that look-ups on non-root locations will still find the correct SOURCE/SINK
1310-
for (int x_offset = 0; x_offset < block_width; x_offset++) {
1311-
for (int y_offset = 0; y_offset < block_height; y_offset++) {
1312-
if (x_offset == 0 && y_offset == 0) {
1313-
// Node is already added
1314-
continue;
1305+
for (int x_offset = 0; x_offset < block_width; x_offset++) {
1306+
for (int y_offset = 0; y_offset < block_height; y_offset++) {
1307+
int curr_x = root_x + x_offset;
1308+
int curr_y = root_y + y_offset;
1309+
1310+
rr_graph_builder.node_lookup().add_node(RRNodeId(*index), layer, curr_x, curr_y, node_type, class_num);
13151311
}
1316-
int curr_x = root_x + x_offset;
1317-
int curr_y = root_y + y_offset;
1318-
rr_graph_builder.node_lookup().mirror_nodes(layer, vtr::Point<int>(root_x, root_y),
1319-
vtr::Point<int>(curr_x, curr_y),
1320-
SOURCE,
1321-
SIDES[0]);
1322-
rr_graph_builder.node_lookup().mirror_nodes(layer, vtr::Point<int>(root_x, root_y),
1323-
vtr::Point<int>(curr_x, curr_y),
1324-
SINK,
1325-
SIDES[0]);
13261312
}
1313+
1314+
++(*index);
13271315
}
13281316
}
13291317

0 commit comments

Comments
 (0)