placer1: New temperature heuristic
Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
parent
222abb5be2
commit
0cb351df52
@ -122,6 +122,7 @@ po::options_description CommandHandler::getGeneralOptions()
|
||||
general.add_options()("randomize-seed,r", "randomize seed value for random number generator");
|
||||
general.add_options()("slack_redist_iter", po::value<int>(), "number of iterations between slack redistribution");
|
||||
general.add_options()("cstrweight", po::value<float>(), "placer weighting for relative constraint satisfaction");
|
||||
general.add_options()("starttemp", po::value<float>(), "placer SA start temperature");
|
||||
general.add_options()("placer-budgets", "use budget rather than criticality in placer timing weights");
|
||||
|
||||
general.add_options()("pack-only", "pack design only without placement or routing");
|
||||
@ -188,6 +189,9 @@ void CommandHandler::setupContext(Context *ctx)
|
||||
if (vm.count("cstrweight")) {
|
||||
settings->set("placer1/constraintWeight", vm["cstrweight"].as<float>());
|
||||
}
|
||||
if (vm.count("starttemp")) {
|
||||
settings->set("placer1/startTemp", vm["starttemp"].as<float>());
|
||||
}
|
||||
|
||||
if (vm.count("placer-budgets")) {
|
||||
settings->set("placer1/budgetBased", true);
|
||||
|
@ -202,7 +202,7 @@ class SAPlacer
|
||||
wirelen_t min_wirelen = curr_wirelen_cost;
|
||||
|
||||
int n_no_progress = 0;
|
||||
temp = 1;
|
||||
temp = cfg.startTemp;
|
||||
|
||||
// Main simulated annealing loop
|
||||
for (int iter = 1;; iter++) {
|
||||
@ -255,8 +255,6 @@ class SAPlacer
|
||||
|
||||
int M = std::max(max_x, max_y) + 1;
|
||||
|
||||
double upper = 0.6, lower = 0.4;
|
||||
|
||||
if (ctx->verbose)
|
||||
log("iter #%d: temp = %f, timing cost = "
|
||||
"%.0f, wirelen = %.0f, dia = %d, Ra = %.02f \n",
|
||||
@ -265,20 +263,15 @@ class SAPlacer
|
||||
if (curr_wirelen_cost < 0.95 * avg_wirelen && curr_wirelen_cost > 0) {
|
||||
avg_wirelen = 0.8 * avg_wirelen + 0.2 * curr_wirelen_cost;
|
||||
} else {
|
||||
if (Raccept >= 0.8) {
|
||||
temp *= 0.7;
|
||||
} else if (Raccept > upper) {
|
||||
if (diameter < M)
|
||||
diameter++;
|
||||
else
|
||||
double diam_next = diameter * (1.0 - 0.44 + Raccept);
|
||||
diameter = std::max<int>(1, std::min<int>(M, int(diam_next + 0.5)));
|
||||
if (Raccept > 0.96) {
|
||||
temp *= 0.5;
|
||||
} else if (Raccept > 0.8) {
|
||||
temp *= 0.9;
|
||||
} else if (Raccept > lower) {
|
||||
} else if (Raccept > 0.15 && diameter > 1) {
|
||||
temp *= 0.95;
|
||||
} else {
|
||||
// Raccept < 0.3
|
||||
if (diameter > 1)
|
||||
diameter--;
|
||||
else
|
||||
temp *= 0.8;
|
||||
}
|
||||
}
|
||||
@ -553,7 +546,7 @@ class SAPlacer
|
||||
(1 - lambda) * (double(moveChange.wirelen_delta) / last_wirelen_cost);
|
||||
n_move++;
|
||||
// SA acceptance criterea
|
||||
if (delta < 0 || (temp > 1e-9 && (ctx->rng() / float(0x3fffffff)) <= std::exp(-delta / (5 * temp)))) {
|
||||
if (delta < 0 || (temp > 1e-9 && (ctx->rng() / float(0x3fffffff)) <= std::exp(-delta / temp))) {
|
||||
n_accept++;
|
||||
if (ctx->debug)
|
||||
log_info("accepted chain swap %s\n", cell->name.c_str(ctx));
|
||||
@ -806,8 +799,8 @@ swap_fail:
|
||||
std::vector<std::vector<std::vector<std::vector<BelId>>>> fast_bels;
|
||||
std::unordered_set<BelId> locked_bels;
|
||||
bool require_legal = true;
|
||||
const float legalise_temp = 0.00015;
|
||||
const float post_legalise_temp = 0.0003;
|
||||
const float legalise_temp = 0.001;
|
||||
const float post_legalise_temp = 0.002;
|
||||
const float post_legalise_dia_scale = 1.5;
|
||||
Placer1Cfg cfg;
|
||||
};
|
||||
@ -817,6 +810,7 @@ Placer1Cfg::Placer1Cfg(Context *ctx) : Settings(ctx)
|
||||
constraintWeight = get<float>("placer1/constraintWeight", 10);
|
||||
minBelsForGridPick = get<int>("placer1/minBelsForGridPick", 64);
|
||||
budgetBased = get<bool>("placer1/budgetBased", false);
|
||||
startTemp = get<float> ("placer1/startTemp", 1);
|
||||
}
|
||||
|
||||
bool placer1(Context *ctx, Placer1Cfg cfg)
|
||||
|
@ -30,6 +30,7 @@ struct Placer1Cfg : public Settings
|
||||
float constraintWeight;
|
||||
int minBelsForGridPick;
|
||||
bool budgetBased;
|
||||
float startTemp;
|
||||
};
|
||||
|
||||
extern bool placer1(Context *ctx, Placer1Cfg cfg);
|
||||
|
Loading…
Reference in New Issue
Block a user