]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: check whether yasm support AVX512
authorChangcheng Liu <changcheng.liu@aliyun.com>
Wed, 28 Oct 2020 01:38:29 +0000 (09:38 +0800)
committerChangcheng Liu <changcheng.liu@aliyun.com>
Thu, 29 Oct 2020 00:57:54 +0000 (08:57 +0800)
Signed-off-by: Changcheng Liu <changcheng.liu@aliyun.com>
cmake/modules/CheckYasm.cmake
src/CMakeLists.txt
src/include/config-h.in.cmake

index 557ddc9fa66e91fc1d9266e3a4547c41c2fa7bf4..8adea67b0d8a2477c7adaf9cc2c7e217f7244c35 100644 (file)
@@ -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()
index 3a66b350542c0fc064778dcc2f95a90bdffd3e0d..39e2fc271cf2e10b30966ad1277bc1d77e086817 100644 (file)
@@ -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()
 
index f9629dc2e9b3bbd82196f9e63b7f4964b3ecc4c5..65c1fba6a8689e2db877751b9abd9c435104843c 100644 (file)
 /* 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