Skip to content

Commit e28aafe

Browse files
HackerFoovaughnbetz
authored andcommitted
Add & fix documentation
Signed-off-by: Dusty DeWeese <[email protected]>
1 parent 7be33a3 commit e28aafe

File tree

3 files changed

+27
-19
lines changed

3 files changed

+27
-19
lines changed

doc/src/vpr/dusty_sa.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The effect of this is many fast, but slowing sweeps in temperature, focused wher
1313

1414
In addition, move_lim (which controls the number of iterations in the inner loop) is scaled with the target success ratio over the current success ratio, which reduces the time to reach the target ratio.
1515

16-
The schedule terminates when the maximum alpha (``--alpha_max``) is reached. Termination is ensured by the narrowing range between the recorded upper temperature and the minimum success ratio, which will eventually cause alpha to reach its minimum.
16+
The schedule terminates when the maximum alpha (``--alpha_max``) is reached. Termination is ensured by the narrowing range between the recorded upper temperature and the minimum success ratio, which will eventually cause alpha to reach its maximum.
1717

1818
This algorithm was inspired by Lester Ingber's adaptive simulated annealing algorithm [ASA93]_.
1919

vpr/src/base/read_options.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,31 +1568,31 @@ argparse::ArgumentParser create_arg_parser(std::string prog_name, t_options& arg
15681568

15691569
place_grp.add_argument(args.PlaceAlphaMin, "--alpha_min")
15701570
.help(
1571-
"Minimum (starting) value of alpha.")
1571+
"For placement using Dusty's annealing schedule. Minimum (starting) value of alpha.")
15721572
.default_value("0.2")
15731573
.show_in(argparse::ShowIn::HELP_ONLY);
15741574

15751575
place_grp.add_argument(args.PlaceAlphaMax, "--alpha_max")
15761576
.help(
1577-
"Maximum (stopping) value of alpha.")
1577+
"For placement using Dusty's annealing schedule. Maximum (stopping) value of alpha.")
15781578
.default_value("0.9")
15791579
.show_in(argparse::ShowIn::HELP_ONLY);
15801580

15811581
place_grp.add_argument(args.PlaceAlphaDecay, "--alpha_decay")
15821582
.help(
1583-
"The value that alpha is scaled by after reset.")
1583+
"For placement using Dusty's annealing schedule. The value that alpha is scaled by after reset.")
15841584
.default_value("0.7")
15851585
.show_in(argparse::ShowIn::HELP_ONLY);
15861586

15871587
place_grp.add_argument(args.PlaceSuccessMin, "--anneal_success_min")
15881588
.help(
1589-
"Minimum success ratio when annealing before resetting the temperature to maintain the target success ratio.")
1589+
"For placement using Dusty's annealing schedule. Minimum success ratio when annealing before resetting the temperature to maintain the target success ratio.")
15901590
.default_value("0.1")
15911591
.show_in(argparse::ShowIn::HELP_ONLY);
15921592

15931593
place_grp.add_argument(args.PlaceSuccessTarget, "--anneal_success_target")
15941594
.help(
1595-
"Target success ratio when annealing.")
1595+
"For placement using Dusty's annealing schedule. Target success ratio when annealing.")
15961596
.default_value("0.25")
15971597
.show_in(argparse::ShowIn::HELP_ONLY);
15981598

vpr/src/place/place.cpp

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ struct t_placer_prev_inverse_costs {
107107
double timing_cost;
108108
};
109109

110-
// Used by update_state()
110+
// Used by update_annealing_state()
111111
struct t_annealing_state {
112112
float t; // Temperature
113113
float rlim; // Range limit for swaps
@@ -360,11 +360,11 @@ static float starting_t(t_placer_costs* costs,
360360
t_pl_blocks_to_be_moved& blocks_affected,
361361
const t_placer_opts& placer_opts);
362362

363-
static bool update_state(t_annealing_state* state,
364-
float success_rat,
365-
const t_placer_costs& costs,
366-
const t_placer_opts& placer_opts,
367-
const t_annealing_sched& annealing_sched);
363+
static bool update_annealing_state(t_annealing_state* state,
364+
float success_rat,
365+
const t_placer_costs& costs,
366+
const t_placer_opts& placer_opts,
367+
const t_annealing_sched& annealing_sched);
368368

369369
static void update_rlim(float* rlim, float success_rat, const DeviceGrid& grid);
370370

@@ -814,7 +814,7 @@ void try_place(const t_placer_opts& placer_opts,
814814
print_clb_placement("first_iteration_clb_placement.echo");
815815
}
816816
#endif
817-
} while (update_state(&state, success_rat, costs, placer_opts, annealing_sched));
817+
} while (update_annealing_state(&state, success_rat, costs, placer_opts, annealing_sched));
818818
/* Outer loop of the simmulated annealing ends */
819819

820820
auto pre_quench_timing_stats = timing_ctx.stats;
@@ -1206,12 +1206,18 @@ static void update_rlim(float* rlim, float success_rat, const DeviceGrid& grid)
12061206
*rlim = max(*rlim, (float)1.);
12071207
}
12081208

1209-
/* Update the temperature according to the annealing schedule selected. */
1210-
static bool update_state(t_annealing_state* state,
1211-
float success_rat,
1212-
const t_placer_costs& costs,
1213-
const t_placer_opts& placer_opts,
1214-
const t_annealing_sched& annealing_sched) {
1209+
/* Update the annealing state according to the annealing schedule selected.
1210+
* USER_SCHED: A manual fixed schedule with fixed alpha and exit criteria.
1211+
* AUTO_SCHED: A more sophisticated schedule where alpha varies based on success ratio.
1212+
* DUSTY_SCHED: This schedule jumps backward and slows down in response to success ratio.
1213+
* See doc/src/vpr/dusty_sa.rst for more details.
1214+
*
1215+
* Returns true until the schedule is finished. */
1216+
static bool update_annealing_state(t_annealing_state* state,
1217+
float success_rat,
1218+
const t_placer_costs& costs,
1219+
const t_placer_opts& placer_opts,
1220+
const t_annealing_sched& annealing_sched) {
12151221
/* Return `false` when the exit criterion is met. */
12161222
if (annealing_sched.type == USER_SCHED) {
12171223
state->t *= annealing_sched.alpha_t;
@@ -1253,6 +1259,8 @@ static bool update_state(t_annealing_state* state,
12531259
if (state->t < t_exit || std::isnan(t_exit)) return false;
12541260
}
12551261

1262+
// Gradually changes from the initial crit_exponent to the final crit_exponent based on how much the range limit has shrunk.
1263+
// The idea is that as the range limit shrinks (indicating we are fine-tuning a more optimized placement) we can focus more on a smaller number of critical connections, which a higher crit_exponent achieves.
12561264
update_rlim(&state->rlim, success_rat, device_ctx.grid);
12571265

12581266
if (placer_opts.place_algorithm == PATH_TIMING_DRIVEN_PLACE) {

0 commit comments

Comments
 (0)