diff --git a/src/common/dnnl_thread.hpp b/src/common/dnnl_thread.hpp index 342bc3b00..0b9190f9c 100644 --- a/src/common/dnnl_thread.hpp +++ b/src/common/dnnl_thread.hpp @@ -104,10 +104,11 @@ inline int dnnl_get_max_threads() { def_max_threads = (int)dnnl::impl::cpu::platform::get_max_threads_to_use(); assert(def_max_threads > 0); - // Use the default value if the threadpool-provided is outside the range - // [1, def_max_threads] - return tp ? std::min(std::max(1, tp->get_num_threads()), def_max_threads) - : def_max_threads; + + // Make user responsible for number of threads provided at execution time. + // This relates to the fact that the library may identify `def_max_threads` + // incorrectly for a platform. + return tp ? std::max(1, tp->get_num_threads()) : def_max_threads; } inline int dnnl_in_parallel() { using namespace dnnl::impl::threadpool_utils;