!32071 onednn patch

Merge pull request !32071 from baihuawei/patch
This commit is contained in:
i-robot 2022-03-28 11:50:36 +00:00 committed by Gitee
commit ee2a72aa28
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 14 additions and 0 deletions

View File

@ -36,6 +36,7 @@ else()
MD5 ${MD5}
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/onednn/0001-fix-user-threadpool-bug.patch
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/onednn/0002-fix-pool-nthr-bug.patch
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/onednn/0003-fix-zero-threads-identified-on-AMD.patch
CMAKE_OPTION -DDNNL_ARCH_OPT_FLAGS='' -DDNNL_BUILD_EXAMPLES=OFF -DDNNL_BUILD_TESTS=OFF
${USE_MS_THREADPOOL} -DDNNL_ENABLE_CONCURRENT_EXEC=ON)
endif()

View File

@ -0,0 +1,13 @@
diff --git a/src/cpu/platform.cpp b/src/cpu/platform.cpp
index 1397073ba..041a3436f 100644
--- a/src/cpu/platform.cpp
+++ b/src/cpu/platform.cpp
@@ -154,6 +154,8 @@ unsigned get_num_cores() {
// function supports process affinity.
unsigned get_max_threads_to_use() {
int num_cores_per_socket = (int)dnnl::impl::cpu::platform::get_num_cores();
+ if (num_cores_per_socket == 0)
+ num_cores_per_socket = std::thread::hardware_concurrency();
#if defined(_WIN32)
DWORD_PTR proc_affinity_mask;
DWORD_PTR sys_affinity_mask;