File tree Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,14 @@ SET(DNNL_ENABLE_PRIMITIVE_CACHE TRUE CACHE BOOL "" FORCE)
13
13
set (DPCPP_CPU_ROOT "${PROJECT_SOURCE_DIR} /torch_ipex/csrc/cpu" )
14
14
add_subdirectory (${DPCPP_THIRD_PARTY_ROOT} /mkl-dnn )
15
15
16
+ list (APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR} /cmake/Modules )
17
+
18
+ FIND_PACKAGE (AVX )
19
+
20
+ IF (NOT C_AVX512_FOUND )
21
+ message (FATAL_ERROR "Please build IPEX on Machines that support AVX512." )
22
+ ENDIF ()
23
+
16
24
# Define build type
17
25
IF (CMAKE_BUILD_TYPE MATCHES Debug )
18
26
message ("Debug build." )
Original file line number Diff line number Diff line change
1
+ INCLUDE (CheckCSourceCompiles )
2
+ INCLUDE (CheckCXXSourceCompiles )
3
+
4
+ SET (AVX512_CODE "
5
+ #include <stdint.h>
6
+ #include <immintrin.h>
7
+
8
+ int main() {
9
+ __m256i src;
10
+ __mmask16 mask;
11
+ int16_t addr[16];
12
+ // detect avx512f, avx512bw and avx512vl.
13
+ _mm512_cvtepi16_epi32(_mm256_mask_loadu_epi16(src, mask, (void *)addr));
14
+ return 0;
15
+ }
16
+ " )
17
+
18
+ MACRO (CHECK_SSE lang type flags )
19
+ SET (__FLAG_I 1 )
20
+ SET (CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS} )
21
+ FOREACH (__FLAG ${flags} )
22
+ IF (NOT ${lang} _${type}_FOUND )
23
+ SET (CMAKE_REQUIRED_FLAGS ${__FLAG} )
24
+ IF (lang STREQUAL "CXX" )
25
+ CHECK_CXX_SOURCE_COMPILES ("${${type} _CODE}" ${lang} _HAS_${type}_${__FLAG_I} )
26
+ ELSE ()
27
+ CHECK_C_SOURCE_COMPILES ("${${type} _CODE}" ${lang} _HAS_${type}_${__FLAG_I} )
28
+ ENDIF ()
29
+ IF (${lang} _HAS_${type}_${__FLAG_I} )
30
+ SET (${lang} _${type}_FOUND TRUE CACHE BOOL "${lang} ${type} support" )
31
+ SET (${lang} _${type}_FLAGS "${__FLAG} " CACHE STRING "${lang} ${type} flags" )
32
+ ENDIF ()
33
+ MATH (EXPR __FLAG_I "${__FLAG_I} +1" )
34
+ ENDIF ()
35
+ ENDFOREACH ()
36
+ SET (CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE} )
37
+
38
+ IF (NOT ${lang} _${type}_FOUND )
39
+ SET (${lang} _${type}_FOUND FALSE CACHE BOOL "${lang} ${type} support" )
40
+ SET (${lang} _${type}_FLAGS "" CACHE STRING "${lang} ${type} flags" )
41
+ ENDIF ()
42
+
43
+ MARK_AS_ADVANCED (${lang} _${type}_FOUND ${lang} _${type}_FLAGS )
44
+ ENDMACRO ()
45
+
46
+ CHECK_SSE (C "AVX512" " ;-mavx512f -mavx512bw -mavx512vl ;/arch:AVX512" )
47
+ CHECK_SSE (CXX "AVX512" " ;-mavx512f -mavx512bw -mavx512vl ;/arch:AVX512" )
You can’t perform that action at this time.
0 commit comments