forked from mindspore-Ecosystem/mindspore
oneDNN patch
This commit is contained in:
parent
67e843ec7f
commit
3766a9cd06
|
@ -21,6 +21,7 @@ else()
|
|||
LIBS dnnl mkldnn
|
||||
URL ${REQ_URL}
|
||||
MD5 ${MD5}
|
||||
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/onednn/0001-fix-user-threadpool-bug.patch
|
||||
CMAKE_OPTION -DDNNL_ARCH_OPT_FLAGS='' -DDNNL_BUILD_EXAMPLES=OFF -DDNNL_BUILD_TESTS=OFF
|
||||
-DDNNL_ENABLE_CONCURRENT_EXEC=ON)
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
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;
|
Loading…
Reference in New Issue