Skip to content

Commit e770c1c

Browse files
committed
Disable high fanout routing when progress slows
Signed-off-by: Dustin DeWeese <[email protected]>
1 parent 461f853 commit e770c1c

File tree

4 files changed

+33
-18
lines changed

4 files changed

+33
-18
lines changed

vpr/src/route/route_timing.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ static bool timing_driven_route_sink(
8282
t_rt_node* rt_root,
8383
t_rt_node** rt_node_of_sink,
8484
SpatialRouteTreeLookup& spatial_rt_lookup,
85-
RouterStats& router_stats);
85+
RouterStats& router_stats,
86+
const RoutingPredictor& routing_predictor);
8687

8788
template<typename ConnectionRouter>
8889
static bool timing_driven_pre_route_to_clock_root(
@@ -414,7 +415,8 @@ bool try_timing_driven_route_tmpl(const t_router_opts& router_opts,
414415
route_timing_info,
415416
pin_timing_invalidator.get(),
416417
budgeting_inf,
417-
was_rerouted);
418+
was_rerouted,
419+
routing_predictor);
418420
if (!is_routable) {
419421
return (false); //Impossible to route
420422
}
@@ -756,7 +758,8 @@ bool try_timing_driven_route_net(ConnectionRouter& router,
756758
std::shared_ptr<SetupTimingInfo> timing_info,
757759
ClusteredPinTimingInvalidator* pin_timing_invalidator,
758760
route_budgets& budgeting_inf,
759-
bool& was_rerouted) {
761+
bool& was_rerouted,
762+
const RoutingPredictor& routing_predictor) {
760763
auto& cluster_ctx = g_vpr_ctx.clustering();
761764
auto& route_ctx = g_vpr_ctx.mutable_routing();
762765

@@ -787,7 +790,8 @@ bool try_timing_driven_route_net(ConnectionRouter& router,
787790
netlist_pin_lookup,
788791
timing_info,
789792
pin_timing_invalidator,
790-
budgeting_inf);
793+
budgeting_inf,
794+
routing_predictor);
791795

792796
profiling::net_fanout_end(cluster_ctx.clb_nlist.net_sinks(net_id).size());
793797

