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() ENDMACRO()
CHECK_SSE("AVX" " ;-mavx;/arch:AVX") IF(${LLAMA_AVX})
CHECK_SSE("AVX2" " ;-mavx2 -mfma;/arch:AVX2") CHECK_SSE("AVX" " ;-mavx;/arch:AVX")
CHECK_SSE("AVX512" " ;-mavx512f -mavx512dq -mavx512vl -mavx512bw -mfma;/arch:AVX512") IF(NOT ${AVX_FOUND})
CHECK_SSE("FMA" " ;-mfma;") set(LLAMA_AVX OFF)
ENDIF()
IF(${AVX_FOUND})
set(LLAMA_AVX ON)
ELSE()
set(LLAMA_AVX OFF)
ENDIF() ENDIF()
IF (${FMA_FOUND}) IF(${LLAMA_AVX2})
set(LLAMA_FMA ON) CHECK_SSE("AVX2" " ;-mavx2 -mfma;/arch:AVX2")
ELSE() IF(NOT ${AVX2_FOUND})
set(LLAMA_FMA OFF) set(LLAMA_AVX2 OFF)
ENDIF()
ENDIF() ENDIF()
IF(${AVX2_FOUND}) IF(${LLAMA_AVX512})
set(LLAMA_AVX2 ON) CHECK_SSE("AVX512" " ;-mavx512f -mavx512dq -mavx512vl -mavx512bw -mfma;/arch:AVX512")
ELSE() IF(NOT ${AVX512_FOUND})
set(LLAMA_AVX2 OFF) set(LLAMA_AVX512 OFF)
ENDIF()
ENDIF() ENDIF()
IF(${AVX512_FOUND}) IF(${LLAMA_FMA})
set(LLAMA_AVX512 ON) CHECK_SSE("FMA" " ;-mfma;")
ELSE() IF (NOT ${FMA_FOUND})
set(LLAMA_AVX512 OFF) set(LLAMA_FMA OFF)
ENDIF()
ENDIF() ENDIF()
# #