From 7878561970d27ff2fed73fe0909fa64320e34bc8 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Fri, 26 Feb 2021 11:26:52 -0800 Subject: Add placement sanity check in placer_heap. Also check return of placer1_refine. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- common/placer_heap.cc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'common/placer_heap.cc') diff --git a/common/placer_heap.cc b/common/placer_heap.cc index 8a3b427f..df1454e8 100644 --- a/common/placer_heap.cc +++ b/common/placer_heap.cc @@ -321,7 +321,27 @@ class HeAPPlacer ctx->check(); - placer1_refine(ctx, Placer1Cfg(ctx)); + bool any_bad_placements = false; + for (auto bel : ctx->getBels()) { + CellInfo *cell = ctx->getBoundBelCell(bel); + if (!ctx->isBelLocationValid(bel)) { + std::string cell_text = "no cell"; + if (cell != nullptr) + cell_text = std::string("cell '") + ctx->nameOf(cell) + "'"; + log_warning("post-placement validity check failed for Bel '%s' " + "(%s)\n", + ctx->nameOfBel(bel), cell_text.c_str()); + any_bad_placements = true; + } + } + + if (any_bad_placements) { + return false; + } + + if (!placer1_refine(ctx, Placer1Cfg(ctx))) { + return false; + } return true; } -- cgit v1.2.3 From 77a5a60a66b0cfc1602edb61aadf392dc651bf46 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Fri, 26 Feb 2021 11:37:27 -0800 Subject: Fix latent bug with context locking in placer HeAP. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- common/placer_heap.cc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'common/placer_heap.cc') diff --git a/common/placer_heap.cc b/common/placer_heap.cc index df1454e8..cea862af 100644 --- a/common/placer_heap.cc +++ b/common/placer_heap.cc @@ -49,6 +49,7 @@ #include "nextpnr.h" #include "place_common.h" #include "placer1.h" +#include "scope_lock.h" #include "timing.h" #include "util.h" @@ -147,7 +148,7 @@ class HeAPPlacer { auto startt = std::chrono::high_resolution_clock::now(); - ctx->lock(); + nextpnr::ScopeLock lock(ctx); place_constraints(); build_fast_bels(); seed_placement(); @@ -312,15 +313,6 @@ class HeAPPlacer log_info("AP soln: %s -> %s\n", cell.first.c_str(ctx), ctx->nameOfBel(cell.second->bel)); } - ctx->unlock(); - auto endtt = std::chrono::high_resolution_clock::now(); - log_info("HeAP Placer Time: %.02fs\n", std::chrono::duration(endtt - startt).count()); - log_info(" of which solving equations: %.02fs\n", solve_time); - log_info(" of which spreading cells: %.02fs\n", cl_time); - log_info(" of which strict legalisation: %.02fs\n", sl_time); - - ctx->check(); - bool any_bad_placements = false; for (auto bel : ctx->getBels()) { CellInfo *cell = ctx->getBoundBelCell(bel); @@ -339,6 +331,16 @@ class HeAPPlacer return false; } + lock.unlock_early(); + + auto endtt = std::chrono::high_resolution_clock::now(); + log_info("HeAP Placer Time: %.02fs\n", std::chrono::duration(endtt - startt).count()); + log_info(" of which solving equations: %.02fs\n", solve_time); + log_info(" of which spreading cells: %.02fs\n", cl_time); + log_info(" of which strict legalisation: %.02fs\n", sl_time); + + ctx->check(); + if (!placer1_refine(ctx, Placer1Cfg(ctx))) { return false; } -- cgit v1.2.3 From 99a2262d61c20019b2a4ce5321df48a9d5d43864 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Mon, 1 Mar 2021 09:41:29 -0800 Subject: Use scope in router1/2 and placer1. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- common/placer_heap.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'common/placer_heap.cc') diff --git a/common/placer_heap.cc b/common/placer_heap.cc index cea862af..eb931a37 100644 --- a/common/placer_heap.cc +++ b/common/placer_heap.cc @@ -331,8 +331,6 @@ class HeAPPlacer return false; } - lock.unlock_early(); - auto endtt = std::chrono::high_resolution_clock::now(); log_info("HeAP Placer Time: %.02fs\n", std::chrono::duration(endtt - startt).count()); log_info(" of which solving equations: %.02fs\n", solve_time); @@ -340,6 +338,7 @@ class HeAPPlacer log_info(" of which strict legalisation: %.02fs\n", sl_time); ctx->check(); + lock.unlock_early(); if (!placer1_refine(ctx, Placer1Cfg(ctx))) { return false; -- cgit v1.2.3