From: Changcheng Liu Date: Wed, 28 Oct 2020 01:38:29 +0000 (+0800) Subject: cmake: check whether yasm support AVX512 X-Git-Tag: v16.1.0~720^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a62f8d8ea0ae3a178d4958ed3331d25b4be98c49;p=ceph.git cmake: check whether yasm support AVX512 Signed-off-by: Changcheng Liu --- diff --git a/cmake/modules/CheckYasm.cmake b/cmake/modules/CheckYasm.cmake index 557ddc9fa66e..8adea67b0d8a 100644 --- a/cmake/modules/CheckYasm.cmake +++ b/cmake/modules/CheckYasm.cmake @@ -1,4 +1,4 @@ -macro(check_yasm_support _object_format _support_x64 _support_avx2) +macro(check_yasm_support _object_format _support_x64 _support_avx2 _support_avx512) execute_process( COMMAND yasm -f "${_object_format}" ${CMAKE_SOURCE_DIR}/src/common/crc32c_intel_fast_asm.s -o /dev/null RESULT_VARIABLE no_yasm @@ -28,6 +28,16 @@ macro(check_yasm_support _object_format _support_x64 _support_avx2) if(NOT rc) set(${_support_avx2} TRUE) endif(NOT rc) + execute_process(COMMAND yasm -D HAVE_AS_KNOWS_AVX512 -f ${object_format} + -i ${CMAKE_SOURCE_DIR}/src/isa-l/include/ + ${CMAKE_SOURCE_DIR}/src/isa-l/erasure_code/gf_vect_dot_prod_avx512.asm + -o /dev/null + RESULT_VARIABLE not_support_avx512 + OUTPUT_QUIET + ERROR_QUIET) + if(NOT not_support_avx512) + set(${_support_avx512} TRUE) + endif(NOT not_support_avx512) endif(not_arch_x32) endif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64") endif(NOT no_yasm) @@ -35,9 +45,14 @@ macro(check_yasm_support _object_format _support_x64 _support_avx2) message(STATUS "Could NOT find Yasm") elseif(NOT not_arch_x32) message(STATUS "Found Yasm: but x86_64 with x32 ABI is not supported") - elseif(${_support_avx2}) - message(STATUS "Found Yasm: good -- capable of assembling x86_64 and AVX2") - elseif(${_support_x64}) - message(STATUS "Found Yasm: better -- capable of assembling x86_64") + endif() + if(${_support_avx512}) + message(STATUS "Found Yasm: best -- capable of assembling AVX512") + endif() + if(${_support_avx2}) + message(STATUS "Foudd Yasm: better -- capable of assembling AVX2") + endif() + if(${_support_x64}) + message(STATUS "Found Yasm: good -- capable of assembling x86_64") endif() endmacro() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3a66b350542c..39e2fc271cf2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -152,7 +152,8 @@ if(HAVE_INTEL) include(CheckYasm) check_yasm_support(${object_format} HAVE_YASM_X64 - HAVE_YASM_X64_AVX2) + HAVE_YASM_X64_AVX2 + HAVE_YASM_X64_AVX512) endif() endif() diff --git a/src/include/config-h.in.cmake b/src/include/config-h.in.cmake index f9629dc2e9b3..65c1fba6a868 100644 --- a/src/include/config-h.in.cmake +++ b/src/include/config-h.in.cmake @@ -247,6 +247,9 @@ /* yasm can also build the isa-l:avx2 */ #cmakedefine HAVE_YASM_X64_AVX2 +/* yasm can also build the isa-l:avx512 */ +#cmakedefine HAVE_YASM_X64_AVX512 + /* Define if isa-l is compiled for arm64 */ #cmakedefine HAVE_ARMV8_SIMD