Skip to content

Commit a6d5e68

Browse files
committed
prune initial RTs again
1 parent d540887 commit a6d5e68

6 files changed

+35
-19
lines changed

vpr/src/route/DecompNetlistRouter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class DecompNetlistRouter : public NetlistRouter {
7070
/** Get a bitset with sinks to route before net decomposition */
7171
vtr::dynamic_bitset<> get_decomposition_mask(ParentNetId net_id, const PartitionTreeNode& node);
7272
/** Get a bitset with sinks to route before virtual net decomposition */
73-
vtr::dynamic_bitset<> get_vnet_decomposition_mask(const VirtualNet& vnet, const PartitionTreeNode& node);
73+
vtr::dynamic_bitset<> get_decomposition_mask_vnet(const VirtualNet& vnet, const PartitionTreeNode& node);
7474
/** Decompose and route a regular net. Output the resulting vnets to \p left and \p right.
7575
* \return Success status: true if routing is successful and left and right now contain valid virtual nets: false otherwise. */
7676
bool decompose_and_route_net(ParentNetId net_id, const PartitionTreeNode& node, VirtualNet& left, VirtualNet& right);

vpr/src/route/DecompNetlistRouter.tpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,8 @@ inline std::string describe_vnet(const VirtualNet& vnet) {
389389

390390
template<typename HeapType>
391391
bool DecompNetlistRouter<HeapType>::decompose_and_route_vnet(VirtualNet& vnet, const PartitionTreeNode& node, VirtualNet& left, VirtualNet& right) {
392-
/* Sample enough sinks to provide branch-off points to the virtual nets we create */
393-
auto sink_mask = get_vnet_decomposition_mask(vnet, node);
392+
/* Sample enough sinks to provide branch-off points to the virtual nets we create */
393+
auto sink_mask = get_decomposition_mask_vnet(vnet, node);
394394

395395
/* Route the *parent* net with the given mask: only the sinks we ask for will be routed */
396396
auto flags = route_net(
@@ -647,7 +647,7 @@ inline bool get_reduction_mask_vnet_with_source(const VirtualNet& vnet, Axis cut
647647
}
648648

649649
template<typename HeapType>
650-
vtr::dynamic_bitset<> DecompNetlistRouter<HeapType>::get_vnet_decomposition_mask(const VirtualNet& vnet, const PartitionTreeNode& node) {
650+
vtr::dynamic_bitset<> DecompNetlistRouter<HeapType>::get_decomposition_mask_vnet(const VirtualNet& vnet, const PartitionTreeNode& node) {
651651
const auto& route_ctx = g_vpr_ctx.routing();
652652
const RouteTree& tree = route_ctx.route_trees[vnet.net_id].value();
653653
int num_sinks = tree.num_sinks();
@@ -659,10 +659,11 @@ vtr::dynamic_bitset<> DecompNetlistRouter<HeapType>::get_vnet_decomposition_mask
659659
* sinks in the small side and unblock. Add convex hull since we are in a vnet which
660660
* may not have a source at all */
661661
if (inside_bb(tree.root().inode, vnet.clipped_bb)) { /* We have source, no need to sample after reduction in most cases */
662-
bool is_reduced = get_reduction_mask_vnet_with_source(vnet, node.cutline_axis, node.cutline_pos, out);
662+
bool is_reduced = get_reduction_mask_vnet_with_source(vnet, node.cutline_axis, node.cutline_pos, out);
663663
bool source_on_cutline = is_close_to_cutline(tree.root().inode, node.cutline_axis, node.cutline_pos, 1);
664-
if (!is_reduced || source_on_cutline)
664+
if (!is_reduced || source_on_cutline){
665665
convex_hull_downsample(vnet.net_id, vnet.clipped_bb, out);
666+
}
666667
} else {
667668
int reduced_sides = get_reduction_mask_vnet_no_source(vnet, node.cutline_axis, node.cutline_pos, out);
668669
if (reduced_sides < 2) {
@@ -675,9 +676,11 @@ vtr::dynamic_bitset<> DecompNetlistRouter<HeapType>::get_vnet_decomposition_mask
675676
/* Sample if a sink is too close to the cutline (and unreached).
676677
* Those sinks are likely to fail routing */
677678
for (size_t isink : isinks) {
679+
RRNodeId rr_sink = route_ctx.net_rr_terminals[vnet.net_id][isink];
680+
if (!inside_bb(rr_sink, vnet.clipped_bb))
681+
continue;
678682
if (is_isink_reached.get(isink))
679683
continue;
680-
RRNodeId rr_sink = route_ctx.net_rr_terminals[vnet.net_id][isink];
681684
if (is_close_to_cutline(rr_sink, node.cutline_axis, node.cutline_pos, 1)) {
682685
out.set(isink, true);
683686
continue;

vpr/src/route/connection_router.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "connection_router.h"
2+
#include "route_common.h"
23
#include "rr_graph.h"
34

45
#include "binary_heap.h"
@@ -900,6 +901,9 @@ void ConnectionRouter<Heap>::add_route_tree_node_to_heap(
900901
float backward_path_cost = cost_params.criticality * rt_node.Tdel;
901902
float R_upstream = rt_node.R_upstream;
902903

904+
if(!inside_bb(inode, net_bb))
905+
return;
906+
903907
// after budgets are loaded, calculate delay cost as described by RCV paper
904908
/* R. Fung, V. Betz and W. Chow, "Slack Allocation and Routing to Improve FPGA Timing While
905909
* Repairing Short-Path Violations," in IEEE Transactions on Computer-Aided Design of
@@ -1012,6 +1016,9 @@ t_bb ConnectionRouter<Heap>::add_high_fanout_route_tree_to_heap(
10121016
continue;
10131017
RRNodeId rr_node_to_add = rt_node.inode;
10141018

1019+
if(!inside_bb(rr_node_to_add, net_bounding_box))
1020+
continue;
1021+
10151022
if (is_flat_) {
10161023
if (!relevant_node_to_target(rr_graph_, rr_node_to_add, target_node))
10171024
continue;
@@ -1028,16 +1035,14 @@ t_bb ConnectionRouter<Heap>::add_high_fanout_route_tree_to_heap(
10281035

10291036
/* In case of the parallel router, we may be dealing with a virtual net.
10301037
* Still push nodes outside the BB to the heap, but don't count them towards nodes_added */
1031-
if(inside_bb(rr_node_to_add, net_bounding_box)){
1032-
if (is_flat_) {
1033-
if (rr_graph_->node_type(rr_node_to_add) == CHANY || rr_graph_->node_type(rr_node_to_add) == CHANX) {
1034-
chan_nodes_added++;
1035-
}
1036-
} else {
1038+
if (is_flat_) {
1039+
if (rr_graph_->node_type(rr_node_to_add) == CHANY || rr_graph_->node_type(rr_node_to_add) == CHANX) {
10371040
chan_nodes_added++;
10381041
}
1039-
nodes_added++;
1042+
} else {
1043+
chan_nodes_added++;
10401044
}
1045+
nodes_added++;
10411046
}
10421047

10431048
constexpr int SINGLE_BIN_MIN_NODES = 2;

vpr/src/route/route_common.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
#include "atom_netlist_utils.h"
44
#include "connection_router_interface.h"
55
#include "draw_global.h"
6+
#include "globals.h"
67
#include "place_and_route.h"
78
#include "route_common.h"
89
#include "route_export.h"
910
#include "rr_graph.h"
1011

12+
#include "partition_tree.h"
13+
1114
/* The numbering relation between the channels and clbs is: *
1215
* *
1316
* | IO | chan_ | CLB | chan_ | CLB | *
@@ -237,9 +240,9 @@ void pathfinder_update_acc_cost_and_overuse_info(float acc_fac, OveruseInfo& ove
237240

238241
/** Update pathfinder cost of all nodes rooted at rt_node, including rt_node itself */
239242
void pathfinder_update_cost_from_route_tree(const RouteTreeNode& root, int add_or_sub) {
240-
pathfinder_update_single_node_occupancy(root.inode, add_or_sub);
243+
pathfinder_update_single_node_occupancy(root.inode, add_or_sub);
241244
for (auto& node : root.all_nodes()) {
242-
pathfinder_update_single_node_occupancy(node.inode, add_or_sub);
245+
pathfinder_update_single_node_occupancy(node.inode, add_or_sub);
243246
}
244247
}
245248

vpr/src/route/route_common.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* router files and some used globally. */
55

66
#include <vector>
7-
#include "clustered_netlist.h"
8-
#include "rr_node_fwd.h"
97
#include "router_stats.h"
108
#include "globals.h"
119

vpr/src/route/sink_sampling.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,23 @@ inline void convex_hull_downsample(ParentNetId net_id, const t_bb& net_bb, vtr::
149149
RRNodeId rr_sink = route_ctx.net_rr_terminals[net_id][i];
150150
if (!inside_bb(rr_sink, net_bb))
151151
continue;
152-
SinkPoint point{rr_graph.node_xlow(rr_sink), rr_graph.node_ylow(rr_sink), int(i)};
152+
Direction dir = rr_graph.node_direction(rr_sink);
153+
int x = dir == Direction::DEC ? rr_graph.node_xhigh(rr_sink) : rr_graph.node_xlow(rr_sink);
154+
int y = dir == Direction::DEC ? rr_graph.node_yhigh(rr_sink) : rr_graph.node_ylow(rr_sink);
155+
SinkPoint point{x, y, int(i)};
153156
sink_points.push_back(point);
154157
}
155158

156159
auto hull = sink_sampling::quickhull(sink_points);
157160

161+
auto& is_isink_reached = tree.get_is_isink_reached();
162+
158163
/* Sample if not source */
159164
for (auto& point : hull) {
160165
if (point.isink == 0) /* source */
161166
continue;
167+
if(is_isink_reached.get(point.isink))
168+
continue;
162169
out.set(point.isink, true);
163170
}
164171
}

0 commit comments

Comments
 (0)