Skip to content

Commit 65fdcea

Browse files
litghostkmurray
authored andcommitted
route: profiling: add debugging prints.
Signed-off-by: Keith Rothman <[email protected]>
1 parent 1b90651 commit 65fdcea

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

vpr/src/route/route_profiling.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "globals.h"
33
#include "vpr_types.h"
44
#include "route_profiling.h"
5+
#include "rr_graph.h"
56

67
namespace profiling {
78

@@ -29,6 +30,10 @@ void time_on_fanout_analysis() {}
2930

3031
void profiling_initialization(unsigned /*max_net_fanout*/) {}
3132

33+
void conn_start() {}
34+
void conn_finish(int /*src_rr*/, int /*sink_rr*/, float /*criticality*/) {}
35+
void net_finish() {}
36+
3237
#else
3338

3439
constexpr unsigned int fanout_per_bin = 1;
@@ -181,6 +186,12 @@ void congestion_analysis() {
181186
# endif
182187
}
183188

189+
static clock_t conn_start_time;
190+
static float worst_conn_time = 0.f;
191+
static int worst_src_rr;
192+
static int worst_sink_rr;
193+
static float worst_crit;
194+
184195
void profiling_initialization(unsigned max_fanout) {
185196
// add 1 so that indexing on the max fanout would still be valid
186197
time_on_fanout.resize((max_fanout / fanout_per_bin) + 1, 0);
@@ -195,8 +206,37 @@ void profiling_initialization(unsigned max_fanout) {
195206
part_tree_preserved = 0;
196207
connections_forced_to_reroute = 0;
197208
connections_rerouted_due_to_forcing = 0;
209+
worst_conn_time = 0.f;
198210
return;
199211
}
212+
213+
void conn_start() {
214+
conn_start_time = clock();
215+
}
216+
void conn_finish(int src_rr, int sink_rr, float criticality) {
217+
float route_time = static_cast<float>(clock() - conn_start_time) / CLOCKS_PER_SEC;
218+
if (route_time > worst_conn_time) {
219+
worst_src_rr = src_rr;
220+
worst_sink_rr = sink_rr;
221+
worst_conn_time = route_time;
222+
worst_crit = criticality;
223+
}
224+
225+
VTR_LOG("%s to %s (crit: %f) took %f\n",
226+
describe_rr_node(src_rr).c_str(),
227+
describe_rr_node(sink_rr).c_str(),
228+
criticality,
229+
route_time);
230+
}
231+
void net_finish() {
232+
if (worst_conn_time > 0.f) {
233+
VTR_LOG("Worst conn was %s to %s (crit: %f) took %f\n",
234+
describe_rr_node(worst_src_rr).c_str(),
235+
describe_rr_node(worst_sink_rr).c_str(),
236+
worst_crit,
237+
worst_conn_time);
238+
}
239+
}
200240
#endif
201241

202242
} // end namespace profiling

vpr/src/route/route_profiling.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ void congestion_analysis();
3030
void time_on_criticality_analysis();
3131
void time_on_fanout_analysis();
3232

33+
void conn_start();
34+
void conn_finish(int src_rr, int sink_rr, float criticality);
35+
void net_finish();
36+
3337
void profiling_initialization(unsigned max_net_fanout);
3438

3539
} // end namespace profiling

vpr/src/route/route_timing.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,8 @@ bool timing_driven_route_net(ConnectionRouter& router,
10961096
conn_delay_budget.short_path_criticality = budgeting_inf.get_crit_short_path(net_id, target_pin);
10971097
}
10981098

1099+
profiling::conn_start();
1100+
10991101
// build a branch in the route tree to the target
11001102
if (!timing_driven_route_sink(router,
11011103
net_id,
@@ -1109,10 +1111,15 @@ bool timing_driven_route_net(ConnectionRouter& router,
11091111
router_stats))
11101112
return false;
11111113

1114+
profiling::conn_finish(route_ctx.net_rr_terminals[net_id][0],
1115+
sink_rr,
1116+
pin_criticality[target_pin]);
1117+
11121118
++router_stats.connections_routed;
11131119
} // finished all sinks
11141120

11151121
++router_stats.nets_routed;
1122+
profiling::net_finish();
11161123

11171124
/* For later timing analysis. */
11181125

0 commit comments

Comments
 (0)