You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/02/21 03:36:23 UTC

[GitHub] [tvm] FrozenGene commented on a change in pull request #9802: [Runtime][ThreadPool]Refactor affinity function and support CPU affinity list setting.

FrozenGene commented on a change in pull request #9802:
URL: https://github.com/apache/tvm/pull/9802#discussion_r810754763



##########
File path: src/runtime/thread_pool.cc
##########
@@ -373,13 +375,28 @@ TVM_REGISTER_GLOBAL("runtime.config_threadpool").set_body([](TVMArgs args, TVMRe
   threading::ThreadGroup::AffinityMode mode =
       static_cast<threading::ThreadGroup::AffinityMode>(static_cast<int>(args[0]));
   int nthreads = args[1];
-  ThreadPool::ThreadLocal()->UpdateWorkerConfiguration(mode, nthreads);
+  std::vector<unsigned int> cpus;
+  int max_concurrency = 0;
+  if (args.num_args == 3) {
+    Array<String> cpu_array = args[2];
+    for (auto cpu : cpu_array) {
+      cpus.push_back(std::stoi(cpu));

Review comment:
       What you want to do is to restrict tvm thread run on specific cpu core ids? If so, how to handle Python's API interface? For example:
   ```python
   from tvm._ffi import get_global_func
   config_threadpool = get_global_func('runtime.config_threadpool')
   core_ids = (0, 1, 2)
   config_threadpool(0, 1, *core_ids)
   ```
   ?
   And how to handle the specific core ids is greater than the 2nd argument(i.e. how many threads to lauch)?




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org