Skip to content

Commit da5ebf6

Browse files
add print_post_placement_stats_() to Placer
1 parent afc789b commit da5ebf6

File tree

5 files changed

+166
-146
lines changed

5 files changed

+166
-146
lines changed

vpr/src/place/place.cpp

Lines changed: 3 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,6 @@ static void free_placement_structs();
7373

7474
static int count_connections();
7575

76-
static void generate_post_place_timing_reports(const t_placer_opts& placer_opts,
77-
const t_analysis_opts& analysis_opts,
78-
const SetupTimingInfo& timing_info,
79-
const PlacementDelayCalculator& delay_calc,
80-
bool is_flat,
81-
const BlkLocRegistry& blk_loc_registry);
82-
83-
/**
84-
* @brief Copies the placement location variables into the global placement context.
85-
* @param blk_loc_registry The placement location variables to be copied.
86-
*/
87-
static void copy_locs_to_global_state(const BlkLocRegistry& blk_loc_registry);
88-
8976
/*****************************************************************************/
9077
void try_place(const Netlist<>& net_list,
9178
const t_placer_opts& placer_opts,
@@ -108,13 +95,9 @@ void try_place(const Netlist<>& net_list,
10895
*/
10996
VTR_ASSERT(!is_flat);
11097
const auto& device_ctx = g_vpr_ctx.device();
111-
const auto& atom_ctx = g_vpr_ctx.atom();
112-
const auto& cluster_ctx = g_vpr_ctx.clustering();
11398
const auto& timing_ctx = g_vpr_ctx.timing();
11499
auto pre_place_timing_stats = timing_ctx.stats;
115100

116-
char msg[vtr::bufsize];
117-
118101
/* Placement delay model is independent of the placement and can be shared across
119102
* multiple placers. So, it is created and initialized once. */
120103
std::shared_ptr<PlaceDelayModel> place_delay_model;
@@ -141,8 +124,6 @@ void try_place(const Netlist<>& net_list,
141124
VTR_LOG("Bounding box mode is %s\n", (cube_bb ? "Cube" : "Per-layer"));
142125
VTR_LOG("\n");
143126

144-
int move_lim = (int)(placer_opts.anneal_sched.inner_num * pow(net_list.blocks().size(), 1.3333));
145-
146127
auto& place_ctx = g_vpr_ctx.mutable_placement();
147128
place_ctx.lock_loc_vars();
148129
place_ctx.compressed_block_grids = create_compressed_block_grids();
@@ -158,73 +139,11 @@ void try_place(const Netlist<>& net_list,
158139
const int width_fac = placer_opts.place_chan_width;
159140
init_draw_coords((float)width_fac, placer.placer_state_.blk_loc_registry());
160141

161-
sprintf(msg,
162-
"Initial Placement. Cost: %g BB Cost: %g TD Cost %g \t Channel Factor: %d",
163-
costs.cost, costs.bb_cost, costs.timing_cost, width_fac);
164-
165-
// Draw the initial placement
166-
update_screen(ScreenUpdatePriority::MAJOR, msg, PLACEMENT, timing_info);
167-
168-
if (placer_opts.placement_saves_per_temperature >= 1) {
169-
std::string filename = vtr::string_fmt("placement_%03d_%03d.place", 0,
170-
0);
171-
VTR_LOG("Saving initial placement to file: %s\n", filename.c_str());
172-
print_place(nullptr, nullptr, filename.c_str(), blk_loc_registry.block_locs());
173-
}
174-
175-
//Some stats
176-
VTR_LOG("\n");
177-
VTR_LOG("Swaps called: %d\n", swap_stats.num_ts_called);
178-
blocks_affected.move_abortion_logger.report_aborted_moves();
179-
180-
if (placer_opts.place_algorithm.is_timing_driven()) {
181-
//Final timing estimate
182-
VTR_ASSERT(timing_info);
183-
184-
critical_path = timing_info->least_slack_critical_path();
185-
186-
if (isEchoFileEnabled(E_ECHO_FINAL_PLACEMENT_TIMING_GRAPH)) {
187-
tatum::write_echo(getEchoFileName(E_ECHO_FINAL_PLACEMENT_TIMING_GRAPH),
188-
*timing_ctx.graph, *timing_ctx.constraints,
189-
*placement_delay_calc, timing_info->analyzer());
190-
191-
tatum::NodeId debug_tnode = id_or_pin_name_to_tnode(analysis_opts.echo_dot_timing_graph_node);
192-
write_setup_timing_graph_dot(getEchoFileName(E_ECHO_FINAL_PLACEMENT_TIMING_GRAPH) + std::string(".dot"),
193-
*timing_info, debug_tnode);
194-
}
195-
196-
generate_post_place_timing_reports(placer_opts, analysis_opts, *timing_info,
197-
*placement_delay_calc, is_flat, blk_loc_registry);
198-
199-
// Print critical path delay metrics
200-
VTR_LOG("\n");
201-
print_setup_timing_summary(*timing_ctx.constraints,
202-
*timing_info->setup_analyzer(), "Placement estimated ", "");
203-
}
204-
205-
sprintf(msg,
206-
"Placement. Cost: %g bb_cost: %g td_cost: %g Channel Factor: %d",
207-
costs.cost, costs.bb_cost, costs.timing_cost, width_fac);
208-
VTR_LOG("Placement cost: %g, bb_cost: %g, td_cost: %g, \n", costs.cost,
209-
costs.bb_cost, costs.timing_cost);
210-
// print the noc costs info
211-
if (noc_opts.noc) {
212-
VTR_ASSERT(noc_cost_handler.has_value());
213-
noc_cost_handler->print_noc_costs("\nNoC Placement Costs", costs, noc_opts);
214-
215-
#ifdef ENABLE_NOC_SAT_ROUTING
216-
if (costs.noc_cost_terms.congestion > 0.0) {
217-
VTR_LOG("NoC routing configuration is congested. Invoking the SAT NoC router.\n");
218-
invoke_sat_router(costs, noc_opts, placer_opts.seed);
219-
}
220-
#endif //ENABLE_NOC_SAT_ROUTING
221-
}
222-
223-
update_screen(ScreenUpdatePriority::MAJOR, msg, PLACEMENT, timing_info);
142+
placer.place();
224143

225144
free_placement_structs();
226145

227-
copy_locs_to_global_state(blk_loc_registry);
146+
placer.copy_locs_to_global_state();
228147
}
229148

230149
/*only count non-global connections */
@@ -269,7 +188,7 @@ static bool is_cube_bb(const e_place_bounding_box_mode place_bb_mode,
269188
return cube_bb;
270189
}
271190

272-
/* Frees the major structures needed by the placer (and not needed *
191+
/* Frees the major structures needed by the placer (and not needed
273192
* elsewhere). */
274193
static void free_placement_structs() {
275194
auto& place_ctx = g_vpr_ctx.mutable_placement();
@@ -295,27 +214,6 @@ void print_clb_placement(const char* fname) {
295214
}
296215
#endif
297216

298-
static void generate_post_place_timing_reports(const t_placer_opts& placer_opts,
299-
const t_analysis_opts& analysis_opts,
300-
const SetupTimingInfo& timing_info,
301-
const PlacementDelayCalculator& delay_calc,
302-
bool is_flat,
303-
const BlkLocRegistry& blk_loc_registry) {
304-
const auto& timing_ctx = g_vpr_ctx.timing();
305-
const auto& atom_ctx = g_vpr_ctx.atom();
306-
307-
VprTimingGraphResolver resolver(atom_ctx.nlist, atom_ctx.lookup, *timing_ctx.graph,
308-
delay_calc, is_flat, blk_loc_registry);
309-
resolver.set_detail_level(analysis_opts.timing_report_detail);
310-
311-
tatum::TimingReporter timing_reporter(resolver, *timing_ctx.graph,
312-
*timing_ctx.constraints);
313-
314-
timing_reporter.report_timing_setup(
315-
placer_opts.post_place_timing_report_file,
316-
*timing_info.setup_analyzer(), analysis_opts.timing_report_npaths);
317-
}
318-
319217
#if 0
320218
static void update_screen_debug();
321219

@@ -327,18 +225,3 @@ static void update_screen_debug() {
327225
}
328226
#endif
329227

330-
static void copy_locs_to_global_state(const BlkLocRegistry& blk_loc_registry) {
331-
auto& place_ctx = g_vpr_ctx.mutable_placement();
332-
333-
// the placement location variables should be unlocked before being accessed
334-
place_ctx.unlock_loc_vars();
335-
336-
// copy the local location variables into the global state
337-
auto& global_blk_loc_registry = place_ctx.mutable_blk_loc_registry();
338-
global_blk_loc_registry = blk_loc_registry;
339-
340-
#ifndef NO_GRAPHICS
341-
// update the graphics' reference to placement location variables
342-
get_draw_state_vars()->set_graphics_blk_loc_registry_ref(global_blk_loc_registry);
343-
#endif
344-
}

vpr/src/place/place_log_util.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
#include "vtr_log.h"
44
#include "annealer.h"
55
#include "place_util.h"
6+
#include "PostClusterDelayCalculator.h"
7+
#include "tatum/TimingReporter.hpp"
8+
#include "VprTimingGraphResolver.h"
9+
#include "timing_info.h"
610

711
void print_place_status_header(bool noc_enabled) {
812
VTR_LOG("\n");
@@ -116,4 +120,25 @@ void print_placement_swaps_stats(const t_annealing_state& state, const t_swap_st
116120
swap_stats.num_swap_rejected, 100 * reject_rate);
117121
VTR_LOG("\tSwaps aborted: %*d (%4.1f %%)\n", num_swap_print_digits,
118122
swap_stats.num_swap_aborted, 100 * abort_rate);
123+
}
124+
125+
void generate_post_place_timing_reports(const t_placer_opts& placer_opts,
126+
const t_analysis_opts& analysis_opts,
127+
const SetupTimingInfo& timing_info,
128+
const PlacementDelayCalculator& delay_calc,
129+
bool is_flat,
130+
const BlkLocRegistry& blk_loc_registry) {
131+
const auto& timing_ctx = g_vpr_ctx.timing();
132+
const auto& atom_ctx = g_vpr_ctx.atom();
133+
134+
VprTimingGraphResolver resolver(atom_ctx.nlist, atom_ctx.lookup, *timing_ctx.graph,
135+
delay_calc, is_flat, blk_loc_registry);
136+
resolver.set_detail_level(analysis_opts.timing_report_detail);
137+
138+
tatum::TimingReporter timing_reporter(resolver, *timing_ctx.graph,
139+
*timing_ctx.constraints);
140+
141+
timing_reporter.report_timing_setup(
142+
placer_opts.post_place_timing_report_file,
143+
*timing_info.setup_analyzer(), analysis_opts.timing_report_npaths);
119144
}

vpr/src/place/place_log_util.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44

55
#include <cstddef>
66

7+
#include "timing_info_fwd.h"
8+
#include "PlacementDelayCalculator.h"
9+
710
class t_annealing_state;
811
class t_placer_statistics;
12+
struct t_placer_opts;
13+
struct t_analysis_opts;
914
struct NocCostTerms;
1015
struct t_swap_stats;
1116
class BlkLocRegistry;
@@ -26,4 +31,11 @@ void print_resources_utilization(const BlkLocRegistry& blk_loc_registry);
2631

2732
void print_placement_swaps_stats(const t_annealing_state& state, const t_swap_stats& swap_stats);
2833

34+
void generate_post_place_timing_reports(const t_placer_opts& placer_opts,
35+
const t_analysis_opts& analysis_opts,
36+
const SetupTimingInfo& timing_info,
37+
const PlacementDelayCalculator& delay_calc,
38+
bool is_flat,
39+
const BlkLocRegistry& blk_loc_registry);
40+
2941
#endif //VTR_PLACE_LOG_UTIL_H

0 commit comments

Comments
 (0)