Skip to content

Commit a632425

Browse files
add quiet mode to PlacementLogPrinter
1 parent a2da0ee commit a632425

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

vpr/src/place/place_log_util.cpp

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@
1212
#include "read_place.h"
1313
#include "tatum/echo_writer.hpp"
1414

15-
PlacementLogPrinter::PlacementLogPrinter(const Placer& placer)
15+
PlacementLogPrinter::PlacementLogPrinter(const Placer& placer, bool quiet)
1616
: placer_(placer)
17-
, msg_(vtr::bufsize) {}
17+
, quiet_(quiet)
18+
, msg_(quiet ? 0 : vtr::bufsize) {}
1819

1920
void PlacementLogPrinter::print_place_status_header() const {
21+
if (quiet_) {
22+
return;
23+
}
24+
2025
const bool noc_enabled = placer_.noc_opts().noc;
2126

2227
VTR_LOG("\n");
@@ -42,6 +47,10 @@ void PlacementLogPrinter::print_place_status_header() const {
4247
}
4348

4449
void PlacementLogPrinter::print_place_status(float elapsed_sec) const {
50+
if (quiet_) {
51+
return;
52+
}
53+
4554
const PlacementAnnealer& annealer = placer_.annealer();
4655
const t_annealing_state& annealing_state = annealer.get_annealing_state();
4756
const auto& [swap_stats, move_type_stats, placer_stats] = annealer.get_stats();
@@ -89,6 +98,10 @@ void PlacementLogPrinter::print_place_status(float elapsed_sec) const {
8998
}
9099

91100
void PlacementLogPrinter::print_resources_utilization() const {
101+
if (quiet_) {
102+
return;
103+
}
104+
92105
const auto& cluster_ctx = g_vpr_ctx.clustering();
93106
const auto& device_ctx = g_vpr_ctx.device();
94107
const auto& block_locs = placer_.placer_state().block_locs();
@@ -126,6 +139,10 @@ void PlacementLogPrinter::print_resources_utilization() const {
126139
}
127140

128141
void PlacementLogPrinter::print_placement_swaps_stats() const {
142+
if (quiet_) {
143+
return;
144+
}
145+
129146
const PlacementAnnealer& annealer = placer_.annealer();
130147
const auto& [swap_stats, move_type_stats, placer_stats] = annealer.get_stats();
131148
const t_annealing_state& annealing_state = annealer.get_annealing_state();
@@ -148,6 +165,10 @@ void PlacementLogPrinter::print_placement_swaps_stats() const {
148165
swap_stats.num_swap_aborted, 100 * abort_rate);
149166
}
150167
void PlacementLogPrinter::print_initial_placement_stats() const {
168+
if (quiet_) {
169+
return;
170+
}
171+
151172
const t_placer_costs& costs = placer_.costs();
152173
const t_noc_opts& noc_opts = placer_.noc_opts();
153174
const t_placer_opts& placer_opts = placer_.placer_opts();
@@ -201,6 +222,10 @@ void PlacementLogPrinter::print_initial_placement_stats() const {
201222
}
202223

203224
void PlacementLogPrinter::print_post_placement_stats() const {
225+
if (quiet_) {
226+
return;
227+
}
228+
204229
const auto& timing_ctx = g_vpr_ctx.timing();
205230
const PlacementAnnealer& annealer = placer_.annealer();
206231
const auto& [swap_stats, move_type_stats, placer_stats] = annealer.get_stats();

vpr/src/place/place_log_util.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Placer;
1919

2020
class PlacementLogPrinter {
2121
public:
22-
explicit PlacementLogPrinter(const Placer& placer);
22+
explicit PlacementLogPrinter(const Placer& placer, bool quiet);
2323

2424
void print_place_status_header() const;
2525
void print_resources_utilization() const;
@@ -30,6 +30,7 @@ class PlacementLogPrinter {
3030

3131
private:
3232
const Placer& placer_;
33+
const bool quiet_;
3334
mutable std::vector<char> msg_;
3435
};
3536

vpr/src/place/placer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Placer::Placer(const Netlist<>& net_list,
3131
, rng_(placer_opts.seed)
3232
, net_cost_handler_(placer_opts, placer_state_, cube_bb)
3333
, place_delay_model_(std::move(place_delay_model))
34-
, log_printer_(*this) {
34+
, log_printer_(*this, /*quiet*/false) {
3535
const auto& cluster_ctx = g_vpr_ctx.clustering();
3636
const auto& device_ctx = g_vpr_ctx.device();
3737
const auto& atom_ctx = g_vpr_ctx.atom();

0 commit comments

Comments
 (0)