Skip to content

Commit 2dc2965

Browse files
HackerFoovaughnbetz
authored andcommitted
Documentation
Signed-off-by: Dusty DeWeese <[email protected]>
1 parent 0ac2f30 commit 2dc2965

File tree

4 files changed

+75
-52
lines changed

4 files changed

+75
-52
lines changed

doc/src/vpr/command_line_usage.rst

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -680,46 +680,6 @@ If any of init_t, exit_t or alpha_t is specified, the user schedule, with a fixe
680680

681681
**Default:** ``0.8``
682682

683-
.. option:: --alpha_min <float>
684-
685-
The minimum (starting) update factor (alpha) used.
686-
Ranges between 0 and alpha_max.
687-
Setting this flag selects Dusty's annealing schedule.
688-
689-
**Default:** ``0.2``
690-
691-
.. option:: --alpha_max <float>
692-
693-
The maximum (stopping) update factor (alpha) used after which simulated annealing will complete.
694-
Ranges between alpha_min and 1.
695-
Setting this flag selects Dusty's annealing schedule.
696-
697-
**Default:** ``0.9``
698-
699-
.. option:: --alpha_decay <float>
700-
701-
The rate at which alpha will approach 1: alpha(n) = 1 - (1 - alpha(n-1)) * alpha_decay
702-
Ranges between 0 and 1.
703-
Setting this flag selects Dusty's annealing schedule.
704-
705-
**Default:** ``0.7``
706-
707-
.. option:: --anneal_success_min <float>
708-
709-
The minimum success ratio after which the temperature will reset to maintain the target success ratio.
710-
Ranges between 0 and anneal_success_target.
711-
Setting this flag selects Dusty's annealing schedule.
712-
713-
**Default:** ``0.1``
714-
715-
.. option:: --anneal_success_target <float>
716-
717-
The temperature after each reset is selected to keep this target success ratio.
718-
Ranges between anneal_success_target and 1.
719-
Setting this flag selects Dusty's annealing schedule.
720-
721-
**Default:** ``0.25``
722-
723683
.. option:: --fix_pins {free | random | <file.pads>}
724684

725685
Controls how the placer handles I/O pads during placement.
@@ -757,6 +717,44 @@ If any of init_t, exit_t or alpha_t is specified, the user schedule, with a fixe
757717

758718
**Default:** ``0.0``
759719

720+
.. _dusty_sa_options:
721+
Setting any of the following options selects `Dusty's annealing schedule <dusty_sa.rst>`_.
722+
723+
.. option:: --alpha_min <float>
724+
725+
The minimum (starting) update factor (alpha) used.
726+
Ranges between 0 and alpha_max.
727+
728+
**Default:** ``0.2``
729+
730+
.. option:: --alpha_max <float>
731+
732+
The maximum (stopping) update factor (alpha) used after which simulated annealing will complete.
733+
Ranges between alpha_min and 1.
734+
735+
**Default:** ``0.9``
736+
737+
.. option:: --alpha_decay <float>
738+
739+
The rate at which alpha will approach 1: alpha(n) = 1 - (1 - alpha(n-1)) * alpha_decay
740+
Ranges between 0 and 1.
741+
742+
**Default:** ``0.7``
743+
744+
.. option:: --anneal_success_min <float>
745+
746+
The minimum success ratio after which the temperature will reset to maintain the target success ratio.
747+
Ranges between 0 and anneal_success_target.
748+
749+
**Default:** ``0.1``
750+
751+
.. option:: --anneal_success_target <float>
752+
753+
The temperature after each reset is selected to keep this target success ratio.
754+
Ranges between anneal_success_target and 1.
755+
756+
**Default:** ``0.25``
757+
760758
.. _timing_driven_placer_options:
761759

762760
Timing-Driven Placer Options

