From d213f9d52ba2bc89af5bbfcf0e283b0db04b0dcc Mon Sep 17 00:00:00 2001 From: anzz1 Date: Sat, 25 Mar 2023 16:28:09 +0200 Subject: [PATCH] CMake: add AVX512 option --- CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51af97c4d..aff7eaec2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,7 @@ option(LLAMA_SANITIZE_UNDEFINED "llama: enable undefined sanitizer" # instruction set specific option(LLAMA_AVX "llama: enable AVX" ON) option(LLAMA_AVX2 "llama: enable AVX2" ON) +option(LLAMA_AVX512 "llama: enable AVX512" OFF) option(LLAMA_FMA "llama: enable FMA" ON) # 3rd party libs @@ -185,7 +186,9 @@ if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(x86_64|i686|AMD64)$") message(STATUS "x86 detected") if (MSVC) - if (LLAMA_AVX2) + if (LLAMA_AVX512) + add_compile_options(/arch:AVX512) + elseif (LLAMA_AVX2) add_compile_options(/arch:AVX2) elseif (LLAMA_AVX) add_compile_options(/arch:AVX) @@ -201,6 +204,12 @@ elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(x86_64|i686|AMD64)$") if (LLAMA_AVX2) add_compile_options(-mavx2) endif() + if (LLAMA_AVX512) + add_compile_options(-mavx512f) + # add_compile_options(-mavx512cd) + # add_compile_options(-mavx512dq) + # add_compile_options(-mavx512bw) + endif() endif() else() # TODO: support PowerPC