Skip to content

Commit

Permalink
Update MKL-DNN to v0.18 release (was: fix the Dense layer issue) (apa…
Browse files Browse the repository at this point in the history
…che#13668)

* update MKL-DNN to fix Dense layer issue(apache#13451)

* fix format numbers

* update mkldnn

* update mkldnn to v0.18 release

* update mklml version & fix mkldnn build

* fix typo

* fix cmake

* fix cmake

* skip test_quantized_conv

* fix quantized_conv and cmake

* Revert "fix cmake"

This reverts commit a9b3886.

* update mkldnn submodule

* update mkldnn head to 0.18.1 patch release

* empty commit to retrigger ci

* retrigger ci
  • Loading branch information
TaoLv authored and haohuw committed Jun 23, 2019
1 parent 56190b9 commit 2180a78
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/mkldnn
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ if(USE_MKLDNN)
add_subdirectory(3rdparty/mkldnn)

include_directories(3rdparty/mkldnn/include)
include_directories(${PROJECT_BINARY_DIR}/3rdparty/mkldnn/include)
add_definitions(-DUSE_MKL=1)
add_definitions(-DCUB_MKL=1)
add_definitions(-DMXNET_USE_MKLDNN=1)
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/install/ubuntu_mklml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
# the whole docker cache for the image

set -ex
wget -q --no-check-certificate -O /tmp/mklml.tgz https://github.com/intel/mkl-dnn/releases/download/v0.17-rc/mklml_lnx_2019.0.1.20180928.tgz
wget -q --no-check-certificate -O /tmp/mklml.tgz https://github.com/intel/mkl-dnn/releases/download/v0.18/mklml_lnx_2019.0.3.20190220.tgz
tar -zxf /tmp/mklml.tgz && cp -rf mklml_*/* /usr/local/ && rm -rf mklml_*
14 changes: 9 additions & 5 deletions cmake/DownloadMKLML.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,19 @@

message(STATUS "Downloading MKLML...")

set(MKLDNN_RELEASE v0.17-rc)
set(MKLML_RELEASE_FILE_SUFFIX 2019.0.1.20180928)
set(MKLDNN_RELEASE v0.18)
set(MKLML_RELEASE_FILE_SUFFIX 2019.0.3.20190220)

set(MKLML_LNX_MD5 76354b74325cd293aba593d7cbe36b3f)
set(MKLML_WIN_MD5 02286cb980f12af610c05e99dbd78755)
set(MKLML_MAC_MD5 3b28da686a25a4cf995ca4fc5e30e514)

if(MSVC)
set(MKL_NAME "mklml_win_${MKLML_RELEASE_FILE_SUFFIX}")

file(DOWNLOAD "https://github.com/intel/mkl-dnn/releases/download/${MKLDNN_RELEASE}/${MKL_NAME}.zip"
"${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.zip"
EXPECTED_MD5 "443e661bdfd32dbbc99b460b43afceee" SHOW_PROGRESS)
EXPECTED_MD5 "${MKLML_WIN_MD5}" SHOW_PROGRESS)
file(DOWNLOAD "https://github.com/apache/incubator-mxnet/releases/download/utils/7z.exe"
"${CMAKE_CURRENT_BINARY_DIR}/mklml/7z2.exe"
EXPECTED_MD5 "E1CF766CF358F368EC97662D06EA5A4C" SHOW_PROGRESS)
Expand All @@ -47,7 +51,7 @@ elseif(APPLE)

file(DOWNLOAD "https://github.com/intel/mkl-dnn/releases/download/${MKLDNN_RELEASE}/${MKL_NAME}.tgz"
"${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.tgz"
EXPECTED_MD5 "95f887af332205b1d15b392260003952" SHOW_PROGRESS)
EXPECTED_MD5 "${MKLML_MAC_MD5}" SHOW_PROGRESS)
execute_process(COMMAND "tar" "-xzf" "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.tgz"
"-C" "${CMAKE_CURRENT_BINARY_DIR}/mklml/")

Expand All @@ -61,7 +65,7 @@ elseif(UNIX)

file(DOWNLOAD "https://github.com/intel/mkl-dnn/releases/download/${MKLDNN_RELEASE}/${MKL_NAME}.tgz"
"${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.tgz"
EXPECTED_MD5 "a63abf155361322b9c03f8fc50f4f317" SHOW_PROGRESS)
EXPECTED_MD5 "${MKLML_LNX_MD5}" SHOW_PROGRESS)
execute_process(COMMAND "tar" "-xzf" "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.tgz"
"-C" "${CMAKE_CURRENT_BINARY_DIR}/mklml/")

Expand Down
5 changes: 5 additions & 0 deletions mkldnn.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ ifeq ($(UNAME_S), Darwin)
OMP_LIBFILE = $(MKLDNNROOT)/lib/libiomp5.dylib
MKLML_LIBFILE = $(MKLDNNROOT)/lib/libmklml.dylib
MKLDNN_LIBFILE = $(MKLDNNROOT)/lib/libmkldnn.0.dylib
MKLDNN_LIB64FILE = $(MKLDNNROOT)/lib64/libmkldnn.0.dylib
else
OMP_LIBFILE = $(MKLDNNROOT)/lib/libiomp5.so
MKLML_LIBFILE = $(MKLDNNROOT)/lib/libmklml_intel.so
MKLDNN_LIBFILE = $(MKLDNNROOT)/lib/libmkldnn.so.0
MKLDNN_LIB64FILE = $(MKLDNNROOT)/lib64/libmkldnn.so.0
endif
endif

Expand All @@ -40,6 +42,9 @@ $(MKLDNN_LIBFILE):
cmake $(MKLDNN_SUBMODDIR) -DCMAKE_INSTALL_PREFIX=$(MKLDNNROOT) -B$(MKLDNN_BUILDDIR) -DARCH_OPT_FLAGS="-mtune=generic" -DWITH_TEST=OFF -DWITH_EXAMPLE=OFF
$(MAKE) -C $(MKLDNN_BUILDDIR) VERBOSE=1
$(MAKE) -C $(MKLDNN_BUILDDIR) install
if [ -f "$(MKLDNN_LIB64FILE)" ]; then \
mv $(MKLDNNROOT)/lib64/libmkldnn* $(MKLDNNROOT)/lib/; \
fi
mkdir -p $(MXNET_LIBDIR)
cp $(OMP_LIBFILE) $(MXNET_LIBDIR)
cp $(MKLML_LIBFILE) $(MXNET_LIBDIR)
Expand Down
2 changes: 2 additions & 0 deletions src/operator/nn/mkldnn/mkldnn_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ mkldnn_memory_format_t GetDefaultFormat(const mkldnn::memory::desc &desc) {
case mkldnn_oihw:
case mkldnn_ihwo:
case mkldnn_hwio:
case mkldnn_iohw:
case mkldnn_oIhw8i:
case mkldnn_oIhw16i:
case mkldnn_OIhw8i8o:
Expand Down Expand Up @@ -372,6 +373,7 @@ mkldnn_memory_format_t GetDefaultFormat(const mkldnn::memory::desc &desc) {
} else if (desc.data.ndims == 5) {
switch (desc.data.format) {
case mkldnn_goihw:
case mkldnn_giohw:
case mkldnn_hwigo:
case mkldnn_hwigo_s8s8:
case mkldnn_gOIhw8i8o:
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/operator/mkldnn_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static void VerifyDefMem(const mkldnn::memory &mem) {

TEST(MKLDNN_UTIL_FUNC, MemFormat) {
// Check whether the number of format is correct.
CHECK_EQ(mkldnn_format_last, 112);
CHECK_EQ(mkldnn_format_last, 114);
CHECK_EQ(mkldnn_nchw, 7);
CHECK_EQ(mkldnn_oihw, 16);
}
Expand Down

0 comments on commit 2180a78

Please sign in to comment.