Skip to content

Commit f2e8c4e

Browse files
committed
vpr: Only update router bounding boxes for modified nets
1 parent 65b1d5a commit f2e8c4e

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

vpr/src/route/route_timing.cpp

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ void reduce_budgets_if_congested(route_budgets& budgeting_inf,
250250
float slope,
251251
int itry);
252252

253-
static bool should_route_net(ClusterNetId net_id, const CBRR& connections_inf, bool if_force_reroute);
253+
static bool should_route_net(ClusterNetId net_id, CBRR& connections_inf, bool if_force_reroute);
254254
static bool early_exit_heuristic(const t_router_opts& router_opts, const WirelengthInfo& wirelength_info);
255255

256256
struct more_sinks_than {
@@ -279,7 +279,7 @@ static std::string describe_unrouteable_connection(const int source_node, const
279279

280280
static bool is_high_fanout(int fanout, int fanout_threshold);
281281

282-
static size_t dynamic_update_bounding_boxes(int high_fanout_threshold);
282+
static size_t dynamic_update_bounding_boxes(const std::vector<ClusterNetId>& nets, int high_fanout_threshold);
283283
static t_bb calc_current_bb(const t_trace* head);
284284

285285
static void enable_router_debug(const t_router_opts& router_opts, ClusterNetId net, int sink_rr);
@@ -405,6 +405,7 @@ bool try_timing_driven_route(const t_router_opts& router_opts,
405405
int itry_since_last_convergence = -1;
406406
for (itry = 1; itry <= router_opts.max_router_iterations; ++itry) {
407407
RouterStats router_iteration_stats;
408+
std::vector<ClusterNetId> rerouted_nets;
408409

409410
/* Reset "is_routed" and "is_fixed" flags to indicate nets not pre-routed (yet) */
410411
for (auto net_id : cluster_ctx.clb_nlist.nets()) {
@@ -434,6 +435,7 @@ bool try_timing_driven_route(const t_router_opts& router_opts,
434435
* Route each net
435436
*/
436437
for (auto net_id : sorted_nets) {
438+
bool was_rerouted = false;
437439
bool is_routable = try_timing_driven_route_net(net_id,
438440
itry,
439441
pres_fac,
@@ -445,11 +447,17 @@ bool try_timing_driven_route(const t_router_opts& router_opts,
445447
net_delay,
446448
*router_lookahead,
447449
netlist_pin_lookup,
448-
route_timing_info, budgeting_inf);
450+
route_timing_info,
451+
budgeting_inf,
452+
was_rerouted);
449453

450454
if (!is_routable) {
451455
return (false); //Impossible to route
452456
}
457+
458+
if (was_rerouted) {
459+
rerouted_nets.push_back(net_id);
460+
}
453461
}
454462

455463
// Make sure any CLB OPINs used up by subblocks being hooked directly to them are reserved for that purpose
@@ -587,7 +595,7 @@ bool try_timing_driven_route(const t_router_opts& router_opts,
587595
*/
588596

589597
if (router_opts.route_bb_update == e_route_bb_update::DYNAMIC) {
590-
num_net_bounding_boxes_updated = dynamic_update_bounding_boxes(router_opts.high_fanout_threshold);
598+
num_net_bounding_boxes_updated = dynamic_update_bounding_boxes(rerouted_nets, router_opts.high_fanout_threshold);
591599
}
592600

593601
if (itry >= high_effort_congestion_mode_iteration_threshold) {
@@ -749,7 +757,8 @@ bool try_timing_driven_route_net(ClusterNetId net_id,
749757
const RouterLookahead& router_lookahead,
750758
const ClusteredPinAtomPinsLookup& netlist_pin_lookup,
751759
std::shared_ptr<SetupTimingInfo> timing_info,
752-
route_budgets& budgeting_inf) {
760+
route_budgets& budgeting_inf,
761+
bool& was_rerouted) {
753762
auto& cluster_ctx = g_vpr_ctx.clustering();
754763
auto& route_ctx = g_vpr_ctx.mutable_routing();
755764

@@ -789,6 +798,8 @@ bool try_timing_driven_route_net(ClusterNetId net_id,
789798
} else {
790799
VTR_LOG("Routing failed.\n");
791800
}
801+
802+
was_rerouted = true; //Flag to record whether routing was actually changed
792803
}
793804
return (is_routed);
794805
}
@@ -2044,7 +2055,7 @@ static bool timing_driven_check_net_delays(vtr::vector<ClusterNetId, float*>& ne
20442055
}
20452056

20462057
/* Detect if net should be routed or not */
2047-
static bool should_route_net(ClusterNetId net_id, const CBRR& connections_inf, bool if_force_reroute) {
2058+
static bool should_route_net(ClusterNetId net_id, CBRR& connections_inf, bool if_force_reroute) {
20482059
auto& route_ctx = g_vpr_ctx.routing();
20492060
auto& device_ctx = g_vpr_ctx.device();
20502061

@@ -2080,6 +2091,8 @@ static bool should_route_net(ClusterNetId net_id, const CBRR& connections_inf, b
20802091

20812092
} /* End while loop -- did an entire traceback. */
20822093

2094+
VTR_ASSERT(connections_inf.get_remaining_targets().empty());
2095+
20832096
return false; /* Current route has no overuse */
20842097
}
20852098

@@ -2512,7 +2525,7 @@ static bool is_high_fanout(int fanout, int fanout_threshold) {
25122525
//
25132526
//Typically, only a small minority of nets (typically > 10%) have their BBs updated
25142527
//each routing iteration.
2515-
static size_t dynamic_update_bounding_boxes(int high_fanout_threshold) {
2528+
static size_t dynamic_update_bounding_boxes(const std::vector<ClusterNetId>& updated_nets, int high_fanout_threshold) {
25162529
auto& device_ctx = g_vpr_ctx.device();
25172530
auto& cluster_ctx = g_vpr_ctx.clustering();
25182531
auto& route_ctx = g_vpr_ctx.mutable_routing();
@@ -2535,7 +2548,7 @@ static size_t dynamic_update_bounding_boxes(int high_fanout_threshold) {
25352548

25362549
size_t num_bb_updated = 0;
25372550

2538-
for (ClusterNetId net : clb_nlist.nets()) {
2551+
for (ClusterNetId net : updated_nets) {
25392552
t_trace* routing_head = route_ctx.trace[net].head;
25402553

25412554
if (routing_head == nullptr) continue; //Skip if no routing

vpr/src/route/route_timing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ bool try_timing_driven_route(const t_router_opts& router_opts,
2121
std::shared_ptr<RoutingDelayCalculator> delay_calc,
2222
ScreenUpdatePriority first_iteration_priority);
2323

24-
bool try_timing_driven_route_net(ClusterNetId net_id, int itry, float pres_fac, t_router_opts router_opts, CBRR& connections_inf, RouterStats& connections_routed, float* pin_criticality, t_rt_node** rt_node_of_sink, vtr::vector<ClusterNetId, float*>& net_delay, const RouterLookahead& router_lookahead, const ClusteredPinAtomPinsLookup& netlist_pin_lookup, std::shared_ptr<SetupTimingInfo> timing_info, route_budgets& budgeting_inf);
24+
bool try_timing_driven_route_net(ClusterNetId net_id, int itry, float pres_fac, t_router_opts router_opts, CBRR& connections_inf, RouterStats& connections_routed, float* pin_criticality, t_rt_node** rt_node_of_sink, vtr::vector<ClusterNetId, float*>& net_delay, const RouterLookahead& router_lookahead, const ClusteredPinAtomPinsLookup& netlist_pin_lookup, std::shared_ptr<SetupTimingInfo> timing_info, route_budgets& budgeting_inf, bool& was_rerouted);
2525

2626
bool timing_driven_route_net(ClusterNetId net_id, int itry, float pres_fac, const t_router_opts& router_opts, CBRR& connections_inf, RouterStats& connections_routed, float* pin_criticality, t_rt_node** rt_node_of_sink, float* net_delay, const RouterLookahead& router_lookahead, const ClusteredPinAtomPinsLookup& netlist_pin_lookup, std::shared_ptr<const SetupTimingInfo> timing_info, route_budgets& budgeting_inf);
2727

0 commit comments

Comments
 (0)