Skip to content

Commit

Permalink
add sync counter to avoid error in one of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi committed Feb 13, 2021
1 parent 0c7303d commit 18fdf41
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/runtime/thread_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,11 @@ TVM_REGISTER_GLOBAL("runtime.config_threadpool").set_body([](TVMArgs args, TVMRe
int TVMBackendParallelLaunch(FTVMParallelLambda flambda, void* cdata, int num_task) {
int num_workers = tvm::runtime::threading::MaxConcurrency();
if (num_workers == 1) {
std::atomic<int32_t> sync_counter{0};
TVMParallelGroupEnv env;
env.num_task = 1;
(*flambda)(1, &env, cdata);
env.sync_handle = &sync_counter;
(*flambda)(0, &env, cdata);
return 0;
} else {
#if !TVM_THREADPOOL_USE_OPENMP
Expand Down

0 comments on commit 18fdf41

Please sign in to comment.