Merge pull request #1066 from arjenroodselaar/place_timeout
Timeout when legal placement can't be found for cell
This commit is contained in:
commit
a80d63b268
@ -189,6 +189,8 @@ po::options_description CommandHandler::getGeneralOptions()
|
||||
general.add_options()("placer-heap-critexp", po::value<int>(),
|
||||
"placer heap criticality exponent (int, default: 2)");
|
||||
general.add_options()("placer-heap-timingweight", po::value<int>(), "placer heap timing weight (int, default: 10)");
|
||||
general.add_options()("placer-heap-cell-placement-timeout", po::value<int>(),
|
||||
"allow placer to attempt up to max(10000, total cells^2 / N) iterations to place a cell (int N, default: 8, 0 for no timeout)");
|
||||
|
||||
#if !defined(__wasm)
|
||||
general.add_options()("parallel-refine", "use new experimental parallelised engine for placement refinement");
|
||||
@ -328,6 +330,10 @@ void CommandHandler::setupContext(Context *ctx)
|
||||
if (vm.count("placer-heap-timingweight"))
|
||||
ctx->settings[ctx->id("placerHeap/timingWeight")] = std::to_string(vm["placer-heap-timingweight"].as<int>());
|
||||
|
||||
if (vm.count("placer-heap-cell-placement-timeout"))
|
||||
ctx->settings[ctx->id("placerHeap/cellPlacementTimeout")] =
|
||||
std::to_string(std::max(0, vm["placer-heap-cell-placement-timeout"].as<int>()));
|
||||
|
||||
if (vm.count("parallel-refine"))
|
||||
ctx->settings[ctx->id("placerHeap/parallelRefine")] = true;
|
||||
|
||||
|
@ -218,7 +218,10 @@ class HeAPPlacer
|
||||
|
||||
heap_runs.push_back(all_buckets);
|
||||
// The main HeAP placer loop
|
||||
log_info("Running main analytical placer.\n");
|
||||
if (cfg.cell_placement_timeout > 0)
|
||||
log_info("Running main analytical placer, max placement attempts per cell = %d.\n", cfg.cell_placement_timeout);
|
||||
else
|
||||
log_info("Running main analytical placer.\n");
|
||||
while (stalled < 5 && (solved_hpwl <= legal_hpwl * 0.8)) {
|
||||
// Alternate between particular bel types and all bels
|
||||
for (auto &run : heap_runs) {
|
||||
@ -862,6 +865,7 @@ class HeAPPlacer
|
||||
int radius = 0;
|
||||
int iter = 0;
|
||||
int iter_at_radius = 0;
|
||||
int total_iters_for_cell = 0;
|
||||
bool placed = false;
|
||||
BelId bestBel;
|
||||
int best_inp_len = std::numeric_limits<int>::max();
|
||||
@ -878,11 +882,9 @@ class HeAPPlacer
|
||||
}
|
||||
|
||||
while (!placed) {
|
||||
|
||||
// Set a conservative timeout
|
||||
if (iter > std::max(10000, 3 * int(ctx->cells.size())))
|
||||
log_error("Unable to find legal placement for cell '%s', check constraints and utilisation.\n",
|
||||
ctx->nameOf(ci));
|
||||
if (cfg.cell_placement_timeout > 0 && total_iters_for_cell > cfg.cell_placement_timeout)
|
||||
log_error("Unable to find legal placement for cell '%s' after %d attempts, check constraints and utilisation. Use `--placer-heap-cell-placement-timeout` to change the number of attempts.\n",
|
||||
ctx->nameOf(ci), total_iters_for_cell);
|
||||
|
||||
// Determine a search radius around the solver location (which increases over time) that is clamped to
|
||||
// the region constraint for the cell (if applicable)
|
||||
@ -1084,6 +1086,8 @@ class HeAPPlacer
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
total_iters_for_cell++;
|
||||
}
|
||||
}
|
||||
auto endt = std::chrono::high_resolution_clock::now();
|
||||
@ -1814,6 +1818,15 @@ PlacerHeapCfg::PlacerHeapCfg(Context *ctx)
|
||||
solverTolerance = 1e-5;
|
||||
placeAllAtOnce = false;
|
||||
|
||||
int timeout_divisor = ctx->setting<int>("placerHeap/cellPlacementTimeout", 8);
|
||||
if (timeout_divisor > 0) {
|
||||
// Set a conservative default. This is a rather large number and could probably
|
||||
// be shaved down, but for now it will keep the process from running indefinite.
|
||||
cell_placement_timeout = std::max(10000, (int(ctx->cells.size()) * int(ctx->cells.size()) / timeout_divisor));
|
||||
} else {
|
||||
cell_placement_timeout = 0;
|
||||
}
|
||||
|
||||
hpwl_scale_x = 1;
|
||||
hpwl_scale_y = 1;
|
||||
spread_scale_x = 1;
|
||||
|
@ -42,6 +42,7 @@ struct PlacerHeapCfg
|
||||
float solverTolerance;
|
||||
bool placeAllAtOnce;
|
||||
bool parallelRefine;
|
||||
int cell_placement_timeout;
|
||||
|
||||
int hpwl_scale_x, hpwl_scale_y;
|
||||
int spread_scale_x, spread_scale_y;
|
||||
|
Loading…
Reference in New Issue
Block a user