@@ -911,7 +915,8 @@ bool timing_driven_route_net(ConnectionRouter& router,
911915
const ClusteredPinAtomPinsLookup& netlist_pin_lookup,
912916
std::shared_ptr<SetupTimingInfo> timing_info,
913917
ClusteredPinTimingInvalidator* pin_timing_invalidator,
914-
route_budgets& budgeting_inf) {
918+
route_budgets& budgeting_inf,
919+
const RoutingPredictor& routing_predictor) {
915920
/* Returns true as long as found some way to hook up this net, even if that *
916921
* way resulted in overuse of resources (congestion). If there is no way *
917922
* to route this net, even ignoring congestion, it returns false. In this *
@@ -1047,7 +1052,8 @@ bool timing_driven_route_net(ConnectionRouter& router,
10471052
router_opts.high_fanout_threshold,
10481053
rt_root, rt_node_of_sink,
10491054
spatial_route_tree_lookup,
1050-
router_stats))
1055+
router_stats,
1056+
routing_predictor))
10511057
return false;
10521058

10531059
profiling::conn_finish(route_ctx.net_rr_terminals[net_id][0],
@@ -1187,7 +1193,8 @@ static bool timing_driven_route_sink(
11871193
t_rt_node* rt_root,
11881194
t_rt_node** rt_node_of_sink,
11891195
SpatialRouteTreeLookup& spatial_rt_lookup,
1190-
RouterStats& router_stats) {
1196+
RouterStats& router_stats,
1197+
const RoutingPredictor& routing_predictor) {
11911198
/* Build a path from the existing route tree rooted at rt_root to the target_node
11921199
* add this branch to the existing route tree and update pathfinder costs and rr_node_route_inf to reflect this */
11931200
auto& route_ctx = g_vpr_ctx.mutable_routing();
@@ -1216,7 +1223,7 @@ static bool timing_driven_route_sink(
12161223
//We normally route high fanout nets by only adding spatially close-by routing to the heap (reduces run-time).
12171224
//However, if the current sink is 'critical' from a timing perspective, we put the entire route tree back onto
12181225
//the heap to ensure it has more flexibility to find the best path.
1219-
if (high_fanout && !sink_critical && !net_is_global && !net_is_clock) {
1226+
if (high_fanout && !sink_critical && !net_is_global && !net_is_clock && !(routing_predictor.get_slope() > -0.5)) {
12201227
std::tie(found_path, cheapest) = router.timing_driven_route_connection_from_route_tree_high_fanout(rt_root,
12211228
sink_node,
12221229
cost_params,

vpr/src/route/route_timing.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "spatial_route_tree_lookup.h"
1313
#include "connection_router_interface.h"
1414
#include "heap_type.h"
15+
#include "routing_predictor.h"
1516

1617
int get_max_pins_per_net();
1718

@@ -39,7 +40,8 @@ bool try_timing_driven_route_net(ConnectionRouter& router,
3940
std::shared_ptr<SetupTimingInfo> timing_info,
4041
ClusteredPinTimingInvalidator* pin_timing_invalidator,
4142
route_budgets& budgeting_inf,
42-
bool& was_rerouted);
43+
bool& was_rerouted,
44+
const RoutingPredictor& routing_predictor);
4345

4446
template<typename ConnectionRouter>
4547
bool timing_driven_route_net(ConnectionRouter& router,
@@ -55,7 +57,8 @@ bool timing_driven_route_net(ConnectionRouter& router,
5557
const ClusteredPinAtomPinsLookup& netlist_pin_lookup,
5658
std::shared_ptr<SetupTimingInfo> timing_info,
5759
ClusteredPinTimingInvalidator* pin_timing_invalidator,
58-
route_budgets& budgeting_inf);
60+
route_budgets& budgeting_inf,
61+
const RoutingPredictor& routing_predictor);
5962

6063
void alloc_timing_driven_route_structs(float** pin_criticality_ptr,
6164
int** sink_order_ptr,

vpr/src/route/routing_predictor.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,9 @@ float covariance(std::vector<size_t> x_values, std::vector<float> y_values, floa
6363
return cov;
6464
}
6565

66-
float RoutingPredictor::get_slope() {
67-
if (iterations_.size() > min_history_) {
68-
auto model = fit_model(iterations_, iteration_overused_rr_node_counts_, history_factor_);
69-
return model.get_slope();
70-
}
71-
return -1;
66+
float RoutingPredictor::get_slope() const {
67+
//Return cached slope, computed in add_iteration_overuse()
68+
return slope_;
7269
}
7370

7471
LinearModel simple_linear_regression(std::vector<size_t> x_values, std::vector<float> y_values) {
@@ -155,7 +152,8 @@ LinearModel fit_model(std::vector<size_t> iterations, std::vector<size_t> overus
155152

156153
RoutingPredictor::RoutingPredictor(size_t min_history, float history_factor)
157154
: min_history_(min_history)
158-
, history_factor_(history_factor) {
155+
, history_factor_(history_factor)
156+
, slope_(-1) {
159157
//nop
160158
}
161159

@@ -204,4 +202,10 @@ float RoutingPredictor::estimate_overuse_slope() {
204202
void RoutingPredictor::add_iteration_overuse(size_t iteration, size_t overused_rr_node_count) {
205203
iterations_.push_back(iteration);
206204
iteration_overused_rr_node_counts_.push_back(overused_rr_node_count);
205+
206+
//Update slope
207+
if (iterations_.size() > min_history_) {
208+
auto model = fit_model(iterations_, iteration_overused_rr_node_counts_, history_factor_);
209+
slope_ = model.get_slope();
210+
}
207211
}

vpr/src/route/routing_predictor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ class RoutingPredictor {
2525

2626
void add_iteration_overuse(size_t iteration, size_t overused_rr_node_count);
2727

28-
float get_slope();
28+
float get_slope() const;
2929

3030
private:
3131
size_t min_history_;
3232
float history_factor_;
3333

3434
std::vector<size_t> iterations_;
3535
std::vector<size_t> iteration_overused_rr_node_counts_;
36+
float slope_;
3637
};
3738

3839
#endif

0 commit comments

Comments
 (0)