Skip to content

Commit f2fab38

Browse files
add msg_ member variable to PlacementLogPrinter
1 parent ce0fb18 commit f2fab38

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

vpr/src/place/place_log_util.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
#include "read_place.h"
1313

1414
PlacementLogPrinter::PlacementLogPrinter(const Placer& placer)
15-
: placer_(placer) {}
15+
: placer_(placer)
16+
, msg_(vtr::bufsize) {}
1617

1718
void PlacementLogPrinter::print_place_status_header() const {
1819
const bool noc_enabled = placer_.noc_opts().noc;
@@ -44,6 +45,8 @@ void PlacementLogPrinter::print_place_status(float elapsed_sec) const {
4445
const t_annealing_state& annealing_state = annealer.get_annealing_state();
4546
const auto& [swap_stats, move_type_stats, placer_stats] = annealer.get_stats();
4647
const int tot_moves = annealer.get_total_iteration();
48+
const t_placer_costs& costs = placer_.costs();
49+
std::shared_ptr<const SetupTimingInfo> timing_info = placer_.timing_info();
4750

4851
const bool noc_enabled = placer_.noc_opts().noc;
4952
const NocCostTerms& noc_cost_terms = placer_.costs().noc_cost_terms;
@@ -77,6 +80,11 @@ void PlacementLogPrinter::print_place_status(float elapsed_sec) const {
7780

7881
VTR_LOG("\n");
7982
fflush(stdout);
83+
84+
sprintf(msg_.data(), "Cost: %g BB Cost %g TD Cost %g Temperature: %g",
85+
costs.cost, costs.bb_cost, costs.timing_cost, annealing_state.t);
86+
87+
update_screen(ScreenUpdatePriority::MINOR, msg_.data(), PLACEMENT, timing_info);
8088
}
8189

8290
void PlacementLogPrinter::print_resources_utilization() const {
@@ -177,13 +185,12 @@ void PlacementLogPrinter::print_initial_placement_stats() const {
177185
float(num_macro_members) / blk_loc_registry.place_macros().macros().size());
178186
VTR_LOG("\n");
179187

180-
char msg[vtr::bufsize];
181-
sprintf(msg,
188+
sprintf(msg_.data(),
182189
"Initial Placement. Cost: %g BB Cost: %g TD Cost %g \t Channel Factor: %d",
183190
costs.cost, costs.bb_cost, costs.timing_cost, placer_opts.place_chan_width);
184191

185192
// Draw the initial placement
186-
update_screen(ScreenUpdatePriority::MAJOR, msg, PLACEMENT, timing_info);
193+
update_screen(ScreenUpdatePriority::MAJOR, msg_.data(), PLACEMENT, timing_info);
187194

188195
if (placer_opts.placement_saves_per_temperature >= 1) {
189196
std::string filename = vtr::string_fmt("placement_%03d_%03d.place", 0, 0);

vpr/src/place/place_log_util.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#define VTR_PLACE_LOG_UTIL_H
44

55
#include <cstddef>
6+
#include <vector>
67

78
#include "timing_info_fwd.h"
89
#include "PlacementDelayCalculator.h"
@@ -28,6 +29,7 @@ class PlacementLogPrinter {
2829

2930
private:
3031
const Placer& placer_;
32+
mutable std::vector<char> msg_;
3133
};
3234

3335
void generate_post_place_timing_reports(const t_placer_opts& placer_opts,

vpr/src/place/placer.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,6 @@ void Placer::place() {
297297

298298
log_printer_.print_place_status(temperature_timer.elapsed_sec());
299299

300-
// sprintf(msg, "Cost: %g BB Cost %g TD Cost %g Temperature: %g",
301-
// costs_.cost, costs_.bb_cost, costs_.timing_cost, annealing_state.t);
302-
//
303-
// update_screen(ScreenUpdatePriority::MINOR, msg, PLACEMENT, timing_info_);
304-
305300
//#ifdef VERBOSE
306301
// if (getEchoEnabled()) {
307302
// print_clb_placement("first_iteration_clb_placement.echo");

0 commit comments

Comments
 (0)