aboutsummaryrefslogtreecommitdiffstats
path: root/common/placer_heap.cc
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2020-05-24 14:23:35 +0100
committerGitHub <noreply@github.com>2020-05-24 14:23:35 +0100
commitf44498a5301f9f516488fb748c684926be514346 (patch)
treed37948e9ad90850c2d90566cebc5dc6d4ac07fb9 /common/placer_heap.cc
parent2d406f3e275beda8b70b4c7d4d5e43433dd3c43c (diff)
parente7bb04769d5d7262d3ecfd0de49953078174a880 (diff)
downloadnextpnr-f44498a5301f9f516488fb748c684926be514346.tar.gz
nextpnr-f44498a5301f9f516488fb748c684926be514346.tar.bz2
nextpnr-f44498a5301f9f516488fb748c684926be514346.zip
Merge pull request #447 from whitequark/wasi
Port nextpnr-{ice40,ecp5} to WASI
Diffstat (limited to 'common/placer_heap.cc')
-rw-r--r--common/placer_heap.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/common/placer_heap.cc b/common/placer_heap.cc
index c04e7091..8c43c433 100644
--- a/common/placer_heap.cc
+++ b/common/placer_heap.cc
@@ -37,7 +37,6 @@
#include <Eigen/Core>
#include <Eigen/IterativeLinearSolvers>
#include <boost/optional.hpp>
-#include <boost/thread.hpp>
#include <chrono>
#include <deque>
#include <fstream>
@@ -154,9 +153,14 @@ class HeAPPlacer
for (int i = 0; i < 4; i++) {
setup_solve_cells();
auto solve_startt = std::chrono::high_resolution_clock::now();
+#ifdef NPNR_DISABLE_THREADS
+ build_solve_direction(false, -1);
+ build_solve_direction(true, -1);
+#else
boost::thread xaxis([&]() { build_solve_direction(false, -1); });
build_solve_direction(true, -1);
xaxis.join();
+#endif
auto solve_endt = std::chrono::high_resolution_clock::now();
solve_time += std::chrono::duration<double>(solve_endt - solve_startt).count();
@@ -211,13 +215,16 @@ class HeAPPlacer
// Heuristic: don't bother with threading below a certain size
auto solve_startt = std::chrono::high_resolution_clock::now();
- if (solve_cells.size() < 500) {
- build_solve_direction(false, (iter == 0) ? -1 : iter);
- build_solve_direction(true, (iter == 0) ? -1 : iter);
- } else {
+#ifndef NPNR_DISABLE_THREADS
+ if (solve_cells.size() >= 500) {
boost::thread xaxis([&]() { build_solve_direction(false, (iter == 0) ? -1 : iter); });
build_solve_direction(true, (iter == 0) ? -1 : iter);
xaxis.join();
+ } else
+#endif
+ {
+ build_solve_direction(false, (iter == 0) ? -1 : iter);
+ build_solve_direction(true, (iter == 0) ? -1 : iter);
}
auto solve_endt = std::chrono::high_resolution_clock::now();
solve_time += std::chrono::duration<double>(solve_endt - solve_startt).count();