diff --git a/vpr/src/place/place.cpp b/vpr/src/place/place.cpp index 80a3b6edc2..3506d00b80 100644 --- a/vpr/src/place/place.cpp +++ b/vpr/src/place/place.cpp @@ -55,6 +55,8 @@ void try_place(const Netlist<>& net_list, */ VTR_ASSERT(!is_flat); const auto& device_ctx = g_vpr_ctx.device(); + const auto& cluster_ctx = g_vpr_ctx.clustering(); + const auto& atom_ctx = g_vpr_ctx.atom(); /* Placement delay model is independent of the placement and can be shared across * multiple placers if we are performing parallel annealing. @@ -98,7 +100,13 @@ void try_place(const Netlist<>& net_list, */ vtr::ScopedStartFinishTimer placement_timer("Placement"); - Placer placer(net_list, placer_opts, analysis_opts, noc_opts, directs, place_delay_model, cube_bb, is_flat, /*quiet=*/false); + // Enables fast look-up pb graph pins from block pin indices + IntraLbPbPinLookup pb_gpin_lookup(device_ctx.logical_block_types); + // Enables fast look-up of atom pins connect to CLB pins + ClusteredPinAtomPinsLookup netlist_pin_lookup(cluster_ctx.clb_nlist, atom_ctx.nlist, pb_gpin_lookup); + + Placer placer(net_list, placer_opts, analysis_opts, noc_opts, pb_gpin_lookup, netlist_pin_lookup, + directs, place_delay_model, cube_bb, is_flat, /*quiet=*/false); placer.place(); diff --git a/vpr/src/place/placer.cpp b/vpr/src/place/placer.cpp index cc3bd20f0c..37b48f11d0 100644 --- a/vpr/src/place/placer.cpp +++ b/vpr/src/place/placer.cpp @@ -20,6 +20,8 @@ Placer::Placer(const Netlist<>& net_list, const t_placer_opts& placer_opts, const t_analysis_opts& analysis_opts, const t_noc_opts& noc_opts, + const IntraLbPbPinLookup& pb_gpin_lookup, + const ClusteredPinAtomPinsLookup& netlist_pin_lookup, const std::vector& directs, std::shared_ptr place_delay_model, bool cube_bb, @@ -28,6 +30,8 @@ Placer::Placer(const Netlist<>& net_list, : placer_opts_(placer_opts) , analysis_opts_(analysis_opts) , noc_opts_(noc_opts) + , pb_gpin_lookup_(pb_gpin_lookup) + , netlist_pin_lookup_(netlist_pin_lookup) , costs_(placer_opts.place_algorithm, noc_opts.noc) , placer_state_(placer_opts.place_algorithm.is_timing_driven(), cube_bb) , rng_(placer_opts.seed) @@ -36,8 +40,6 @@ Placer::Placer(const Netlist<>& net_list, , log_printer_(*this, quiet) , is_flat_(is_flat) { const auto& cluster_ctx = g_vpr_ctx.clustering(); - const auto& device_ctx = g_vpr_ctx.device(); - const auto& atom_ctx = g_vpr_ctx.atom(); pre_place_timing_stats_ = g_vpr_ctx.timing().stats; @@ -102,11 +104,6 @@ Placer::Placer(const Netlist<>& net_list, init_draw_coords((float)width_fac, placer_state_.blk_loc_registry()); } - // Allocate here because it goes into timing critical code where each memory allocation is expensive - pb_gpin_lookup_ = IntraLbPbPinLookup(device_ctx.logical_block_types); - // Enables fast look-up of atom pins connect to CLB pins - netlist_pin_lookup_ = ClusteredPinAtomPinsLookup(cluster_ctx.clb_nlist, atom_ctx.nlist, pb_gpin_lookup_); - // Gets initial cost and loads bounding boxes. costs_.bb_cost = net_cost_handler_.comp_bb_cost(e_cost_methods::NORMAL); costs_.bb_cost_norm = 1 / costs_.bb_cost; diff --git a/vpr/src/place/placer.h b/vpr/src/place/placer.h index dbbe7466e7..086630e2c0 100644 --- a/vpr/src/place/placer.h +++ b/vpr/src/place/placer.h @@ -39,6 +39,8 @@ class Placer { const t_placer_opts& placer_opts, const t_analysis_opts& analysis_opts, const t_noc_opts& noc_opts, + const IntraLbPbPinLookup& pb_gpin_lookup, + const ClusteredPinAtomPinsLookup& netlist_pin_lookup, const std::vector& directs, std::shared_ptr place_delay_model, bool cube_bb, @@ -60,6 +62,10 @@ class Placer { const t_analysis_opts& analysis_opts_; /// Holds NoC-related parameters const t_noc_opts& noc_opts_; + /// Enables fast look-up pb graph pins from block pin indices + const IntraLbPbPinLookup& pb_gpin_lookup_; + /// Enables fast look-up of atom pins connect to CLB pins + const ClusteredPinAtomPinsLookup& netlist_pin_lookup_; /// Placement cost terms with their normalization factors and total cost t_placer_costs costs_; /// Holds timing, runtime, and block location information @@ -96,9 +102,6 @@ class Placer { /// Stores information about the critical path. This is usually updated after that timing info is updated. tatum::TimingPathInfo critical_path_; - IntraLbPbPinLookup pb_gpin_lookup_; - ClusteredPinAtomPinsLookup netlist_pin_lookup_; - /// Performs random swaps and implements the simulated annealer optimizer. std::unique_ptr annealer_;