@@ -22,7 +22,7 @@ static void update_router_stats(RouterStats* router_stats,
22
22
23
23
/* * return tuple <found_path, retry_with_full_bb, cheapest> */
24
24
template <typename Heap>
25
- std::tuple<bool , bool , t_heap > ConnectionRouter<Heap>::timing_driven_route_connection_from_route_tree(
25
+ std::tuple<bool , bool , RTExploredNode > ConnectionRouter<Heap>::timing_driven_route_connection_from_route_tree(
26
26
const RouteTreeNode& rt_root,
27
27
RRNodeId sink_node,
28
28
const t_conn_cost_params& cost_params,
@@ -37,9 +37,11 @@ std::tuple<bool, bool, t_heap> ConnectionRouter<Heap>::timing_driven_route_conne
37
37
38
38
if (!std::isinf (rr_node_route_inf_[sink_node].path_cost )) {
39
39
rcv_path_manager.update_route_tree_set (rcv_path_data[sink_node]);
40
- t_heap out; // only the `index`, `prev_edge()`, and `path_data` fields of `out` are used after this function returns
40
+ // Only the `index`, `prev_edge`, and `rcv_path_backward_delay` fields of `out`
41
+ // are used after this function returns.
42
+ RTExploredNode out;
41
43
out.index = sink_node;
42
- out.set_prev_edge ( rr_node_route_inf_[sink_node].prev_edge ) ;
44
+ out.prev_edge = rr_node_route_inf_[sink_node].prev_edge ;
43
45
if (rcv_path_manager.is_enabled ()) {
44
46
out.rcv_path_backward_delay = rcv_path_data[sink_node]->backward_delay ;
45
47
}
@@ -51,7 +53,7 @@ std::tuple<bool, bool, t_heap> ConnectionRouter<Heap>::timing_driven_route_conne
51
53
clear_modified_rr_node_info ();
52
54
heap_.empty_heap ();
53
55
rcv_path_manager.empty_heap ();
54
- return std::make_tuple (false , retry, t_heap ());
56
+ return std::make_tuple (false , retry, RTExploredNode ());
55
57
}
56
58
}
57
59
@@ -111,7 +113,7 @@ bool ConnectionRouter<Heap>::timing_driven_route_connection_common_setup(
111
113
// which is spatially close to the sink is added to the heap.
112
114
// Returns a tuple of <found_path?, retry_with_full_bb?, cheapest> */
113
115
template <typename Heap>
114
- std::tuple<bool , bool , t_heap > ConnectionRouter<Heap>::timing_driven_route_connection_from_route_tree_high_fanout(
116
+ std::tuple<bool , bool , RTExploredNode > ConnectionRouter<Heap>::timing_driven_route_connection_from_route_tree_high_fanout(
115
117
const RouteTreeNode& rt_root,
116
118
RRNodeId sink_node,
117
119
const t_conn_cost_params& cost_params,
@@ -131,7 +133,7 @@ std::tuple<bool, bool, t_heap> ConnectionRouter<Heap>::timing_driven_route_conne
131
133
132
134
if (heap_.is_empty_heap ()) {
133
135
VTR_LOG (" No source in route tree: %s\n " , describe_unrouteable_connection (source_node, sink_node, is_flat_).c_str ());
134
- return std::make_tuple (false , false , t_heap ());
136
+ return std::make_tuple (false , false , RTExploredNode ());
135
137
}
136
138
137
139
VTR_LOGV_DEBUG (router_debug_, " Routing to %d as high fanout net (BB: %d,%d,%d x %d,%d,%d)\n " , sink_node,
@@ -164,13 +166,13 @@ std::tuple<bool, bool, t_heap> ConnectionRouter<Heap>::timing_driven_route_conne
164
166
165
167
heap_.empty_heap ();
166
168
rcv_path_manager.empty_heap ();
167
- return std::make_tuple (false , retry_with_full_bb, t_heap ());
169
+ return std::make_tuple (false , retry_with_full_bb, RTExploredNode ());
168
170
}
169
171
170
172
rcv_path_manager.update_route_tree_set (rcv_path_data[sink_node]);
171
- t_heap out;
173
+ RTExploredNode out;
172
174
out.index = sink_node;
173
- out.set_prev_edge ( rr_node_route_inf_[sink_node].prev_edge ) ;
175
+ out.prev_edge = rr_node_route_inf_[sink_node].prev_edge ;
174
176
if (rcv_path_manager.is_enabled ()) {
175
177
out.rcv_path_backward_delay = rcv_path_data[sink_node]->backward_delay ;
176
178
}
@@ -267,7 +269,7 @@ void ConnectionRouter<Heap>::timing_driven_route_connection_from_heap(RRNodeId s
267
269
268
270
// Find shortest paths from specified route tree to all nodes in the RR graph
269
271
template <typename Heap>
270
- vtr::vector<RRNodeId, t_heap > ConnectionRouter<Heap>::timing_driven_find_all_shortest_paths_from_route_tree(
272
+ vtr::vector<RRNodeId, RTExploredNode > ConnectionRouter<Heap>::timing_driven_find_all_shortest_paths_from_route_tree(
271
273
const RouteTreeNode& rt_root,
272
274
const t_conn_cost_params& cost_params,
273
275
const t_bb& bounding_box,
@@ -295,10 +297,10 @@ vtr::vector<RRNodeId, t_heap> ConnectionRouter<Heap>::timing_driven_find_all_sho
295
297
// Note that to re-use code used for the regular A*-based router we use a
296
298
// no-operation lookahead which always returns zero.
297
299
template <typename Heap>
298
- vtr::vector<RRNodeId, t_heap > ConnectionRouter<Heap>::timing_driven_find_all_shortest_paths_from_heap(
300
+ vtr::vector<RRNodeId, RTExploredNode > ConnectionRouter<Heap>::timing_driven_find_all_shortest_paths_from_heap(
299
301
const t_conn_cost_params& cost_params,
300
302
const t_bb& bounding_box) {
301
- vtr::vector<RRNodeId, t_heap > cheapest_paths (rr_nodes_.size ());
303
+ vtr::vector<RRNodeId, RTExploredNode > cheapest_paths (rr_nodes_.size ());
302
304
303
305
VTR_ASSERT_SAFE (heap_.is_valid ());
304
306
@@ -332,13 +334,13 @@ vtr::vector<RRNodeId, t_heap> ConnectionRouter<Heap>::timing_driven_find_all_sho
332
334
bounding_box,
333
335
t_bb ());
334
336
335
- if (cheapest_paths[inode].index == RRNodeId::INVALID () || cheapest_paths[inode].cost >= new_total_cost) {
336
- VTR_LOGV_DEBUG (router_debug_, " Better cost to node %d: %g (was %g)\n " , inode, new_total_cost, cheapest_paths[inode].cost );
337
- // Only the `index` and `prev_edge() ` fields of `cheapest_paths[inode]` are used after this function returns
337
+ if (cheapest_paths[inode].index == RRNodeId::INVALID () || cheapest_paths[inode].total_cost >= new_total_cost) {
338
+ VTR_LOGV_DEBUG (router_debug_, " Better cost to node %d: %g (was %g)\n " , inode, new_total_cost, cheapest_paths[inode].total_cost );
339
+ // Only the `index` and `prev_edge` fields of `cheapest_paths[inode]` are used after this function returns
338
340
cheapest_paths[inode].index = inode;
339
- cheapest_paths[inode].set_prev_edge ( rr_node_route_inf_[inode].prev_edge ) ;
341
+ cheapest_paths[inode].prev_edge = rr_node_route_inf_[inode].prev_edge ;
340
342
} else {
341
- VTR_LOGV_DEBUG (router_debug_, " Worse cost to node %d: %g (better %g)\n " , inode, new_total_cost, cheapest_paths[inode].cost );
343
+ VTR_LOGV_DEBUG (router_debug_, " Worse cost to node %d: %g (better %g)\n " , inode, new_total_cost, cheapest_paths[inode].total_cost );
342
344
}
343
345
}
344
346
@@ -368,7 +370,8 @@ void ConnectionRouter<Heap>::timing_driven_expand_cheapest(RRNodeId from_node,
368
370
// `new_total_cost` is used here as an identifier to detect if the pair
369
371
// (from_node or inode, new_total_cost) was the most recently pushed
370
372
// element for the corresponding node.
371
- node_t current;
373
+ RTExploredNode current;
374
+ current.index = from_node;
372
375
current.backward_path_cost = rr_node_route_inf_[from_node].backward_path_cost ;
373
376
current.prev_edge = rr_node_route_inf_[from_node].prev_edge ;
374
377
current.R_upstream = rr_node_R_upstream[from_node];
@@ -381,8 +384,7 @@ void ConnectionRouter<Heap>::timing_driven_expand_cheapest(RRNodeId from_node,
381
384
static_cast <size_t >(rr_graph_->edge_src_node (current.prev_edge )),
382
385
static_cast <size_t >(current.prev_edge ));
383
386
384
- timing_driven_expand_neighbours (current, cost_params, bounding_box, from_node,
385
- target_node, target_bb);
387
+ timing_driven_expand_neighbours (current, cost_params, bounding_box, target_node, target_bb);
386
388
} else {
387
389
// Post-heap prune, do not re-explore from the current/new partial path as it
388
390
// has worse cost than the best partial path to this node found so far
@@ -393,16 +395,15 @@ void ConnectionRouter<Heap>::timing_driven_expand_cheapest(RRNodeId from_node,
393
395
}
394
396
395
397
template <typename Heap>
396
- void ConnectionRouter<Heap>::timing_driven_expand_neighbours(const node_t & current,
398
+ void ConnectionRouter<Heap>::timing_driven_expand_neighbours(const RTExploredNode & current,
397
399
const t_conn_cost_params& cost_params,
398
400
const t_bb& bounding_box,
399
- RRNodeId from_node,
400
401
RRNodeId target_node,
401
402
const t_bb& target_bb) {
402
403
/* Puts all the rr_nodes adjacent to current on the heap. */
403
404
404
405
// For each node associated with the current heap element, expand all of it's neighbors
405
- auto edges = rr_nodes_.edge_range (from_node );
406
+ auto edges = rr_nodes_.edge_range (current. index );
406
407
407
408
// This is a simple prefetch that prefetches:
408
409
// - RR node data reachable from this node
@@ -432,7 +433,6 @@ void ConnectionRouter<Heap>::timing_driven_expand_neighbours(const node_t& curre
432
433
for (RREdgeId from_edge : edges) {
433
434
RRNodeId to_node = rr_nodes_.edge_sink_node (from_edge);
434
435
timing_driven_expand_neighbour (current,
435
- from_node,
436
436
from_edge,
437
437
to_node,
438
438
cost_params,
@@ -446,8 +446,7 @@ void ConnectionRouter<Heap>::timing_driven_expand_neighbours(const node_t& curre
446
446
// RR nodes outside the expanded bounding box specified in bounding_box are not added
447
447
// to the heap.
448
448
template <typename Heap>
449
- void ConnectionRouter<Heap>::timing_driven_expand_neighbour(const node_t & current,
450
- RRNodeId from_node,
449
+ void ConnectionRouter<Heap>::timing_driven_expand_neighbour(const RTExploredNode& current,
451
450
RREdgeId from_edge,
452
451
RRNodeId to_node,
453
452
const t_conn_cost_params& cost_params,
@@ -456,6 +455,8 @@ void ConnectionRouter<Heap>::timing_driven_expand_neighbour(const node_t& curren
456
455
const t_bb& target_bb) {
457
456
VTR_ASSERT (bounding_box.layer_max < g_vpr_ctx.device ().grid .get_num_layers ());
458
457
458
+ const RRNodeId& from_node = current.index ;
459
+
459
460
// BB-pruning
460
461
// Disable BB-pruning if RCV is enabled, as this can make it harder for circuits with high negative hold slack to resolve this
461
462
// TODO: Only disable pruning if the net has negative hold slack, maybe go off budgets
@@ -521,7 +522,6 @@ void ConnectionRouter<Heap>::timing_driven_expand_neighbour(const node_t& curren
521
522
if (!node_exists || !rcv_path_manager.is_enabled ()) {
522
523
timing_driven_add_to_heap (cost_params,
523
524
current,
524
- from_node,
525
525
to_node,
526
526
from_edge,
527
527
target_node);
@@ -531,15 +531,15 @@ void ConnectionRouter<Heap>::timing_driven_expand_neighbour(const node_t& curren
531
531
// Add to_node to the heap, and also add any nodes which are connected by non-configurable edges
532
532
template <typename Heap>
533
533
void ConnectionRouter<Heap>::timing_driven_add_to_heap(const t_conn_cost_params& cost_params,
534
- const node_t & current,
535
- RRNodeId from_node,
534
+ const RTExploredNode& current,
536
535
RRNodeId to_node,
537
536
const RREdgeId from_edge,
538
537
RRNodeId target_node) {
539
538
const auto & device_ctx = g_vpr_ctx.device ();
539
+ const RRNodeId& from_node = current.index ;
540
540
541
541
// Initialized to current
542
- node_t next;
542
+ RTExploredNode next;
543
543
next.R_upstream = current.R_upstream ;
544
544
next.prev_edge = from_edge;
545
545
next.total_cost = std::numeric_limits<float >::infinity (); // Not used directly
@@ -566,7 +566,7 @@ void ConnectionRouter<Heap>::timing_driven_add_to_heap(const t_conn_cost_params&
566
566
float new_total_cost = next.total_cost ;
567
567
float new_back_cost = next.backward_path_cost ;
568
568
569
- if (best_back_cost > new_back_cost) { // TODO: double check the correctness of expansion condition with RCV
569
+ if (best_back_cost > new_back_cost) { // TODO: double check the performance of expansion condition
570
570
VTR_LOGV_DEBUG (router_debug_, " Expanding to node %d (%s)\n " , to_node,
571
571
describe_rr_node (device_ctx.rr_graph ,
572
572
device_ctx.grid ,
@@ -682,7 +682,7 @@ void ConnectionRouter<Heap>::set_rcv_enabled(bool enable) {
682
682
683
683
// Calculates the cost of reaching to_node
684
684
template <typename Heap>
685
- void ConnectionRouter<Heap>::evaluate_timing_driven_node_costs(node_t * to,
685
+ void ConnectionRouter<Heap>::evaluate_timing_driven_node_costs(RTExploredNode * to,
686
686
const t_conn_cost_params& cost_params,
687
687
RRNodeId from_node,
688
688
RRNodeId to_node,
0 commit comments