Skip to content

Commit

Permalink
move the construction of pb_gpin_lookup and netlist_pin_lookup to try…
Browse files Browse the repository at this point in the history
…_place
  • Loading branch information
soheilshahrouz committed Nov 27, 2024
1 parent 1dcd63b commit be43312
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
10 changes: 9 additions & 1 deletion vpr/src/place/place.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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();

Expand Down
11 changes: 4 additions & 7 deletions vpr/src/place/placer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<t_direct_inf>& directs,
std::shared_ptr<PlaceDelayModel> place_delay_model,
bool cube_bb,
Expand All @@ -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)
Expand All @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
9 changes: 6 additions & 3 deletions vpr/src/place/placer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<t_direct_inf>& directs,
std::shared_ptr<PlaceDelayModel> place_delay_model,
bool cube_bb,
Expand All @@ -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
Expand Down Expand Up @@ -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<PlacementAnnealer> annealer_;

Expand Down

0 comments on commit be43312

Please sign in to comment.