diff --git a/vpr/src/place/place_log_util.cpp b/vpr/src/place/place_log_util.cpp index 29ba2b917a..aa02ed96b4 100644 --- a/vpr/src/place/place_log_util.cpp +++ b/vpr/src/place/place_log_util.cpp @@ -23,7 +23,7 @@ void PlacementLogPrinter::print_place_status_header() const { return; } - const bool noc_enabled = placer_.noc_opts().noc; + const bool noc_enabled = placer_.noc_opts_.noc; VTR_LOG("\n"); if (!noc_enabled) { @@ -52,20 +52,20 @@ void PlacementLogPrinter::print_place_status(float elapsed_sec) const { return; } - const PlacementAnnealer& annealer = placer_.annealer(); + const PlacementAnnealer& annealer = *placer_.annealer_; const t_annealing_state& annealing_state = annealer.get_annealing_state(); const auto& [swap_stats, move_type_stats, placer_stats] = annealer.get_stats(); const int tot_moves = annealer.get_total_iteration(); - const t_placer_costs& costs = placer_.costs(); - std::shared_ptr timing_info = placer_.timing_info(); + const t_placer_costs& costs = placer_.costs_; + std::shared_ptr timing_info = placer_.timing_info_; - const bool noc_enabled = placer_.noc_opts().noc; - const NocCostTerms& noc_cost_terms = placer_.costs().noc_cost_terms; + const bool noc_enabled = placer_.noc_opts_.noc; + const NocCostTerms& noc_cost_terms = placer_.costs_.noc_cost_terms; - const bool is_timing_driven = placer_.placer_opts().place_algorithm.is_timing_driven(); - const float cpd = is_timing_driven ? placer_.critical_path().delay() : std::numeric_limits::quiet_NaN(); - const float sTNS = is_timing_driven ? placer_.timing_info()->setup_total_negative_slack() : std::numeric_limits::quiet_NaN(); - const float sWNS = is_timing_driven ? placer_.timing_info()->setup_worst_negative_slack() : std::numeric_limits::quiet_NaN(); + const bool is_timing_driven = placer_.placer_opts_.place_algorithm.is_timing_driven(); + const float cpd = is_timing_driven ? placer_.critical_path_.delay() : std::numeric_limits::quiet_NaN(); + const float sTNS = is_timing_driven ? placer_.timing_info_->setup_total_negative_slack() : std::numeric_limits::quiet_NaN(); + const float sWNS = is_timing_driven ? placer_.timing_info_->setup_worst_negative_slack() : std::numeric_limits::quiet_NaN(); VTR_LOG( "%4zu %6.1f %7.1e " @@ -105,7 +105,7 @@ void PlacementLogPrinter::print_resources_utilization() const { const auto& cluster_ctx = g_vpr_ctx.clustering(); const auto& device_ctx = g_vpr_ctx.device(); - const auto& block_locs = placer_.placer_state().block_locs(); + const auto& block_locs = placer_.placer_state_.block_locs(); size_t max_block_name = 0; size_t max_tile_name = 0; @@ -144,7 +144,7 @@ void PlacementLogPrinter::print_placement_swaps_stats() const { return; } - const PlacementAnnealer& annealer = placer_.annealer(); + const PlacementAnnealer& annealer = *placer_.annealer_; const auto& [swap_stats, move_type_stats, placer_stats] = annealer.get_stats(); const t_annealing_state& annealing_state = annealer.get_annealing_state(); @@ -170,25 +170,21 @@ void PlacementLogPrinter::print_initial_placement_stats() const { return; } - const t_placer_costs& costs = placer_.costs(); - const t_noc_opts& noc_opts = placer_.noc_opts(); - const t_placer_opts& placer_opts = placer_.placer_opts(); - const tatum::TimingPathInfo& critical_path = placer_.critical_path(); - const std::optional& noc_cost_handler = placer_.noc_cost_handler(); - std::shared_ptr timing_info = placer_.timing_info(); - const PlacerState& placer_state = placer_.placer_state(); + const t_placer_costs& costs = placer_.costs_; + const t_placer_opts& placer_opts = placer_.placer_opts_; + std::shared_ptr timing_info = placer_.timing_info_; VTR_LOG("Initial placement cost: %g bb_cost: %g td_cost: %g\n", costs.cost, costs.bb_cost, costs.timing_cost); - if (noc_opts.noc) { - VTR_ASSERT(noc_cost_handler.has_value()); - noc_cost_handler->print_noc_costs("Initial NoC Placement Costs", costs, noc_opts); + if (placer_.noc_opts_.noc) { + VTR_ASSERT(placer_.noc_cost_handler_.has_value()); + placer_.noc_cost_handler_->print_noc_costs("Initial NoC Placement Costs", costs, placer_.noc_opts_); } if (placer_opts.place_algorithm.is_timing_driven()) { VTR_LOG("Initial placement estimated Critical Path Delay (CPD): %g ns\n", - 1e9 * critical_path.delay()); + 1e9 * placer_.critical_path_.delay()); VTR_LOG("Initial placement estimated setup Total Negative Slack (sTNS): %g ns\n", 1e9 * timing_info->setup_total_negative_slack()); VTR_LOG("Initial placement estimated setup Worst Negative Slack (sWNS): %g ns\n", @@ -198,7 +194,7 @@ void PlacementLogPrinter::print_initial_placement_stats() const { print_histogram(create_setup_slack_histogram(*timing_info->setup_analyzer())); } - const BlkLocRegistry& blk_loc_registry = placer_state.blk_loc_registry(); + const BlkLocRegistry& blk_loc_registry = placer_.placer_state_.blk_loc_registry(); size_t num_macro_members = 0; for (const t_pl_macro& macro : blk_loc_registry.place_macros().macros()) { num_macro_members += macro.members.size(); @@ -228,12 +224,11 @@ void PlacementLogPrinter::print_post_placement_stats() const { } const auto& timing_ctx = g_vpr_ctx.timing(); - const PlacementAnnealer& annealer = placer_.annealer(); - const auto& [swap_stats, move_type_stats, placer_stats] = annealer.get_stats(); + const auto& [swap_stats, move_type_stats, placer_stats] = placer_.annealer_->get_stats(); VTR_LOG("\n"); VTR_LOG("Swaps called: %d\n", swap_stats.num_ts_called); - annealer.get_move_abortion_logger().report_aborted_moves(); + placer_.annealer_->get_move_abortion_logger().report_aborted_moves(); if (placer_.placer_opts_.place_algorithm.is_timing_driven()) { //Final timing estimate diff --git a/vpr/src/place/placer.cpp b/vpr/src/place/placer.cpp index 26f7ca2f75..3a56a4e03e 100644 --- a/vpr/src/place/placer.cpp +++ b/vpr/src/place/placer.cpp @@ -399,35 +399,3 @@ void Placer::copy_locs_to_global_state(PlacementContext& place_ctx) { get_draw_state_vars()->set_graphics_blk_loc_registry_ref(global_blk_loc_registry); #endif } - -const PlacementAnnealer& Placer::annealer() const { - return *annealer_; -} - -const t_placer_opts& Placer::placer_opts() const { - return placer_opts_; -} - -const t_noc_opts& Placer::noc_opts() const { - return noc_opts_; -} - -const t_placer_costs& Placer::costs() const { - return costs_; -} - -const tatum::TimingPathInfo& Placer::critical_path() const { - return critical_path_; -} - -std::shared_ptr Placer::timing_info() const { - return timing_info_; -} - -const PlacerState& Placer::placer_state() const { - return placer_state_; -} - -const std::optional& Placer::noc_cost_handler() const { - return noc_cost_handler_; -} diff --git a/vpr/src/place/placer.h b/vpr/src/place/placer.h index ede938482f..a6e6f35cf4 100644 --- a/vpr/src/place/placer.h +++ b/vpr/src/place/placer.h @@ -53,25 +53,6 @@ class Placer { */ void copy_locs_to_global_state(PlacementContext& place_ctx); - /* - * Getters - */ - const PlacementAnnealer& annealer() const; - - const t_placer_opts& placer_opts() const; - - const t_noc_opts& noc_opts() const; - - const t_placer_costs& costs() const; - - const tatum::TimingPathInfo& critical_path() const; - - std::shared_ptr timing_info() const; - - const PlacerState& placer_state() const; - - const std::optional& noc_cost_handler() const; - private: /// Holds placement algorithm parameters const t_placer_opts& placer_opts_; @@ -117,7 +98,7 @@ class Placer { t_timing_analysis_profile_info pre_quench_timing_stats_; t_timing_analysis_profile_info post_quench_timing_stats_; - friend void PlacementLogPrinter::print_post_placement_stats() const; + friend class PlacementLogPrinter; private: void alloc_and_init_timing_objects_(const Netlist<>& net_list, @@ -140,4 +121,3 @@ class Placer { */ int check_placement_costs_(); }; -