Skip to content

Commit f7c239f

Browse files
apply Alex's comments
1 parent c413d22 commit f7c239f

File tree

2 files changed

+31
-19
lines changed

2 files changed

+31
-19
lines changed

libs/EXTERNAL/libtatum/libtatum/tatum/TimingGraph.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,14 +481,13 @@ tatum::util::linear_map<EdgeId,EdgeId> TimingGraph::optimize_edge_layout() const
481481
//Make all edges in a level be contiguous in memory
482482

483483
//Determine the edges driven by each level of the graph
484-
std::vector<std::vector<EdgeId>> edge_levels;
484+
std::vector<std::vector<EdgeId>> edge_levels(levels().size());
485485
for(LevelId level_id : levels()) {
486-
edge_levels.emplace_back();
487-
for(auto node_id : level_nodes(level_id)) {
486+
for(NodeId node_id : level_nodes(level_id)) {
488487

489488
//We walk the nodes according to the input-edge order.
490489
//This is the same order used by the arrival-time traversal (which is responsible
491-
//for most of the analyzer run-time), so matching it's order exactly results in
490+
//for most of the analyzer run-time), so matching its order exactly results in
492491
//better cache locality
493492
for(EdgeId edge_id : node_in_edges(node_id)) {
494493

@@ -498,7 +497,7 @@ tatum::util::linear_map<EdgeId,EdgeId> TimingGraph::optimize_edge_layout() const
498497
}
499498
}
500499

501-
//Maps from from original to new edge id, used to update node to edge refs
500+
//Maps from original to new edge id, used to update node to edge refs
502501
tatum::util::linear_map<EdgeId,EdgeId> orig_to_new_edge_id(edges().size());
503502

504503
//Determine the new order

vpr/src/place/annealer.h

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -135,23 +135,36 @@ class t_annealing_state {
135135

136136
/**
137137
* @class PlacementAnnealer
138-
* @brief Implements a simulated annealing optimizer that minimizes the placement cost
139-
* by swapping clustered blocks. It always accepts swaps that reduce the placement cost,
140-
* but accepts the swaps that increase the cost with a diminishing probability.
138+
* @brief Simulated annealing optimizer for minimizing placement cost via block swaps.
141139
*
142-
* @details Swaps are performed in a two nested loops. The inner loop is implemented in
143-
* placement_inner_loop() method. Each iteration of the inner loop performs a single swap,
144-
* and all swaps performed in each iteration of the other loop are evaluated using the same
145-
* temperature.
140+
* @details This class implements simulated annealing to optimize placement cost by swapping clustered blocks.
141+
* Swaps that reduce the cost are always accepted, while those that increase the cost are accepted
142+
* with a diminishing probability.
146143
*
147-
* The user is expected to call outer_loop_update_timing_info() before calling
148-
* placement_inner_loop(). Then, outer_loop_update_state() should be called to
149-
* determine whether another iteration of the outer loop is required.
150-
* If outer_loop_update_state() returns false, start_quench() can be called to
151-
* set the temperate to zero so that the annealer behaves greedily. Then,
152-
* outer_loop_update_timing_info() and placement_inner_loop() can be called
153-
* to run the quench stage.
144+
* The annealing process consists of two nested loops:
145+
* - The **inner loop** (implemented in `placement_inner_loop()`) performs individual swaps, all evaluated at a fixed temperature.
146+
* - The **outer loop** adjusts the temperature and determines whether further iterations are needed.
154147
*
148+
* Usage workflow:
149+
* 1. Call `outer_loop_update_timing_info()` to update timing information.
150+
* 2. Execute `placement_inner_loop()` for swap evaluations.
151+
* 3. Call `outer_loop_update_state()` to check if more outer loop iterations are needed.
152+
* 4. Optionally, use `start_quench()` to set the temperature to zero for a greedy optimization (quenching stage),
153+
* then repeat steps 1 and 2.
154+
*
155+
* Usage example:
156+
* **************************************
157+
* PlacementAnnealer annealer(...);
158+
*
159+
* do {
160+
* annealer.outer_loop_update_timing_info();
161+
* annealer.placement_inner_loop();
162+
* } while (annealer.outer_loop_update_state());
163+
*
164+
* annealer.start_quench();
165+
* annealer.outer_loop_update_timing_info();
166+
* annealer.placement_inner_loop();
167+
* **************************************
155168
*/
156169
class PlacementAnnealer {
157170
public:

0 commit comments

Comments
 (0)