From 5d6804159d1241867eba75a57af37bfc50676c6f Mon Sep 17 00:00:00 2001 From: Wojciech Uss Date: Mon, 4 Jan 2021 07:59:21 +0100 Subject: [PATCH 1/3] upgrade oneDNN version to 2.0 master branch --- cmake/external/mkldnn.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/external/mkldnn.cmake b/cmake/external/mkldnn.cmake index 30f9005fc8176..6ba3d7090d39c 100644 --- a/cmake/external/mkldnn.cmake +++ b/cmake/external/mkldnn.cmake @@ -20,7 +20,7 @@ SET(MKLDNN_SOURCE_DIR ${THIRD_PARTY_PATH}/mkldnn/src/extern_mkldnn) SET(MKLDNN_INSTALL_DIR ${THIRD_PARTY_PATH}/install/mkldnn) SET(MKLDNN_INC_DIR "${MKLDNN_INSTALL_DIR}/include" CACHE PATH "mkldnn include directory." FORCE) SET(MKLDNN_REPOSITORY ${GIT_URL}/oneapi-src/oneDNN.git) -SET(MKLDNN_TAG b530ba24c7005ec0f72c06cb55cecd5dffdc5e37) +SET(MKLDNN_TAG a18f78f1f058437e9efee403655d671633360f98) # Introduce variables: # * CMAKE_INSTALL_LIBDIR From 5cb361212d4fc024ce5aaf5c3e7d108f994306fd Mon Sep 17 00:00:00 2001 From: Jacek Czaja Date: Thu, 7 Jan 2021 14:18:44 +0100 Subject: [PATCH 2/3] - Added workarounds for new lib onednn change --- cmake/external/mkldnn.cmake | 3 +++ cmake/inference_lib.cmake | 4 ++-- python/setup.py.in | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmake/external/mkldnn.cmake b/cmake/external/mkldnn.cmake index 6ba3d7090d39c..013c22c8a6cd2 100644 --- a/cmake/external/mkldnn.cmake +++ b/cmake/external/mkldnn.cmake @@ -115,8 +115,11 @@ if(WIN32) else(WIN32) SET(MKLDNN_SHARED_LIB ${MKLDNN_INSTALL_DIR}/libmkldnn.so.0) SET(MKLDNN_SHARED_LIB_1 ${MKLDNN_INSTALL_DIR}/libdnnl.so.1) + SET(MKLDNN_SHARED_LIB_2 ${MKLDNN_INSTALL_DIR}/libdnnl.so.2) ADD_CUSTOM_COMMAND(TARGET ${MKLDNN_PROJECT} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${MKLDNN_LIB} ${MKLDNN_SHARED_LIB}) ADD_CUSTOM_COMMAND(TARGET ${MKLDNN_PROJECT} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${MKLDNN_LIB} ${MKLDNN_SHARED_LIB_1}) + ADD_CUSTOM_COMMAND(TARGET ${MKLDNN_PROJECT} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${MKLDNN_LIB} ${MKLDNN_SHARED_LIB_2}) endif(WIN32) diff --git a/cmake/inference_lib.cmake b/cmake/inference_lib.cmake index d387d5e3c0674..2a5595307ca27 100644 --- a/cmake/inference_lib.cmake +++ b/cmake/inference_lib.cmake @@ -94,8 +94,8 @@ function(copy_part_of_thrid_party TARGET DST) DSTS ${dst_dir} ${dst_dir}/lib ${dst_dir}/lib) else() copy(${TARGET} - SRCS ${MKLDNN_INC_DIR} ${MKLDNN_SHARED_LIB} ${MKLDNN_SHARED_LIB_1} - DSTS ${dst_dir} ${dst_dir}/lib ${dst_dir}/lib) + SRCS ${MKLDNN_INC_DIR} ${MKLDNN_SHARED_LIB} ${MKLDNN_SHARED_LIB_1} ${MKLDNN_SHARED_LIB_2} + DSTS ${dst_dir} ${dst_dir}/lib ${dst_dir}/lib ${dst_dir}/lib) endif() endif() diff --git a/python/setup.py.in b/python/setup.py.in index b29d91caf7ced..83567687dd8a5 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -303,7 +303,8 @@ if '${WITH_MKLDNN}' == 'ON': shutil.copy('${MKLDNN_SHARED_LIB}', libs_path) if os.name != 'nt': shutil.copy('${MKLDNN_SHARED_LIB_1}', libs_path) - package_data['paddle.libs']+=['libmkldnn.so.0', 'libdnnl.so.1'] + shutil.copy('${MKLDNN_SHARED_LIB_2}', libs_path) + package_data['paddle.libs']+=['libmkldnn.so.0', 'libdnnl.so.1', 'libdnnl.so.2'] else: package_data['paddle.libs']+=['mkldnn.dll'] From 493d0e204e0b70b88c58f94146303aa127f819f1 Mon Sep 17 00:00:00 2001 From: Wojciech Uss Date: Mon, 11 Jan 2021 05:50:41 +0100 Subject: [PATCH 3/3] fix regex --- .../tests/unittests/mkldnn/test_flags_mkldnn_ops_on_off.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_flags_mkldnn_ops_on_off.py b/python/paddle/fluid/tests/unittests/mkldnn/test_flags_mkldnn_ops_on_off.py index e935c279b4183..084053acb8cff 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_flags_mkldnn_ops_on_off.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_flags_mkldnn_ops_on_off.py @@ -32,7 +32,7 @@ def setUp(self): self.env[str("FLAGS_use_mkldnn")] = str("1") self.relu_regex = b"^dnnl_verbose,exec,cpu,eltwise,.+alg:eltwise_relu alpha:0 beta:0,10x20x20" - self.ew_add_regex = b"^dnnl_verbose,exec,cpu,binary.+alg:binary_add,10x20x30:10x20x30 10x20x30" + self.ew_add_regex = b"^dnnl_verbose,exec,cpu,binary.+alg:binary_add,10x20x30:10x20x30" self.matmul_regex = b"^dnnl_verbose,exec,cpu,matmul,.*10x20x30:10x30x20:10x20x20" def flags_use_mkl_dnn_common(self, e):