common: disable parallel refinement only without threads.

Previously it was always disabled on WebAssembly builds.
This commit is contained in:
Catherine 2023-02-23 03:25:48 +00:00 committed by myrtle
parent 8f0731edc9
commit ebbaf8c08d
5 changed files with 9 additions and 9 deletions

View File

@ -200,7 +200,7 @@ po::options_description CommandHandler::getGeneralOptions()
"allow placer to attempt up to max(10000, total cells^2 / N) iterations to place a cell (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)"); "N, default: 8, 0 for no timeout)");
#if !defined(__wasm) #if !defined(NPNR_DISABLE_THREADS)
general.add_options()("parallel-refine", "use new experimental parallelised engine for placement refinement"); general.add_options()("parallel-refine", "use new experimental parallelised engine for placement refinement");
#endif #endif

View File

@ -219,7 +219,7 @@ bool DetailPlacerThreadState::bounds_check(BelId bel)
bool DetailPlacerThreadState::bind_move() bool DetailPlacerThreadState::bind_move()
{ {
#if !defined(__wasm) #if !defined(NPNR_DISABLE_THREADS)
std::unique_lock<std::shared_timed_mutex> l(g.archapi_mutex); std::unique_lock<std::shared_timed_mutex> l(g.archapi_mutex);
#endif #endif
for (auto &entry : moved_cells) { for (auto &entry : moved_cells) {
@ -240,7 +240,7 @@ bool DetailPlacerThreadState::bind_move()
bool DetailPlacerThreadState::check_validity() bool DetailPlacerThreadState::check_validity()
{ {
#if !defined(__wasm) #if !defined(NPNR_DISABLE_THREADS)
std::shared_lock<std::shared_timed_mutex> l(g.archapi_mutex); std::shared_lock<std::shared_timed_mutex> l(g.archapi_mutex);
#endif #endif
bool result = true; bool result = true;
@ -263,7 +263,7 @@ void DetailPlacerThreadState::revert_move()
{ {
if (arch_state_dirty) { if (arch_state_dirty) {
// If changes to the arch state were made, revert them by restoring original cell bindings // If changes to the arch state were made, revert them by restoring original cell bindings
#if !defined(__wasm) #if !defined(NPNR_DISABLE_THREADS)
std::unique_lock<std::shared_timed_mutex> l(g.archapi_mutex); std::unique_lock<std::shared_timed_mutex> l(g.archapi_mutex);
#endif #endif
for (auto &entry : moved_cells) { for (auto &entry : moved_cells) {

View File

@ -52,7 +52,7 @@ aborts the entire move transaction.
#include <queue> #include <queue>
#if !defined(__wasm) #if !defined(NPNR_DISABLE_THREADS)
#include <shared_mutex> #include <shared_mutex>
#endif #endif
@ -98,7 +98,7 @@ struct DetailPlacerState
wirelen_t total_wirelen = 0; wirelen_t total_wirelen = 0;
double total_timing_cost = 0; double total_timing_cost = 0;
#if !defined(__wasm) #if !defined(NPNR_DISABLE_THREADS)
std::shared_timed_mutex archapi_mutex; std::shared_timed_mutex archapi_mutex;
#endif #endif

View File

@ -20,7 +20,7 @@
#include "parallel_refine.h" #include "parallel_refine.h"
#include "log.h" #include "log.h"
#if !defined(__wasm) #if !defined(NPNR_DISABLE_THREADS)
#include "detail_place_core.h" #include "detail_place_core.h"
#include "scope_lock.h" #include "scope_lock.h"
@ -519,7 +519,7 @@ bool parallel_refine(Context *ctx, ParallelRefineCfg cfg)
NEXTPNR_NAMESPACE_END NEXTPNR_NAMESPACE_END
#else /* !defined(__wasm) */ #else /* !defined(NPNR_DISABLE_THREADS) */
NEXTPNR_NAMESPACE_BEGIN NEXTPNR_NAMESPACE_BEGIN

View File

@ -355,7 +355,7 @@ class HeAPPlacer
ctx->check(); ctx->check();
lock.unlock_early(); lock.unlock_early();
#if !defined(__wasm) #if !defined(NPNR_DISABLE_THREADS)
if (cfg.parallelRefine) { if (cfg.parallelRefine) {
if (!parallel_refine(ctx, ParallelRefineCfg(ctx))) { if (!parallel_refine(ctx, ParallelRefineCfg(ctx))) {
return false; return false;