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()("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()("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()("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()("placer-budgets", "use budget rather than criticality in placer timing weights");
|
||||||
|
|
||||||
general.add_options()("pack-only", "pack design only without placement or routing");
|
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")) {
|
if (vm.count("cstrweight")) {
|
||||||
settings->set("placer1/constraintWeight", vm["cstrweight"].as<float>());
|
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")) {
|
if (vm.count("placer-budgets")) {
|
||||||
settings->set("placer1/budgetBased", true);
|
settings->set("placer1/budgetBased", true);
|
||||||
|
@ -202,7 +202,7 @@ class SAPlacer
|
|||||||
wirelen_t min_wirelen = curr_wirelen_cost;
|
wirelen_t min_wirelen = curr_wirelen_cost;
|
||||||
|
|
||||||
int n_no_progress = 0;
|
int n_no_progress = 0;
|
||||||
temp = 1;
|
temp = cfg.startTemp;
|
||||||
|
|
||||||
// Main simulated annealing loop
|
// Main simulated annealing loop
|
||||||
for (int iter = 1;; iter++) {
|
for (int iter = 1;; iter++) {
|
||||||
@ -255,8 +255,6 @@ class SAPlacer
|
|||||||
|
|
||||||
int M = std::max(max_x, max_y) + 1;
|
int M = std::max(max_x, max_y) + 1;
|
||||||
|
|
||||||
double upper = 0.6, lower = 0.4;
|
|
||||||
|
|
||||||
if (ctx->verbose)
|
if (ctx->verbose)
|
||||||
log("iter #%d: temp = %f, timing cost = "
|
log("iter #%d: temp = %f, timing cost = "
|
||||||
"%.0f, wirelen = %.0f, dia = %d, Ra = %.02f \n",
|
"%.0f, wirelen = %.0f, dia = %d, Ra = %.02f \n",
|
||||||
@ -265,21 +263,16 @@ class SAPlacer
|
|||||||
if (curr_wirelen_cost < 0.95 * avg_wirelen && curr_wirelen_cost > 0) {
|
if (curr_wirelen_cost < 0.95 * avg_wirelen && curr_wirelen_cost > 0) {
|
||||||
avg_wirelen = 0.8 * avg_wirelen + 0.2 * curr_wirelen_cost;
|
avg_wirelen = 0.8 * avg_wirelen + 0.2 * curr_wirelen_cost;
|
||||||
} else {
|
} else {
|
||||||
if (Raccept >= 0.8) {
|
double diam_next = diameter * (1.0 - 0.44 + Raccept);
|
||||||
temp *= 0.7;
|
diameter = std::max<int>(1, std::min<int>(M, int(diam_next + 0.5)));
|
||||||
} else if (Raccept > upper) {
|
if (Raccept > 0.96) {
|
||||||
if (diameter < M)
|
temp *= 0.5;
|
||||||
diameter++;
|
} else if (Raccept > 0.8) {
|
||||||
else
|
temp *= 0.9;
|
||||||
temp *= 0.9;
|
} else if (Raccept > 0.15 && diameter > 1) {
|
||||||
} else if (Raccept > lower) {
|
|
||||||
temp *= 0.95;
|
temp *= 0.95;
|
||||||
} else {
|
} else {
|
||||||
// Raccept < 0.3
|
temp *= 0.8;
|
||||||
if (diameter > 1)
|
|
||||||
diameter--;
|
|
||||||
else
|
|
||||||
temp *= 0.8;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Once cooled below legalise threshold, run legalisation and start requiring
|
// Once cooled below legalise threshold, run legalisation and start requiring
|
||||||
@ -553,7 +546,7 @@ class SAPlacer
|
|||||||
(1 - lambda) * (double(moveChange.wirelen_delta) / last_wirelen_cost);
|
(1 - lambda) * (double(moveChange.wirelen_delta) / last_wirelen_cost);
|
||||||
n_move++;
|
n_move++;
|
||||||
// SA acceptance criterea
|
// 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++;
|
n_accept++;
|
||||||
if (ctx->debug)
|
if (ctx->debug)
|
||||||
log_info("accepted chain swap %s\n", cell->name.c_str(ctx));
|
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::vector<std::vector<std::vector<std::vector<BelId>>>> fast_bels;
|
||||||
std::unordered_set<BelId> locked_bels;
|
std::unordered_set<BelId> locked_bels;
|
||||||
bool require_legal = true;
|
bool require_legal = true;
|
||||||
const float legalise_temp = 0.00015;
|
const float legalise_temp = 0.001;
|
||||||
const float post_legalise_temp = 0.0003;
|
const float post_legalise_temp = 0.002;
|
||||||
const float post_legalise_dia_scale = 1.5;
|
const float post_legalise_dia_scale = 1.5;
|
||||||
Placer1Cfg cfg;
|
Placer1Cfg cfg;
|
||||||
};
|
};
|
||||||
@ -817,6 +810,7 @@ Placer1Cfg::Placer1Cfg(Context *ctx) : Settings(ctx)
|
|||||||
constraintWeight = get<float>("placer1/constraintWeight", 10);
|
constraintWeight = get<float>("placer1/constraintWeight", 10);
|
||||||
minBelsForGridPick = get<int>("placer1/minBelsForGridPick", 64);
|
minBelsForGridPick = get<int>("placer1/minBelsForGridPick", 64);
|
||||||
budgetBased = get<bool>("placer1/budgetBased", false);
|
budgetBased = get<bool>("placer1/budgetBased", false);
|
||||||
|
startTemp = get<float> ("placer1/startTemp", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool placer1(Context *ctx, Placer1Cfg cfg)
|
bool placer1(Context *ctx, Placer1Cfg cfg)
|
||||||
|
@ -30,6 +30,7 @@ struct Placer1Cfg : public Settings
|
|||||||
float constraintWeight;
|
float constraintWeight;
|
||||||
int minBelsForGridPick;
|
int minBelsForGridPick;
|
||||||
bool budgetBased;
|
bool budgetBased;
|
||||||
|
float startTemp;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern bool placer1(Context *ctx, Placer1Cfg cfg);
|
extern bool placer1(Context *ctx, Placer1Cfg cfg);
|
||||||
|
Loading…
Reference in New Issue
Block a user