Avoid hysteresis preventing placer from stopping

This commit is contained in:
Eddie Hung 2018-07-21 01:59:16 -07:00
parent f89115c3e3
commit 3eecccc6f7

View File

@ -145,6 +145,7 @@ class SAPlacer
} }
int n_no_progress = 0; int n_no_progress = 0;
wirelen_t min_metric = curr_metric;
double avg_metric = curr_metric; double avg_metric = curr_metric;
temp = 10000; temp = 10000;
@ -169,6 +170,12 @@ class SAPlacer
try_swap_position(cell, try_bel); try_swap_position(cell, try_bel);
} }
} }
if (curr_metric < min_metric) {
min_metric = curr_metric;
improved = true;
}
// Heuristic to improve placement on the 8k // Heuristic to improve placement on the 8k
if (improved) if (improved)
n_no_progress = 0; n_no_progress = 0;
@ -222,6 +229,9 @@ class SAPlacer
ctx->shuffle(autoplaced); ctx->shuffle(autoplaced);
assign_budget(ctx); assign_budget(ctx);
} }
else {
update_budget(ctx);
}
// Recalculate total metric entirely to avoid rounding errors // Recalculate total metric entirely to avoid rounding errors
// accumulating over time // accumulating over time
@ -365,8 +375,8 @@ class SAPlacer
// SA acceptance criterea // SA acceptance criterea
if (delta < 0 || (temp > 1e-6 && (ctx->rng() / float(0x3fffffff)) <= std::exp(-delta / temp))) { if (delta < 0 || (temp > 1e-6 && (ctx->rng() / float(0x3fffffff)) <= std::exp(-delta / temp))) {
n_accept++; n_accept++;
if (delta < 2) //if (delta < 2)
improved = true; // improved = true;
} else { } else {
if (other != IdString()) if (other != IdString())
ctx->unbindBel(oldBel); ctx->unbindBel(oldBel);