You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by tq...@apache.org on 2020/06/25 05:30:00 UTC

[incubator-tvm] branch master updated: [Thread Backend]Fix CPU Thread Binding for Multiple Sockets (#5918)

This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git


The following commit(s) were added to refs/heads/master by this push:
     new 524552a  [Thread Backend]Fix CPU Thread Binding for Multiple Sockets (#5918)
524552a is described below

commit 524552a81123540e4187bac735d6c54eb6e5c662
Author: Yao Wang <ke...@gmail.com>
AuthorDate: Wed Jun 24 22:29:51 2020 -0700

    [Thread Backend]Fix CPU Thread Binding for Multiple Sockets (#5918)
    
    * Fix CPU Thread Binding for Multiple Sockets
    
    * Backward compatibility
---
 src/runtime/threading_backend.cc | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/runtime/threading_backend.cc b/src/runtime/threading_backend.cc
index e5520ef..80564a2 100644
--- a/src/runtime/threading_backend.cc
+++ b/src/runtime/threading_backend.cc
@@ -159,14 +159,8 @@ class ThreadGroup::Impl {
         CPU_SET(sorted_order_[sorted_order_.size() - i - 1], &cpuset);
       }
     } else {
-      int big_count = big_count_;
-      // Imagine our x86 has cores 0 - 7
-      // physical cores are 0 - 3, logical cores are 4 - 7, big_count_ is 8
-      // we wish we run on physical cores, not logical cores to avoid contention issue.
-#if defined(_M_X64) || defined(__x86_64__)
-      big_count /= 2;  // ignore hyper-threading
-#endif
-      for (int i = 0; i < big_count; ++i) {
+      int num_cpu_workers = std::min(MaxConcurrency(), big_count_);
+      for (int i = 0; i < num_cpu_workers; ++i) {
         CPU_SET(sorted_order_[i], &cpuset);
       }
     }