Skip to content

Commit be43312

Browse files
move the construction of pb_gpin_lookup and netlist_pin_lookup to try_place
1 parent 1dcd63b commit be43312

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

vpr/src/place/place.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ void try_place(const Netlist<>& net_list,
5555
*/
5656
VTR_ASSERT(!is_flat);
5757
const auto& device_ctx = g_vpr_ctx.device();
58+
const auto& cluster_ctx = g_vpr_ctx.clustering();
59+
const auto& atom_ctx = g_vpr_ctx.atom();
5860

5961
/* Placement delay model is independent of the placement and can be shared across
6062
* multiple placers if we are performing parallel annealing.
@@ -98,7 +100,13 @@ void try_place(const Netlist<>& net_list,
98100
*/
99101
vtr::ScopedStartFinishTimer placement_timer("Placement");
100102

101-
Placer placer(net_list, placer_opts, analysis_opts, noc_opts, directs, place_delay_model, cube_bb, is_flat, /*quiet=*/false);
103+
// Enables fast look-up pb graph pins from block pin indices
104+
IntraLbPbPinLookup pb_gpin_lookup(device_ctx.logical_block_types);
105+
// Enables fast look-up of atom pins connect to CLB pins
106+
ClusteredPinAtomPinsLookup netlist_pin_lookup(cluster_ctx.clb_nlist, atom_ctx.nlist, pb_gpin_lookup);
107+
108+
Placer placer(net_list, placer_opts, analysis_opts, noc_opts, pb_gpin_lookup, netlist_pin_lookup,
109+
directs, place_delay_model, cube_bb, is_flat, /*quiet=*/false);
102110

103111
placer.place();
104112

vpr/src/place/placer.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Placer::Placer(const Netlist<>& net_list,
2020
const t_placer_opts& placer_opts,
2121
const t_analysis_opts& analysis_opts,
2222
const t_noc_opts& noc_opts,
23+
const IntraLbPbPinLookup& pb_gpin_lookup,
24+
const ClusteredPinAtomPinsLookup& netlist_pin_lookup,
2325
const std::vector<t_direct_inf>& directs,
2426
std::shared_ptr<PlaceDelayModel> place_delay_model,
2527
bool cube_bb,
@@ -28,6 +30,8 @@ Placer::Placer(const Netlist<>& net_list,
2830
: placer_opts_(placer_opts)
2931
, analysis_opts_(analysis_opts)
3032
, noc_opts_(noc_opts)
33+
, pb_gpin_lookup_(pb_gpin_lookup)
34+
, netlist_pin_lookup_(netlist_pin_lookup)
3135
, costs_(placer_opts.place_algorithm, noc_opts.noc)
3236
, placer_state_(placer_opts.place_algorithm.is_timing_driven(), cube_bb)
3337
, rng_(placer_opts.seed)
@@ -36,8 +40,6 @@ Placer::Placer(const Netlist<>& net_list,
3640
, log_printer_(*this, quiet)
3741
, is_flat_(is_flat) {
3842
const auto& cluster_ctx = g_vpr_ctx.clustering();
39-
const auto& device_ctx = g_vpr_ctx.device();
40-
const auto& atom_ctx = g_vpr_ctx.atom();
4143

4244
pre_place_timing_stats_ = g_vpr_ctx.timing().stats;
4345

@@ -102,11 +104,6 @@ Placer::Placer(const Netlist<>& net_list,
102104
init_draw_coords((float)width_fac, placer_state_.blk_loc_registry());
103105
}
104106

105-
// Allocate here because it goes into timing critical code where each memory allocation is expensive
106-
pb_gpin_lookup_ = IntraLbPbPinLookup(device_ctx.logical_block_types);
107-
// Enables fast look-up of atom pins connect to CLB pins
108-
netlist_pin_lookup_ = ClusteredPinAtomPinsLookup(cluster_ctx.clb_nlist, atom_ctx.nlist, pb_gpin_lookup_);
109-
110107
// Gets initial cost and loads bounding boxes.
111108
costs_.bb_cost = net_cost_handler_.comp_bb_cost(e_cost_methods::NORMAL);
112109
costs_.bb_cost_norm = 1 / costs_.bb_cost;

vpr/src/place/placer.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ class Placer {
3939
const t_placer_opts& placer_opts,
4040
const t_analysis_opts& analysis_opts,
4141
const t_noc_opts& noc_opts,
42+
const IntraLbPbPinLookup& pb_gpin_lookup,
43+
const ClusteredPinAtomPinsLookup& netlist_pin_lookup,
4244
const std::vector<t_direct_inf>& directs,
4345
std::shared_ptr<PlaceDelayModel> place_delay_model,
4446
bool cube_bb,
@@ -60,6 +62,10 @@ class Placer {
6062
const t_analysis_opts& analysis_opts_;
6163
/// Holds NoC-related parameters
6264
const t_noc_opts& noc_opts_;
65+
/// Enables fast look-up pb graph pins from block pin indices
66+
const IntraLbPbPinLookup& pb_gpin_lookup_;
67+
/// Enables fast look-up of atom pins connect to CLB pins
68+
const ClusteredPinAtomPinsLookup& netlist_pin_lookup_;
6369
/// Placement cost terms with their normalization factors and total cost
6470
t_placer_costs costs_;
6571
/// Holds timing, runtime, and block location information
@@ -96,9 +102,6 @@ class Placer {
96102
/// Stores information about the critical path. This is usually updated after that timing info is updated.
97103
tatum::TimingPathInfo critical_path_;
98104

99-
IntraLbPbPinLookup pb_gpin_lookup_;
100-
ClusteredPinAtomPinsLookup netlist_pin_lookup_;
101-
102105
/// Performs random swaps and implements the simulated annealer optimizer.
103106
std::unique_ptr<PlacementAnnealer> annealer_;
104107

0 commit comments

Comments
 (0)