icemelon9 commented on a change in pull request #4323: [Contrib] Add MKL DNN
option
URL: https://github.com/apache/incubator-tvm/pull/4323#discussion_r345946543
##########
File path: cmake/modules/contrib/BLAS.cmake
##########
@@ -55,3 +55,11 @@ elseif(USE_BLAS STREQUAL "none")
else()
message(FATAL_ERROR "Invalid option: USE_BLAS=" ${USE_BLAS})
endif()
+
+if(USE_MKL_DNN STREQUAL "ON")
+ find_library(BLAS_LIBRARY_MKLDNN dnnl)
+ list(APPEND TVM_RUNTIME_LINKER_LIBS ${BLAS_LIBRARY_MKLDNN})
+ list(APPEND RUNTIME_SRCS ${CBLAS_CONTRIB_SRC})
+ add_definitions(-DUSE_MKL_DNN=1)
+ message(STATUS "Use MKL DNN library " ${BLAS_LIBRARY_MKLDNN})
+endif()
Review comment:
Updated the logic here. MKL DNN will only be used when USE_BLAS is not
`none`. When both are set, MKL DNN will be only used in the sgemm op as the
library has limited support for the BLAS operators. And I find that MKL DNN
kernel achieves better performance than MKL in TVM.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services