Skip to content

Commit

Permalink
Only check hardware when option is ON
Browse files Browse the repository at this point in the history
  • Loading branch information
howard0su committed Apr 7, 2023
1 parent 997c749 commit 5ad9e95
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

#
Expand Down

0 comments on commit 5ad9e95

Please sign in to comment.