Date: Fri, 6 Nov 2020 18:51:36 +0000 (UTC) From: Yuri Victorovich <yuri@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r554310 - in head/math/onednn: . files Message-ID: <202011061851.0A6Ipadu078046@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: yuri Date: Fri Nov 6 18:51:36 2020 New Revision: 554310 URL: https://svnweb.freebsd.org/changeset/ports/554310 Log: math/onednn: Add options for SIMD optimization level; Use standard BUILD_TESTING cmake variable instead of BUILD_TESTS Modified: head/math/onednn/Makefile head/math/onednn/files/patch-CMakeLists.txt head/math/onednn/files/patch-cmake_platform.cmake Modified: head/math/onednn/Makefile ============================================================================== --- head/math/onednn/Makefile Fri Nov 6 18:38:46 2020 (r554309) +++ head/math/onednn/Makefile Fri Nov 6 18:51:36 2020 (r554310) @@ -3,7 +3,7 @@ PORTNAME= onednn DISTVERSIONPREFIX= v DISTVERSION= 1.7 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= math # machine-learning MAINTAINER= yuri@FreeBSD.org @@ -23,30 +23,39 @@ 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 <bsd.port.options.mk> +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 Modified: head/math/onednn/files/patch-CMakeLists.txt ============================================================================== --- head/math/onednn/files/patch-CMakeLists.txt Fri Nov 6 18:38:46 2020 (r554309) +++ head/math/onednn/files/patch-CMakeLists.txt Fri Nov 6 18:51:36 2020 (r554310) @@ -20,7 +20,7 @@ +if(BUILD_EXAMPLES) + add_subdirectory(examples) +endif() -+if(BUILD_TESTS) ++if(BUILD_TESTING) + add_subdirectory(tests) +endif() Modified: head/math/onednn/files/patch-cmake_platform.cmake ============================================================================== --- head/math/onednn/files/patch-cmake_platform.cmake Fri Nov 6 18:38:46 2020 (r554309) +++ head/math/onednn/files/patch-cmake_platform.cmake Fri Nov 6 18:51:36 2020 (r554310) @@ -27,8 +27,28 @@ 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")
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011061851.0A6Ipadu078046>