9
9
#include " draw_global.h"
10
10
#include " place_constraints.h"
11
11
12
- /* File-scope routines */
13
- static GridBlock init_grid_blocks ();
14
-
15
12
/* *
16
- * @brief Initialize the placer's block-grid dual direction mapping.
17
- *
18
- * Forward direction - block to grid: place_ctx.block_locs.
19
- * Reverse direction - grid to block: place_ctx.grid_blocks.
13
+ * @brief Initialize `grid_blocks`, the inverse structure of `block_locs`.
20
14
*
21
- * Initialize both of them to empty states.
15
+ * The container at each grid block location should have a length equal to the
16
+ * subtile capacity of that block. Unused subtile would be marked EMPTY_BLOCK_ID.
22
17
*/
18
+ static GridBlock init_grid_blocks ();
19
+
23
20
void init_placement_context () {
24
21
auto & place_ctx = g_vpr_ctx.mutable_placement ();
25
22
auto & cluster_ctx = g_vpr_ctx.clustering ();
@@ -32,12 +29,6 @@ void init_placement_context() {
32
29
place_ctx.grid_blocks = init_grid_blocks ();
33
30
}
34
31
35
- /* *
36
- * @brief Initialize `grid_blocks`, the inverse structure of `block_locs`.
37
- *
38
- * The container at each grid block location should have a length equal to the
39
- * subtile capacity of that block. Unused subtile would be marked EMPTY_BLOCK_ID.
40
- */
41
32
static GridBlock init_grid_blocks () {
42
33
auto & device_ctx = g_vpr_ctx.device ();
43
34
int num_layers = device_ctx.grid .get_num_layers ();
@@ -56,12 +47,6 @@ static GridBlock init_grid_blocks() {
56
47
return grid_blocks;
57
48
}
58
49
59
- /* *
60
- * @brief Mutator: updates the norm factors in the outer loop iteration.
61
- *
62
- * At each temperature change we update these values to be used
63
- * for normalizing the trade-off between timing and wirelength (bb)
64
- */
65
50
void t_placer_costs::update_norm_factors () {
66
51
if (place_algorithm.is_timing_driven ()) {
67
52
bb_cost_norm = 1 / bb_cost;
@@ -73,11 +58,6 @@ void t_placer_costs::update_norm_factors() {
73
58
}
74
59
}
75
60
76
- /* *
77
- * @brief Accumulates NoC cost difference terms
78
- *
79
- * @param noc_delta_cost NoC cost difference if the swap is accepted
80
- */
81
61
t_placer_costs& t_placer_costs::operator +=(const NocCostTerms& noc_delta_cost) {
82
62
noc_cost_terms += noc_delta_cost;
83
63
@@ -116,20 +96,6 @@ t_annealing_state::t_annealing_state(const t_annealing_sched& annealing_sched,
116
96
UPPER_RLIM = std::max (grid.width () - 1 , grid.height () - 1 );
117
97
}
118
98
119
- /* *
120
- * @brief Get the initial limit for inner loop block move attempt limit.
121
- *
122
- * There are two ways to scale the move limit.
123
- * e_place_effort_scaling::CIRCUIT
124
- * scales the move limit proportional to num_blocks ^ (4/3)
125
- * e_place_effort_scaling::DEVICE_CIRCUIT
126
- * scales the move limit proportional to device_size ^ (2/3) * num_blocks ^ (2/3)
127
- *
128
- * The second method is almost identical to the first one when the device
129
- * is highly utilized (device_size ~ num_blocks). For low utilization devices
130
- * (device_size >> num_blocks), the search space is larger, so the second method
131
- * performs more moves to ensure better optimization.
132
- */
133
99
int get_initial_move_lim (const t_placer_opts& placer_opts, const t_annealing_sched& annealing_sched) {
134
100
const auto & device_ctx = g_vpr_ctx.device ();
135
101
const auto & cluster_ctx = g_vpr_ctx.clustering ();
@@ -153,16 +119,6 @@ int get_initial_move_lim(const t_placer_opts& placer_opts, const t_annealing_sch
153
119
return move_lim;
154
120
}
155
121
156
- /* *
157
- * @brief Update the annealing state according to the annealing schedule selected.
158
- *
159
- * USER_SCHED: A manual fixed schedule with fixed alpha and exit criteria.
160
- * AUTO_SCHED: A more sophisticated schedule where alpha varies based on success ratio.
161
- * DUSTY_SCHED: This schedule jumps backward and slows down in response to success ratio.
162
- * See doc/src/vpr/dusty_sa.rst for more details.
163
- *
164
- * @return True->continues the annealing. False->exits the annealing.
165
- */
166
122
bool t_annealing_state::outer_loop_update (float success_rate,
167
123
const t_placer_costs& costs,
168
124
const t_placer_opts& placer_opts,
@@ -248,33 +204,12 @@ bool t_annealing_state::outer_loop_update(float success_rate,
248
204
return true ;
249
205
}
250
206
251
- /* *
252
- * @brief Update the range limiter to keep acceptance prob. near 0.44.
253
- *
254
- * Use a floating point rlim to allow gradual transitions at low temps.
255
- * The range is bounded by 1 (FINAL_RLIM) and the grid size (UPPER_RLIM).
256
- */
257
207
void t_annealing_state::update_rlim (float success_rate) {
258
208
rlim *= (1 . - 0.44 + success_rate);
259
209
rlim = std::min (rlim, UPPER_RLIM);
260
210
rlim = std::max (rlim, FINAL_RLIM);
261
211
}
262
212
263
- /* *
264
- * @brief Update the criticality exponent.
265
- *
266
- * When rlim shrinks towards the FINAL_RLIM value (indicating
267
- * that we are fine-tuning a more optimized placement), we can
268
- * focus more on a smaller number of critical connections.
269
- * To achieve this, we make the crit_exponent sharper, so that
270
- * critical connections would become more critical than before.
271
- *
272
- * We calculate how close rlim is to its final value comparing
273
- * to its initial value. Then, we apply the same scaling factor
274
- * on the crit_exponent so that it lands on the suitable value
275
- * between td_place_exp_first and td_place_exp_last. The scaling
276
- * factor is calculated and applied linearly.
277
- */
278
213
void t_annealing_state::update_crit_exponent (const t_placer_opts& placer_opts) {
279
214
/* If rlim == FINAL_RLIM, then scale == 0. */
280
215
float scale = 1 - (rlim - FINAL_RLIM) * INVERSE_DELTA_RLIM;
@@ -284,11 +219,6 @@ void t_annealing_state::update_crit_exponent(const t_placer_opts& placer_opts) {
284
219
+ placer_opts.td_place_exp_first ;
285
220
}
286
221
287
- /* *
288
- * @brief Update the move limit based on the success rate.
289
- *
290
- * The value is bounded between 1 and move_lim_max.
291
- */
292
222
void t_annealing_state::update_move_lim (float success_target, float success_rate) {
293
223
move_lim = move_lim_max * (success_target / success_rate);
294
224
move_lim = std::min (move_lim, move_lim_max);
@@ -330,13 +260,6 @@ void t_placer_statistics::calc_iteration_stats(const t_placer_costs& costs, int
330
260
std_dev = get_std_dev (success_sum, sum_of_squares, av_cost);
331
261
}
332
262
333
- /* *
334
- * @brief Returns the standard deviation of data set x.
335
- *
336
- * There are n sample points, sum_x_squared is the summation over n of x^2 and av_x
337
- * is the average x. All operations are done in double precision, since round off
338
- * error can be a problem in the initial temp. std_dev calculation for big circuits.
339
- */
340
263
double get_std_dev (int n, double sum_x_squared, double av_x) {
341
264
double std_dev;
342
265
if (n <= 1 ) {
@@ -396,15 +319,6 @@ void zero_initialize_grid_blocks() {
396
319
}
397
320
}
398
321
399
- /* *
400
- * @brief Builds (alloc and load) legal_pos that holds all the legal locations for placement
401
- *
402
- * @param legal_pos
403
- * a lookup of all subtiles by sub_tile type
404
- * legal_pos[0..device_ctx.num_block_types-1][0..num_sub_tiles - 1] = std::vector<t_pl_loc> of all the legal locations
405
- * of the proper tile type and sub_tile type
406
- *
407
- */
408
322
void alloc_and_load_legal_placement_locations (std::vector<std::vector<std::vector<t_pl_loc>>>& legal_pos) {
409
323
auto & device_ctx = g_vpr_ctx.device ();
410
324
auto & place_ctx = g_vpr_ctx.placement ();
0 commit comments