From 6179ddb2a14eefb159ceab9bc8f058ac9345f2c8 Mon Sep 17 00:00:00 2001 From: George Wu Date: Wed, 28 Nov 2018 18:14:20 -0800 Subject: [PATCH] fix for possible incremental build breaks. --- cmake/external/mkldnn.cmake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmake/external/mkldnn.cmake b/cmake/external/mkldnn.cmake index 69d20b8f77c29..8acc389302927 100644 --- a/cmake/external/mkldnn.cmake +++ b/cmake/external/mkldnn.cmake @@ -11,6 +11,9 @@ set(MKLDNN_INCLUDE_DIR ${MKLDNN_INSTALL}/include) # patch for mkldnn_sgemm thread safety bug. # it can be removed once a fix is available in a validated mkldnn release version. set(MKLDNN_PATCH_COMMAND1 git apply ${CMAKE_SOURCE_DIR}/patches/mkldnn/mkldnn_sgemm.patch) +set(MKLDNN_PATCH_COMMAND2 git apply ${CMAKE_SOURCE_DIR}/patches/mkldnn/platform.cmake.patch) +# discard prior changes due to patching in mkldnn source to unblock incremental builds. +set(MKLDNN_PATCH_DISCARD_COMMAND cd ${MKLDNN_SOURCE} && git checkout -- .) if(WIN32) set(MKLDNN_SHARED_LIB mkldnn.dll) @@ -20,7 +23,6 @@ if(WIN32) set(MKLML_SHARED_LIB mklml.dll) set(IOMP5MD_SHARED_LIB libiomp5md.dll) endif() - set(MKLDNN_PATCH_COMMAND2 "") else() set(MKLDNN_SHARED_LIB libmkldnn.so.0) if(onnxruntime_USE_MKLML) @@ -28,7 +30,6 @@ else() set(MKLML_SHARED_LIB libmklml_intel.so) set(IOMP5MD_SHARED_LIB libiomp5.so) endif() - set(MKLDNN_PATCH_COMMAND2 git apply ${CMAKE_SOURCE_DIR}/patches/mkldnn/platform.cmake.patch) endif() if(NOT onnxruntime_USE_MKLDNN OR EXISTS ${MKLDNN_SOURCE}/external) @@ -39,7 +40,7 @@ ExternalProject_Add(project_mkldnn PREFIX mkl-dnn GIT_REPOSITORY ${MKLDNN_URL} GIT_TAG ${MKLDNN_TAG} - PATCH_COMMAND ${DOWNLOAD_MKLML} COMMAND ${MKLDNN_PATCH_COMMAND1} COMMAND ${MKLDNN_PATCH_COMMAND2} + PATCH_COMMAND ${DOWNLOAD_MKLML} COMMAND ${MKLDNN_PATCH_DISCARD_COMMAND} COMMAND ${MKLDNN_PATCH_COMMAND1} COMMAND ${MKLDNN_PATCH_COMMAND2} SOURCE_DIR ${MKLDNN_SOURCE} CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${MKLDNN_INSTALL} )