Index: head/math/onednn/Makefile =================================================================== --- head/math/onednn/Makefile (revision 554309) +++ head/math/onednn/Makefile (revision 554310) @@ -1,53 +1,62 @@ # $FreeBSD$ PORTNAME= onednn DISTVERSIONPREFIX= v DISTVERSION= 1.7 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= math # machine-learning MAINTAINER= yuri@FreeBSD.org COMMENT= Intel(R) Math Kernel Library for Deep Neural Networks LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/LICENSE BROKEN_i386= error: shift count >= width of type (and other errors), see https://github.com/intel/mkl-dnn/issues/315 TEST_DEPENDS= bash:shells/bash \ libsysinfo>0:devel/libsysinfo USES= cmake compiler:c++11-lang localbase:ldflags USE_GITHUB= yes GH_ACCOUNT= oneapi-src GH_PROJECT= oneDNN USE_LDCONFIG= yes +CMAKE_OFF= BUILD_TESTING + OPTIONS_DEFINE= OPENMP -OPTIONS_DEFAULT= OPENMP +OPTIONS_DEFAULT= OPENMP SIMD_DEFAULT +OPTIONS_SINGLE= SIMD +OPTIONS_SINGLE_SIMD= SIMD_DEFAULT SIMD_NATIVE OPENMP_CMAKE_BOOL= USE_OPENMP OPENMP_BROKEN_OFF= still requires omp.h, see https://github.com/intel/mkl-dnn/issues/581 -CXXFLAGS_amd64= -msse4.1 -CXXFLAGS_i386= -msse4.1 +SIMD_DEFAULT_DESC= Default, no non-default SIMD instructions are used -CXXFLAGS:= ${CXXFLAGS:S/-O2/-O3/} # clang writes wrong binary code when -O2 optimization is used and one testcase is failing, see https://github.com/oneapi-src/oneDNN/issues/873#issuecomment-722778910 +SIMD_NATIVE_DESC= Optimize for this CPU +SIMD_NATIVE_CXXFLAGS= -march=native -.include +SIMD_SSE41_DESC= Use SSE4.1 instructions +SIMD_SSE41_CXXFLAGS= -msse4.1 -.if ${ARCH} != aarch64 && ${ARCH} != amd64 && ${ARCH} != powerpc64 -CMAKE_ARGS+= -DDNNL_TARGET_ARCH:STRING="GENERIC" +ARCH_LOCAL!= /usr/bin/uname -p # because OPTIONS_SINGLE_SIMD doesn't support per-ARCH values OPTIONS_SINGLE_SIMD_{arch}, like OPTIONS_DEFINE_{arch} + +.if ${ARCH_LOCAL} == i386 || ${ARCH_LOCAL} == amd64 +OPTIONS_SINGLE_SIMD+= SIMD_SSE41 .endif +CXXFLAGS:= ${CXXFLAGS:S/-O2/-O3/} # clang writes wrong binary code when -O2 optimization is used and one testcase is failing, see https://github.com/oneapi-src/oneDNN/issues/873#issuecomment-722778910 + post-install: @${RM} -r ${STAGEDIR}${PREFIX}/share/doc do-test: # some tests are known to fail: https://github.com/intel/mkl-dnn/issues/350 (the upstream failed to reproduce it and closed the report) @${REINPLACE_CMD} 's| /bin/bash | ${LOCALBASE}/bin/bash |' ${WRKSRC}/tests/CMakeLists.txt @cd ${BUILD_WRKSRC} && \ - ${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} -DBUILD_TESTS=ON ${CMAKE_SOURCE_PATH} && \ + ${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} -DBUILD_TESTING=ON ${CMAKE_SOURCE_PATH} && \ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} ${ALL_TARGET} && \ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} test .include Index: head/math/onednn/files/patch-CMakeLists.txt =================================================================== --- head/math/onednn/files/patch-CMakeLists.txt (revision 554309) +++ head/math/onednn/files/patch-CMakeLists.txt (revision 554310) @@ -1,28 +1,28 @@ --- CMakeLists.txt.orig 2020-10-28 05:50:44 UTC +++ CMakeLists.txt @@ -115,7 +115,9 @@ include("cmake/mkldnn_compat.cmake") include("cmake/utils.cmake") include("cmake/options.cmake") -include("cmake/OpenMP.cmake") +if (USE_OPENMP) + include("cmake/OpenMP.cmake") +endif() include("cmake/TBB.cmake") include("cmake/Threadpool.cmake") include("cmake/OpenCL.cmake") @@ -160,8 +162,12 @@ include(GNUInstallDirs) include(CMakePackageConfigHelpers) add_subdirectory(src) -add_subdirectory(examples) -add_subdirectory(tests) +if(BUILD_EXAMPLES) + add_subdirectory(examples) +endif() -+if(BUILD_TESTS) ++if(BUILD_TESTING) + add_subdirectory(tests) +endif() if(DNNL_INSTALL_MODE STREQUAL "BUNDLE") install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_PREFIX}) Index: head/math/onednn/files/patch-cmake_platform.cmake =================================================================== --- head/math/onednn/files/patch-cmake_platform.cmake (revision 554309) +++ head/math/onednn/files/patch-cmake_platform.cmake (revision 554310) @@ -1,38 +1,58 @@ --- cmake/platform.cmake.orig 2020-10-28 05:50:44 UTC +++ cmake/platform.cmake @@ -104,22 +104,22 @@ elseif(UNIX OR MINGW) if(DNNL_TARGET_ARCH STREQUAL "AARCH64") set(DEF_ARCH_OPT_FLAGS "-O3") # For native compilation tune for the host processor - if (CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR) + if (FALSE AND CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR) append(DEF_ARCH_OPT_FLAGS "-mcpu=native") endif() elseif(DNNL_TARGET_ARCH STREQUAL "PPC64") set(DEF_ARCH_OPT_FLAGS "-O3") # For native compilation tune for the host processor - if (CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR) + if (FALSE AND CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR) append(DEF_ARCH_OPT_FLAGS "-mcpu=native") endif() elseif(DNNL_TARGET_ARCH STREQUAL "S390X") set(DEF_ARCH_OPT_FLAGS "-O3") # For native compilation tune for the host processor - if (CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR) + if (FALSE AND CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR) append(DEF_ARCH_OPT_FLAGS "-march=native") endif() - elseif(DNNL_TARGET_ARCH STREQUAL "X64") + elseif(FALSE AND DNNL_TARGET_ARCH STREQUAL "X64") set(DEF_ARCH_OPT_FLAGS "-msse4.1") endif() # Clang cannot vectorize some loops with #pragma omp simd and gets -@@ -203,7 +203,7 @@ elseif(UNIX OR MINGW) - if (CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR) +@@ -186,24 +186,24 @@ elseif(UNIX OR MINGW) + if(DNNL_TARGET_ARCH STREQUAL "AARCH64") + set(DEF_ARCH_OPT_FLAGS "-O3") + # For native compilation tune for the host processor +- if (CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR) ++ if (FALSE AND CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR) + append(DEF_ARCH_OPT_FLAGS "-mcpu=native") + endif() + elseif(DNNL_TARGET_ARCH STREQUAL "PPC64") + set(DEF_ARCH_OPT_FLAGS "-O3") + # In GCC, -ftree-vectorize is turned on under -O3 since 2007. + # For native compilation tune for the host processor +- if (CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR) ++ if (FALSE AND CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR) + append(DEF_ARCH_OPT_FLAGS "-mcpu=native") + endif() + elseif(DNNL_TARGET_ARCH STREQUAL "S390X") + set(DEF_ARCH_OPT_FLAGS "-O3") + # In GCC, -ftree-vectorize is turned on under -O3 since 2007. + # For native compilation tune for the host processor +- if (CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR) ++ if (FALSE AND CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR) append(DEF_ARCH_OPT_FLAGS "-march=native") endif() - elseif(DNNL_TARGET_ARCH STREQUAL "X64") + elseif(FALSE AND DNNL_TARGET_ARCH STREQUAL "X64") set(DEF_ARCH_OPT_FLAGS "-msse4.1") endif() # suppress warning on assumptions made regarding overflow (#146)