Only check hardware when option is ON

This commit is contained in:
Howard Su 2023-04-07 21:04:47 +08:00
parent 997c749065
commit 5ad9e9531f

View File

@ -143,33 +143,32 @@ MACRO(CHECK_SSE type flags)
ENDMACRO()
CHECK_SSE("AVX" " ;-mavx;/arch:AVX")
CHECK_SSE("AVX2" " ;-mavx2 -mfma;/arch:AVX2")
CHECK_SSE("AVX512" " ;-mavx512f -mavx512dq -mavx512vl -mavx512bw -mfma;/arch:AVX512")
CHECK_SSE("FMA" " ;-mfma;")
IF(${AVX_FOUND})
set(LLAMA_AVX ON)
ELSE()
set(LLAMA_AVX OFF)
IF(${LLAMA_AVX})
CHECK_SSE("AVX" " ;-mavx;/arch:AVX")
IF(NOT ${AVX_FOUND})
set(LLAMA_AVX OFF)
ENDIF()
ENDIF()
IF (${FMA_FOUND})
set(LLAMA_FMA ON)
ELSE()
set(LLAMA_FMA OFF)
IF(${LLAMA_AVX2})
CHECK_SSE("AVX2" " ;-mavx2 -mfma;/arch:AVX2")
IF(NOT ${AVX2_FOUND})
set(LLAMA_AVX2 OFF)
ENDIF()
ENDIF()
IF(${AVX2_FOUND})
set(LLAMA_AVX2 ON)
ELSE()
set(LLAMA_AVX2 OFF)
IF(${LLAMA_AVX512})
CHECK_SSE("AVX512" " ;-mavx512f -mavx512dq -mavx512vl -mavx512bw -mfma;/arch:AVX512")
IF(NOT ${AVX512_FOUND})
set(LLAMA_AVX512 OFF)
ENDIF()
ENDIF()
IF(${AVX512_FOUND})
set(LLAMA_AVX512 ON)
ELSE()
set(LLAMA_AVX512 OFF)
IF(${LLAMA_FMA})
CHECK_SSE("FMA" " ;-mfma;")
IF (NOT ${FMA_FOUND})
set(LLAMA_FMA OFF)
ENDIF()
ENDIF()
#