Skip to content

Commit aa53d97

Browse files
add some comments
1 parent b1c296a commit aa53d97

File tree

5 files changed

+51
-17
lines changed

5 files changed

+51
-17
lines changed

vpr/src/place/place.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ void try_place(const Netlist<>& net_list,
5757
const auto& device_ctx = g_vpr_ctx.device();
5858

5959
/* Placement delay model is independent of the placement and can be shared across
60-
* multiple placers. So, it is created and initialized once. */
60+
* multiple placers if we are performing parallel annealing.
61+
* So, it is created and initialized once. */
6162
std::shared_ptr<PlaceDelayModel> place_delay_model;
6263

6364
if (placer_opts.place_algorithm.is_timing_driven()) {
@@ -84,6 +85,11 @@ void try_place(const Netlist<>& net_list,
8485
VTR_LOG("\n");
8586

8687
auto& place_ctx = g_vpr_ctx.mutable_placement();
88+
89+
/* Make the global instance of BlkLocRegistry inaccessible through the getter methods of the
90+
* placement context. This is done to make sure that the placement stage only accesses its
91+
* own local instances of BlkLocRegistry.
92+
*/
8793
place_ctx.lock_loc_vars();
8894
place_ctx.compressed_block_grids = create_compressed_block_grids();
8995

vpr/src/place/place_log_util.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ void PlacementLogPrinter::print_placement_swaps_stats() const {
165165
VTR_LOG("\tSwaps aborted: %*d (%4.1f %%)\n", num_swap_print_digits,
166166
swap_stats.num_swap_aborted, 100 * abort_rate);
167167
}
168+
168169
void PlacementLogPrinter::print_initial_placement_stats() const {
169170
if (quiet_) {
170171
return;

vpr/src/place/placer.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Placer::Placer(const Netlist<>& net_list,
7979

8080
#ifdef ENABLE_ANALYTIC_PLACE
8181
/*
82-
* Analytic Placer:
82+
* Cluster-level Analytic Placer:
8383
* Passes in the initial_placement via vpr_context, and passes its placement back via locations marked on
8484
* both the clb_netlist and the gird.
8585
* Most of anneal is disabled later by setting initial temperature to 0 and only further optimizes in quench
@@ -284,7 +284,7 @@ void Placer::place() {
284284
#endif
285285

286286
if (!skip_anneal) {
287-
//Table header
287+
// Table header
288288
log_printer_.print_place_status_header();
289289

290290
// Outer loop of the simulated annealing begins
@@ -309,12 +309,6 @@ void Placer::place() {
309309

310310
log_printer_.print_place_status(temperature_timer.elapsed_sec());
311311

312-
//#ifdef VERBOSE
313-
// if (getEchoEnabled()) {
314-
// print_clb_placement("first_iteration_clb_placement.echo");
315-
// }
316-
//#endif
317-
318312
// Outer loop of the simulated annealing ends
319313
} while (annealer_->outer_loop_update_state());
320314
} //skip_anneal ends
@@ -372,12 +366,6 @@ void Placer::place() {
372366
print_place(nullptr, nullptr, filename.c_str(), placer_state_.mutable_block_locs());
373367
}
374368

375-
//#ifdef VERBOSE
376-
// if (getEchoEnabled() && isEchoFileEnabled(E_ECHO_END_CLB_PLACEMENT)) {
377-
// print_clb_placement(getEchoFileName(E_ECHO_END_CLB_PLACEMENT));
378-
// }
379-
//#endif
380-
381369
// Update physical pin values
382370
for (const ClusterBlockId block_id : cluster_ctx.clb_nlist.blocks()) {
383371
placer_state_.mutable_blk_loc_registry().place_sync_external_block_connections(block_id);

vpr/src/place/placer.h

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,28 +79,67 @@ class Placer {
7979

8080
/// Stores a placement state as a retrievable checkpoint in case the placement quality deteriorates later.
8181
t_placement_checkpoint placement_checkpoint_;
82-
82+
/// It holds a setup timing analysis engine. Other placement timing object usually have a reference or pointer to timing_info.
8383
std::shared_ptr<SetupTimingInfo> timing_info_;
84+
/// Post-clustering delay calculator. Its API allows extraction of delay for each timing edge.
8485
std::shared_ptr<PlacementDelayCalculator> placement_delay_calc_;
86+
/// Stores setup slack of the clustered netlist connections.
8587
std::unique_ptr<PlacerSetupSlacks> placer_setup_slacks_;
88+
/// Stores criticalities of the clustered netlist connections.
8689
std::unique_ptr<PlacerCriticalities> placer_criticalities_;
90+
/// Used to invalidate timing edges corresponding to the pins of moved blocks.
8791
std::unique_ptr<NetPinTimingInvalidator> pin_timing_invalidator_;
92+
/// Stores information about the critical path. This is usually updated after that timing info is updated.
8893
tatum::TimingPathInfo critical_path_;
8994

9095
std::unique_ptr<vtr::ScopedStartFinishTimer> timer_;
9196

9297
IntraLbPbPinLookup pb_gpin_lookup_;
9398
ClusteredPinAtomPinsLookup netlist_pin_lookup_;
9499

100+
/// Performs random swaps and implements the simulated annealer optimizer.
95101
std::unique_ptr<PlacementAnnealer> annealer_;
96102

103+
/* These variables store timing analysis profiling information
104+
* at different stages of the placement to be printed at the end
105+
*/
97106
t_timing_analysis_profile_info pre_place_timing_stats_;
98107
t_timing_analysis_profile_info pre_quench_timing_stats_;
99108
t_timing_analysis_profile_info post_quench_timing_stats_;
100109

110+
/* PlacementLogPrinter is made a friend of this class, so it can
111+
* access its private member variables without getter methods.
112+
* PlacementLogPrinter holds a constant reference to an object of type
113+
* Placer to avoid modifying its member variables.
114+
*/
101115
friend class PlacementLogPrinter;
102116

103117
private:
118+
/**
119+
* @brief Constructs and initializes timing-related objects.
120+
*
121+
* This function performs the following steps to set up timing analysis:
122+
*
123+
* 1. Constructs a `tatum::DelayCalculator` for post-clustering delay calculations.
124+
* This calculator holds a reference to `PlacerTimingContext::connection_delay`,
125+
* which contains net delays based on block locations.
126+
*
127+
* 2. Creates and stores a `SetupTimingInfo` object in `timing_info_`.
128+
* This object utilizes the delay calculator to compute delays on timing edges
129+
* and calculate setup times.
130+
*
131+
* 3. Constructs `PlacerSetupSlacks` and `PlacerCriticalities` objects,
132+
* which translate arrival and required times into slacks and criticalities,
133+
* respectively.
134+
*
135+
* 4. Creates a `NetPinTimingInvalidator` object to mark timing edges
136+
* corresponding to the pins of moved blocks as invalid.
137+
*
138+
* 5. Performs a full timing analysis by marking all pins as invalid.
139+
*
140+
* @param net_list The netlist used for iterating over pins.
141+
* @param analysis_opts Analysis options, including whether to echo the timing graph.
142+
*/
104143
void alloc_and_init_timing_objects_(const Netlist<>& net_list,
105144
const t_analysis_opts& analysis_opts);
106145

vpr/src/timing/timing_info.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class SetupTimingInfo : public virtual TimingInfo {
6262
//Return the critical path with the least slack
6363
virtual tatum::TimingPathInfo least_slack_critical_path() const = 0;
6464

65-
//Return the critical path the the longest absolute delay
65+
//Return the critical path the longest absolute delay
6666
virtual tatum::TimingPathInfo longest_critical_path() const = 0;
6767

6868
//Return the set of critical paths between all clock domain pairs

0 commit comments

Comments
 (0)