77#include " tatum/TimingReporter.hpp"
88#include " VprTimingGraphResolver.h"
99#include " timing_info.h"
10+ #include " placer.h"
11+
12+ PlacementLogPrinter::PlacementLogPrinter (const Placer& placer)
13+ : placer_(placer) {}
14+
15+ void PlacementLogPrinter::print_place_status_header () const {
16+ const bool noc_enabled = placer_.noc_opts_ .noc ;
1017
11- void print_place_status_header (bool noc_enabled) {
1218 VTR_LOG (" \n " );
1319 if (!noc_enabled) {
1420 VTR_LOG (
@@ -31,28 +37,31 @@ void print_place_status_header(bool noc_enabled) {
3137 }
3238}
3339
34- void print_place_status (const t_annealing_state& state,
35- const t_placer_statistics& stats,
36- float elapsed_sec,
37- float cpd,
38- float sTNS ,
39- float sWNS ,
40- size_t tot_moves,
41- bool noc_enabled,
42- const NocCostTerms& noc_cost_terms) {
40+ void PlacementLogPrinter::print_place_status (float elapsed_sec) const {
41+ const t_annealing_state& annealing_state = placer_.annealer_ ->get_annealing_state ();
42+ const auto & [swap_stats, move_type_stats, placer_stats] = placer_.annealer_ ->get_stats ();
43+ const int tot_moves = placer_.annealer_ ->get_total_iteration ();
44+ const bool noc_enabled = placer_.noc_opts_ .noc ;
45+ const NocCostTerms& noc_cost_terms = placer_.costs_ .noc_cost_terms ;
46+
47+ const bool is_timing_driven = placer_.placer_opts_ .place_algorithm .is_timing_driven ();
48+ const float cpd = is_timing_driven ? placer_.critical_path_ .delay () : std::numeric_limits<float >::quiet_NaN ();
49+ const float sTNS = is_timing_driven ? placer_.timing_info_ ->setup_total_negative_slack () : std::numeric_limits<float >::quiet_NaN ();
50+ const float sWNS = is_timing_driven ? placer_.timing_info_ ->setup_worst_negative_slack () : std::numeric_limits<float >::quiet_NaN ();
51+
4352 VTR_LOG (
4453 " %4zu %6.1f %7.1e "
4554 " %7.3f %10.2f %-10.5g "
4655 " %7.3f % 10.3g % 8.3f "
4756 " %7.3f %7.4f %6.1f %8.2f" ,
48- state .num_temps , elapsed_sec, state .t ,
49- stats .av_cost , stats .av_bb_cost , stats .av_timing_cost ,
57+ annealing_state .num_temps , elapsed_sec, annealing_state .t ,
58+ placer_stats .av_cost , placer_stats .av_bb_cost , placer_stats .av_timing_cost ,
5059 1e9 * cpd, 1e9 * sTNS , 1e9 * sWNS ,
51- stats .success_rate , stats .std_dev , state .rlim , state .crit_exponent );
60+ placer_stats .success_rate , placer_stats .std_dev , annealing_state .rlim , annealing_state .crit_exponent );
5261
5362 pretty_print_uint (" " , tot_moves, 9 , 3 );
5463
55- VTR_LOG (" %6.3f" , state .alpha );
64+ VTR_LOG (" %6.3f" , annealing_state .alpha );
5665
5766 if (noc_enabled) {
5867 VTR_LOG (
@@ -66,10 +75,10 @@ void print_place_status(const t_annealing_state& state,
6675 fflush (stdout);
6776}
6877
69- void print_resources_utilization (const BlkLocRegistry& blk_loc_registry) {
78+ void PlacementLogPrinter:: print_resources_utilization () const {
7079 const auto & cluster_ctx = g_vpr_ctx.clustering ();
7180 const auto & device_ctx = g_vpr_ctx.device ();
72- const auto & block_locs = blk_loc_registry .block_locs ();
81+ const auto & block_locs = placer_. placer_state_ .block_locs ();
7382
7483 size_t max_block_name = 0 ;
7584 size_t max_tile_name = 0 ;
@@ -103,15 +112,18 @@ void print_resources_utilization(const BlkLocRegistry& blk_loc_registry) {
103112 VTR_LOG (" \n " );
104113}
105114
106- void print_placement_swaps_stats (const t_annealing_state& state, const t_swap_stats& swap_stats) {
115+ void PlacementLogPrinter::print_placement_swaps_stats () const {
116+ const auto & [swap_stats, move_type_stats, placer_stats] = placer_.annealer_ ->get_stats ();
117+ const t_annealing_state& annealing_state = placer_.annealer_ ->get_annealing_state ();
118+
107119 size_t total_swap_attempts = swap_stats.num_swap_rejected + swap_stats.num_swap_accepted + swap_stats.num_swap_aborted ;
108120 VTR_ASSERT (total_swap_attempts > 0 );
109121
110122 size_t num_swap_print_digits = ceil (log10 (total_swap_attempts));
111123 float reject_rate = (float )swap_stats.num_swap_rejected / total_swap_attempts;
112124 float accept_rate = (float )swap_stats.num_swap_accepted / total_swap_attempts;
113125 float abort_rate = (float )swap_stats.num_swap_aborted / total_swap_attempts;
114- VTR_LOG (" Placement number of temperatures: %d\n " , state .num_temps );
126+ VTR_LOG (" Placement number of temperatures: %d\n " , annealing_state .num_temps );
115127 VTR_LOG (" Placement total # of swap attempts: %*d\n " , num_swap_print_digits,
116128 total_swap_attempts);
117129 VTR_LOG (" \t Swaps accepted: %*d (%4.1f %%)\n " , num_swap_print_digits,
@@ -141,4 +153,5 @@ void generate_post_place_timing_reports(const t_placer_opts& placer_opts,
141153 timing_reporter.report_timing_setup (
142154 placer_opts.post_place_timing_report_file ,
143155 *timing_info.setup_analyzer (), analysis_opts.timing_report_npaths );
144- }
156+ }
157+
0 commit comments