Skip to content

Commit 877fd8e

Browse files
remove accessor methods from Placer
1 parent e93d898 commit 877fd8e

File tree

3 files changed

+23
-80
lines changed

3 files changed

+23
-80
lines changed

vpr/src/place/place_log_util.cpp

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void PlacementLogPrinter::print_place_status_header() const {
2323
return;
2424
}
2525

26-
const bool noc_enabled = placer_.noc_opts().noc;
26+
const bool noc_enabled = placer_.noc_opts_.noc;
2727

2828
VTR_LOG("\n");
2929
if (!noc_enabled) {
@@ -52,20 +52,20 @@ void PlacementLogPrinter::print_place_status(float elapsed_sec) const {
5252
return;
5353
}
5454

55-
const PlacementAnnealer& annealer = placer_.annealer();
55+
const PlacementAnnealer& annealer = *placer_.annealer_;
5656
const t_annealing_state& annealing_state = annealer.get_annealing_state();
5757
const auto& [swap_stats, move_type_stats, placer_stats] = annealer.get_stats();
5858
const int tot_moves = annealer.get_total_iteration();
59-
const t_placer_costs& costs = placer_.costs();
60-
std::shared_ptr<const SetupTimingInfo> timing_info = placer_.timing_info();
59+
const t_placer_costs& costs = placer_.costs_;
60+
std::shared_ptr<const SetupTimingInfo> timing_info = placer_.timing_info_;
6161

62-
const bool noc_enabled = placer_.noc_opts().noc;
63-
const NocCostTerms& noc_cost_terms = placer_.costs().noc_cost_terms;
62+
const bool noc_enabled = placer_.noc_opts_.noc;
63+
const NocCostTerms& noc_cost_terms = placer_.costs_.noc_cost_terms;
6464

65-
const bool is_timing_driven = placer_.placer_opts().place_algorithm.is_timing_driven();
66-
const float cpd = is_timing_driven ? placer_.critical_path().delay() : std::numeric_limits<float>::quiet_NaN();
67-
const float sTNS = is_timing_driven ? placer_.timing_info()->setup_total_negative_slack() : std::numeric_limits<float>::quiet_NaN();
68-
const float sWNS = is_timing_driven ? placer_.timing_info()->setup_worst_negative_slack() : std::numeric_limits<float>::quiet_NaN();
65+
const bool is_timing_driven = placer_.placer_opts_.place_algorithm.is_timing_driven();
66+
const float cpd = is_timing_driven ? placer_.critical_path_.delay() : std::numeric_limits<float>::quiet_NaN();
67+
const float sTNS = is_timing_driven ? placer_.timing_info_->setup_total_negative_slack() : std::numeric_limits<float>::quiet_NaN();
68+
const float sWNS = is_timing_driven ? placer_.timing_info_->setup_worst_negative_slack() : std::numeric_limits<float>::quiet_NaN();
6969

7070
VTR_LOG(
7171
"%4zu %6.1f %7.1e "
@@ -105,7 +105,7 @@ void PlacementLogPrinter::print_resources_utilization() const {
105105

106106
const auto& cluster_ctx = g_vpr_ctx.clustering();
107107
const auto& device_ctx = g_vpr_ctx.device();
108-
const auto& block_locs = placer_.placer_state().block_locs();
108+
const auto& block_locs = placer_.placer_state_.block_locs();
109109

110110
size_t max_block_name = 0;
111111
size_t max_tile_name = 0;
@@ -144,7 +144,7 @@ void PlacementLogPrinter::print_placement_swaps_stats() const {
144144
return;
145145
}
146146

147-
const PlacementAnnealer& annealer = placer_.annealer();
147+
const PlacementAnnealer& annealer = *placer_.annealer_;
148148
const auto& [swap_stats, move_type_stats, placer_stats] = annealer.get_stats();
149149
const t_annealing_state& annealing_state = annealer.get_annealing_state();
150150

@@ -170,25 +170,21 @@ void PlacementLogPrinter::print_initial_placement_stats() const {
170170
return;
171171
}
172172

173-
const t_placer_costs& costs = placer_.costs();
174-
const t_noc_opts& noc_opts = placer_.noc_opts();
175-
const t_placer_opts& placer_opts = placer_.placer_opts();
176-
const tatum::TimingPathInfo& critical_path = placer_.critical_path();
177-
const std::optional<NocCostHandler>& noc_cost_handler = placer_.noc_cost_handler();
178-
std::shared_ptr<const SetupTimingInfo> timing_info = placer_.timing_info();
179-
const PlacerState& placer_state = placer_.placer_state();
173+
const t_placer_costs& costs = placer_.costs_;
174+
const t_placer_opts& placer_opts = placer_.placer_opts_;
175+
std::shared_ptr<const SetupTimingInfo> timing_info = placer_.timing_info_;
180176

181177
VTR_LOG("Initial placement cost: %g bb_cost: %g td_cost: %g\n",
182178
costs.cost, costs.bb_cost, costs.timing_cost);
183179

184-
if (noc_opts.noc) {
185-
VTR_ASSERT(noc_cost_handler.has_value());
186-
noc_cost_handler->print_noc_costs("Initial NoC Placement Costs", costs, noc_opts);
180+
if (placer_.noc_opts_.noc) {
181+
VTR_ASSERT(placer_.noc_cost_handler_.has_value());
182+
placer_.noc_cost_handler_->print_noc_costs("Initial NoC Placement Costs", costs, placer_.noc_opts_);
187183
}
188184

189185
if (placer_opts.place_algorithm.is_timing_driven()) {
190186
VTR_LOG("Initial placement estimated Critical Path Delay (CPD): %g ns\n",
191-
1e9 * critical_path.delay());
187+
1e9 * placer_.critical_path_.delay());
192188
VTR_LOG("Initial placement estimated setup Total Negative Slack (sTNS): %g ns\n",
193189
1e9 * timing_info->setup_total_negative_slack());
194190
VTR_LOG("Initial placement estimated setup Worst Negative Slack (sWNS): %g ns\n",
@@ -198,7 +194,7 @@ void PlacementLogPrinter::print_initial_placement_stats() const {
198194
print_histogram(create_setup_slack_histogram(*timing_info->setup_analyzer()));
199195
}
200196

201-
const BlkLocRegistry& blk_loc_registry = placer_state.blk_loc_registry();
197+
const BlkLocRegistry& blk_loc_registry = placer_.placer_state_.blk_loc_registry();
202198
size_t num_macro_members = 0;
203199
for (const t_pl_macro& macro : blk_loc_registry.place_macros().macros()) {
204200
num_macro_members += macro.members.size();
@@ -228,12 +224,11 @@ void PlacementLogPrinter::print_post_placement_stats() const {
228224
}
229225

230226
const auto& timing_ctx = g_vpr_ctx.timing();
231-
const PlacementAnnealer& annealer = placer_.annealer();
232-
const auto& [swap_stats, move_type_stats, placer_stats] = annealer.get_stats();
227+
const auto& [swap_stats, move_type_stats, placer_stats] = placer_.annealer_->get_stats();
233228

234229
VTR_LOG("\n");
235230
VTR_LOG("Swaps called: %d\n", swap_stats.num_ts_called);
236-
annealer.get_move_abortion_logger().report_aborted_moves();
231+
placer_.annealer_->get_move_abortion_logger().report_aborted_moves();
237232

238233
if (placer_.placer_opts_.place_algorithm.is_timing_driven()) {
239234
//Final timing estimate

vpr/src/place/placer.cpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -399,35 +399,3 @@ void Placer::copy_locs_to_global_state(PlacementContext& place_ctx) {
399399
get_draw_state_vars()->set_graphics_blk_loc_registry_ref(global_blk_loc_registry);
400400
#endif
401401
}
402-
403-
const PlacementAnnealer& Placer::annealer() const {
404-
return *annealer_;
405-
}
406-
407-
const t_placer_opts& Placer::placer_opts() const {
408-
return placer_opts_;
409-
}
410-
411-
const t_noc_opts& Placer::noc_opts() const {
412-
return noc_opts_;
413-
}
414-
415-
const t_placer_costs& Placer::costs() const {
416-
return costs_;
417-
}
418-
419-
const tatum::TimingPathInfo& Placer::critical_path() const {
420-
return critical_path_;
421-
}
422-
423-
std::shared_ptr<const SetupTimingInfo> Placer::timing_info() const {
424-
return timing_info_;
425-
}
426-
427-
const PlacerState& Placer::placer_state() const {
428-
return placer_state_;
429-
}
430-
431-
const std::optional<NocCostHandler>& Placer::noc_cost_handler() const {
432-
return noc_cost_handler_;
433-
}

vpr/src/place/placer.h

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,6 @@ class Placer {
5353
*/
5454
void copy_locs_to_global_state(PlacementContext& place_ctx);
5555

56-
/*
57-
* Getters
58-
*/
59-
const PlacementAnnealer& annealer() const;
60-
61-
const t_placer_opts& placer_opts() const;
62-
63-
const t_noc_opts& noc_opts() const;
64-
65-
const t_placer_costs& costs() const;
66-
67-
const tatum::TimingPathInfo& critical_path() const;
68-
69-
std::shared_ptr<const SetupTimingInfo> timing_info() const;
70-
71-
const PlacerState& placer_state() const;
72-
73-
const std::optional<NocCostHandler>& noc_cost_handler() const;
74-
7556
private:
7657
/// Holds placement algorithm parameters
7758
const t_placer_opts& placer_opts_;
@@ -117,7 +98,7 @@ class Placer {
11798
t_timing_analysis_profile_info pre_quench_timing_stats_;
11899
t_timing_analysis_profile_info post_quench_timing_stats_;
119100

120-
friend void PlacementLogPrinter::print_post_placement_stats() const;
101+
friend class PlacementLogPrinter;
121102

122103
private:
123104
void alloc_and_init_timing_objects_(const Netlist<>& net_list,
@@ -140,4 +121,3 @@ class Placer {
140121
*/
141122
int check_placement_costs_();
142123
};
143-

0 commit comments

Comments
 (0)