Skip to content

Commit

Permalink
[ThreadPool] Solve thread transitions issue
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenGene committed Nov 15, 2019
1 parent fed79b3 commit c1480ea
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/runtime/thread_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ class ThreadPool {
// The SpscTaskQueue only hosts ONE item at a time
queues_.emplace_back(std::unique_ptr<SpscTaskQueue>(new SpscTaskQueue()));
}
const char* exclude_worker0 = getenv("TVM_EXCLUDE_WORKER0");
if (exclude_worker0 && atoi(exclude_worker0) == 1) {
exclude_worker0_ = true;
}
threads_ = std::unique_ptr<tvm::runtime::threading::ThreadGroup>(
new tvm::runtime::threading::ThreadGroup(
num_workers_, [this](int worker_id) { this->RunWorker(worker_id); },
Expand Down Expand Up @@ -370,11 +374,7 @@ class ThreadPool {
// number of workers used (can be restricted with affinity pref)
int num_workers_used_;
// if excluding worker 0 and using master to run task 0
#ifndef _LIBCPP_SGX_CONFIG
bool exclude_worker0_{true};
#else
bool exclude_worker0_{false};
#endif
std::vector<std::unique_ptr<SpscTaskQueue> > queues_;
std::unique_ptr<tvm::runtime::threading::ThreadGroup> threads_;
};
Expand Down

0 comments on commit c1480ea

Please sign in to comment.