yidawang commented on a change in pull request #4344: [ThreadPool] Solve thread 
transitions issue
URL: https://github.com/apache/incubator-tvm/pull/4344#discussion_r348672179
 
 

 ##########
 File path: src/runtime/threading_backend.cc
 ##########
 @@ -133,22 +133,39 @@ class ThreadGroup::Impl {
           sizeof(cpu_set_t), &cpuset);
 #endif
     }
-    if (exclude_worker0) {  // bind the master thread to core 0
-      cpu_set_t cpuset;
-      CPU_ZERO(&cpuset);
-      if (reverse) {
-        CPU_SET(sorted_order_[sorted_order_.size() - 1], &cpuset);
-      } else {
-        CPU_SET(sorted_order_[0], &cpuset);
+    if (exclude_worker0) {  // master thread run task
+#if defined(__ANDROID__)
+      SetFullCpuAffinity();
+#else
+      const char* bind_master_thread = getenv("TVM_BIND_MASTER_THREAD");
+      if (bind_master_thread) {
 
 Review comment:
   `pthread_atfork` only take effect when a fork happens. And when it happens, 
the child process will run `ThreadGroup::Impl::SetFullCpuAffinity`, while the 
parent process does nothing (as you have `nullptr`).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to