placer1: Bugfixes
Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
parent
f8f89cea71
commit
2ef2d2b2cb
@ -193,7 +193,8 @@ class SAPlacer
|
|||||||
last_wirelen_cost = curr_wirelen_cost;
|
last_wirelen_cost = curr_wirelen_cost;
|
||||||
last_timing_cost = curr_timing_cost;
|
last_timing_cost = curr_timing_cost;
|
||||||
|
|
||||||
double avg_metric = curr_metric(), min_metric = curr_metric();
|
wirelen_t avg_wirelen = curr_wirelen_cost;
|
||||||
|
wirelen_t min_wirelen = curr_wirelen_cost;
|
||||||
|
|
||||||
int n_no_progress = 0;
|
int n_no_progress = 0;
|
||||||
temp = 10000;
|
temp = 10000;
|
||||||
@ -220,8 +221,8 @@ class SAPlacer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curr_metric() < min_metric) {
|
if (curr_wirelen_cost < min_wirelen) {
|
||||||
min_metric = curr_metric();
|
min_wirelen = curr_wirelen_cost;
|
||||||
improved = true;
|
improved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,9 +244,9 @@ 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;
|
double upper = 0.6, lower = 0.4;
|
||||||
|
|
||||||
if (curr_metric() < 0.95 * avg_metric && curr_metric > 0) {
|
if (curr_wirelen_cost < 0.95 * avg_wirelen && curr_wirelen_cost > 0) {
|
||||||
avg_metric = 0.8 * avg_metric + 0.2 * curr_metric();
|
avg_wirelen = 0.8 * avg_wirelen + 0.2 * curr_wirelen_cost;
|
||||||
} else {
|
} else {
|
||||||
if (Raccept >= 0.8) {
|
if (Raccept >= 0.8) {
|
||||||
temp *= 0.7;
|
temp *= 0.7;
|
||||||
@ -295,6 +296,8 @@ class SAPlacer
|
|||||||
// accumulating over time
|
// accumulating over time
|
||||||
curr_wirelen_cost = total_wirelen_cost();
|
curr_wirelen_cost = total_wirelen_cost();
|
||||||
curr_timing_cost = total_timing_cost();
|
curr_timing_cost = total_timing_cost();
|
||||||
|
last_wirelen_cost = curr_wirelen_cost;
|
||||||
|
last_timing_cost = curr_timing_cost;
|
||||||
// Let the UI show visualization updates.
|
// Let the UI show visualization updates.
|
||||||
ctx->yield();
|
ctx->yield();
|
||||||
}
|
}
|
||||||
@ -401,17 +404,18 @@ class SAPlacer
|
|||||||
ctx->unbindBel(newBel);
|
ctx->unbindBel(newBel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx->bindBel(newBel, cell, STRENGTH_WEAK);
|
||||||
|
|
||||||
|
if (other_cell != nullptr) {
|
||||||
|
ctx->bindBel(oldBel, other_cell, STRENGTH_WEAK);
|
||||||
|
}
|
||||||
|
|
||||||
add_move_cell(moveChange, cell, oldBel);
|
add_move_cell(moveChange, cell, oldBel);
|
||||||
|
|
||||||
if (other_cell != nullptr) {
|
if (other_cell != nullptr) {
|
||||||
add_move_cell(moveChange, other_cell, newBel);
|
add_move_cell(moveChange, other_cell, newBel);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->bindBel(newBel, cell, STRENGTH_WEAK);
|
|
||||||
|
|
||||||
if (other_cell != nullptr) {
|
|
||||||
ctx->bindBel(oldBel, other_cell, STRENGTH_WEAK);
|
|
||||||
}
|
|
||||||
if (!ctx->isBelLocationValid(newBel) || ((other_cell != nullptr && !ctx->isBelLocationValid(oldBel)))) {
|
if (!ctx->isBelLocationValid(newBel) || ((other_cell != nullptr && !ctx->isBelLocationValid(oldBel)))) {
|
||||||
ctx->unbindBel(newBel);
|
ctx->unbindBel(newBel);
|
||||||
if (other_cell != nullptr)
|
if (other_cell != nullptr)
|
||||||
@ -430,7 +434,7 @@ class SAPlacer
|
|||||||
delta += (cfg.constraintWeight / temp) * (new_dist - old_dist);
|
delta += (cfg.constraintWeight / temp) * (new_dist - old_dist);
|
||||||
n_move++;
|
n_move++;
|
||||||
// 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(0x0fffffff)) <= std::exp(-delta / temp))) {
|
||||||
n_accept++;
|
n_accept++;
|
||||||
} else {
|
} else {
|
||||||
if (other_cell != nullptr)
|
if (other_cell != nullptr)
|
||||||
|
Loading…
Reference in New Issue
Block a user