doc/src/vpr/dusty_sa.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Dusty's Simulated Annealing Schedule
2+
====================================
3+
4+
This simulated annealing schedule is designed to quickly characterize the search space and maintain a target success ratio (accepted moves.)
5+
6+
It starts at the minimum alpha (``--alpha_min``) to allow it to quickly find the target.
7+
8+
For each alpha, the temperature decays by a factor of alpha after each outer loop iteration.
9+
10+
The temperature before which the success ratio drops below the target (``--anneal_success_target``) is recorded; after hitting the minimum success ratio (``--anneal_success_min``), the temperature resets to a little before recorded temperature, and alpha parameter itself decays according to ``--alpha_decay``.
11+
12+
The effect of this is many fast, but slowing sweeps in temperature, focused where they can make the most effective progress. Unlike fixed and adaptive schedules that monotonically decrease temperature, this allows the global properties of the search space to affect the schedule.
13+
14+
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.
15+
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.
17+
18+
This algorithm was inspired by Lester Ingber's adaptive simulated annealing algorithm [ASA93]_.
19+
20+
See ``update_state()`` in ``place.cpp`` for the algorithm details.
21+
22+
.. [ASA93] Ingber, Lester. "Adaptive simulated annealing (ASA)." Global optimization C-code, Caltech Alumni Association, Pasadena, CA (1993).

vpr/src/base/read_options.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2222,19 +2222,19 @@ void set_conditional_defaults(t_options& args) {
22222222
args.quench_recompute_divider.set(args.inner_loop_recompute_divider, Provenance::INFERRED);
22232223
}
22242224

2225-
//Are we using the automatic, or user-specified annealing schedule?
2226-
if (args.PlaceAlphaMin.provenance() == Provenance::SPECIFIED
2225+
//Which schedule?
2226+
if (args.PlaceAlphaMin.provenance() == Provenance::SPECIFIED // Any of these flags select Dusty's schedule
22272227
|| args.PlaceAlphaMax.provenance() == Provenance::SPECIFIED
22282228
|| args.PlaceAlphaDecay.provenance() == Provenance::SPECIFIED
22292229
|| args.PlaceSuccessMin.provenance() == Provenance::SPECIFIED
22302230
|| args.PlaceSuccessTarget.provenance() == Provenance::SPECIFIED) {
22312231
args.anneal_sched_type.set(DUSTY_SCHED, Provenance::INFERRED);
2232-
} else if (args.PlaceInitT.provenance() == Provenance::SPECIFIED
2232+
} else if (args.PlaceInitT.provenance() == Provenance::SPECIFIED // Any of these flags select a manual schedule
22332233
|| args.PlaceExitT.provenance() == Provenance::SPECIFIED
22342234
|| args.PlaceAlphaT.provenance() == Provenance::SPECIFIED) {
22352235
args.anneal_sched_type.set(USER_SCHED, Provenance::INFERRED);
22362236
} else {
2237-
args.anneal_sched_type.set(AUTO_SCHED, Provenance::INFERRED);
2237+
args.anneal_sched_type.set(AUTO_SCHED, Provenance::INFERRED); // Otherwise use the automatic schedule
22382238
}
22392239

22402240
//Are the pad locations specified?

vpr/src/place/place.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ using std::min;
5858
* cost computation. 0.01 means that there is a 1% error tolerance. */
5959
#define ERROR_TOL .01
6060

61+
/* The final rlim (range limit) is 1, which is the smallest value that can *
62+
* still make progress, since an rlim of 0 wouldn't allow any swaps. */
6163
#define FINAL_RLIM 1
6264

6365
/* This defines the maximum number of swap attempts before invoking the *
@@ -105,15 +107,16 @@ struct t_placer_prev_inverse_costs {
105107
double timing_cost;
106108
};
107109

110+
// Used by update_state()
108111
struct t_annealing_state {
109-
float t;
110-
float rlim;
111-
float inverse_delta_rlim;
112-
float alpha;
113-
float restart_t;
114-
float crit_exponent;
115-
int move_lim_max;
116-
int move_lim;
112+
float t; // Temperature
113+
float rlim; // Range limit for swaps
114+
float inverse_delta_rlim; // used to calculate crit_exponent
115+
float alpha; // Temperature decays by this factor each outer iteration
116+
float restart_t; // Temperature used after restart due to minimum success ratio
117+
float crit_exponent; // Used by timing-driven placement to "sharpen" timing criticality
118+
int move_lim_max; // Maximum move limit
119+
int move_lim; // Current move limit
117120
};
118121

119122
constexpr float INVALID_DELAY = std::numeric_limits<float>::quiet_NaN();

0 commit comments

Comments
 (0)