masahi commented on a change in pull request #9802:
URL: https://github.com/apache/tvm/pull/9802#discussion_r807210048
##########
File path: src/runtime/thread_pool.cc
##########
@@ -337,7 +339,7 @@ class ThreadPool {
new tvm::runtime::threading::ThreadGroup(
num_workers_, [this](int worker_id) { this->RunWorker(worker_id);
},
exclude_worker0_ /* include_main_thread */));
- num_workers_used_ = threads_->Configure(threading::ThreadGroup::kBig, 0,
exclude_worker0_);
+ num_workers_used_ = threads_->Configure(threading::ThreadGroup::kBig, 0,
{}, exclude_worker0_);
Review comment:
`{}` means all cpus?
##########
File path: src/runtime/threading_backend.cc
##########
@@ -37,11 +35,14 @@
#if defined(__hexagon__)
#include <dlfcn.h>
#endif
+#include <algorithm>
+#include <thread>
+#define CURRENT_THREAD_HANDLE (static_cast<std::thread::native_handle_type>(0))
namespace tvm {
namespace runtime {
namespace threading {
-
+thread_local int max_concurrency_value = 0;
Review comment:
Drop `_value`
##########
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:
Verify that the string represents a valid integer?
##########
File path: src/runtime/threading_backend.cc
##########
@@ -37,11 +35,14 @@
#if defined(__hexagon__)
#include <dlfcn.h>
#endif
+#include <algorithm>
+#include <thread>
+#define CURRENT_THREAD_HANDLE (static_cast<std::thread::native_handle_type>(0))
namespace tvm {
namespace runtime {
namespace threading {
-
+thread_local int max_concurrency_value = 0;
Review comment:
Why does this need to be `thread_local`?
##########
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));
+ }
+ }
+ if (args.num_args == 4) {
+ max_concurrency = args[3];
+ }
Review comment:
Please document what arguments you added.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]