forked from intel/Deep-learning-math-kernel-research
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
152 lines (133 loc) · 6.12 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
include(CMakeDependentOption)
# euler version info
project(Euler CXX C)
option(WITH_TEST "Build with test cases" ON)
option(WITH_VNNI "With CLX VNNI support" OFF)
option(ENABLE_USER_FP16 "user fp16 type support" OFF)
set(EULER_VERSION_MAJOR 0)
set(EULER_VERSION_MINOR 0)
set(EULER_VERSION_PATCH 1)
set(EULER_VERSION
"${EULER_VERSION_MAJOR}.${EULER_VERSION_MINOR}.${EULER_VERSION_PATCH}")
cmake_policy(SET CMP0015 NEW)
cmake_policy(SET CMP0042 NEW)
# expose compiler info
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# general var
set(lib_name "el")
# set build type
if(CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} __build_type)
set (CMAKE_CXX_FLAGS_${__build_type} "")
endif()
# set build flags
if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
message(STATUS "Build type is Debug")
set(__debug ON)
set(WITH_TEST ON)
elseif(${CMAKE_BUILD_TYPE} MATCHES "Profiling")
message(STATUS "Build type is Profiling")
set(__profiling ON)
endif()
include("cmake/flags.cmake")
include("cmake/required.cmake")
# find src files
file (GLOB __euler_source
src/eld_conv.cpp
src/elx_conv.cpp
src/elx_conv_wino_trans_input.cpp
src/elx_conv_wino_trans_weights.cpp
src/elx_conv_wino_gemm.cpp
src/elx_conv_wino_u8s8_gemm.cpp
src/elx_conv_wino_trans_output.cpp
src/elx_conv_wino.cpp
src/elx_conv_wino_xopt.cpp
src/elx_conv_wino_bind.cpp
src/elx_conv_wino_lp.cpp
src/elx_conv_wino_lp_xopt.cpp
src/elx_conv_wino_lp_bind.cpp
src/elx_conv_direct_1x1_bind.cpp
src/elx_conv_direct_1x1.cpp
src/elx_conv_direct_1x1_xopt.cpp
src/elx_conv_direct_1x1_lp_bind.cpp
src/elx_conv_direct_1x1_lp.cpp
src/elx_conv_direct_1x1_lp_xopt.cpp
src/elx_conv_direct_bind.cpp
src/elx_conv_direct.cpp
src/elx_conv_direct_xopt.cpp
src/elx_conv_direct_vmg_bind.cpp
src/elx_conv_direct_vmg.cpp
src/elx_conv_direct_vmg_xopt.cpp
src/elx_conv_direct_lp_bind.cpp
src/elx_conv_direct_lp.cpp
src/elx_conv_direct_lp_xopt.cpp
src/elx_deconv_direct_bind.cpp
src/elx_deconv_direct.cpp
src/elx_deconv_direct_xopt.cpp
src/elx_conv_direct_depthwise_lp.cpp
src/elx_conv_direct_depthwise_lp_xopt.cpp
src/elx_conv_direct_depthwise_lp_bind.cpp
src/elx_stream.cpp
src/elx_reorder.cpp)
set(KGEMM_GEN_DIR ${CMAKE_BINARY_DIR}/kgen)
set(BUILD_KGEMM_GEN_CMD ${KGEMM_GEN_DIR}/kgemm_gen.sh)
set(BUILD_U8S8_KGEMM_GEN_CMD ${KGEMM_GEN_DIR}/u8s8_kgemm_gen.sh)
set(BUILD_KCONV_GEN_CMD ${KGEMM_GEN_DIR}/kconv_gen.sh)
set(BUILD_U8S8_KCONV_GEN_CMD ${KGEMM_GEN_DIR}/u8s8_kconv_gen.sh)
set(BUILD_U8S8_DEPTHWISE_KCONV_GEN_CMD ${KGEMM_GEN_DIR}/u8s8_depthwise_kconv_gen.sh)
set(BUILD_VMG_KCONV_GEN_CMD ${KGEMM_GEN_DIR}/vmg_kconv_gen.sh)
set(BUILD_KGEMM_GEN_SRC1 ${KGEMM_GEN_DIR}/elk_gemm_otj_binder.hxx)
set(BUILD_KGEMM_GEN_SRC2 ${KGEMM_GEN_DIR}/elk_u8s8_gemm_otj_binder.hxx)
set(BUILD_KCONV_GEN_SRC1 ${KGEMM_GEN_DIR}/elk_conv_otj_binder.hxx)
set(BUILD_KCONV_GEN_SRC2 ${KGEMM_GEN_DIR}/elk_u8s8_conv_otj_binder.hxx)
set(BUILD_KCONV_GEN_SRC3 ${KGEMM_GEN_DIR}/elk_vmg_conv_otj_binder.hxx)
set(BUILD_KCONV_GEN_SRC4 ${KGEMM_GEN_DIR}/elk_u8s8_depthwise_conv_otj_binder.hxx)
set(KGEMM_GEN_CMD ${CMAKE_HOME_DIRECTORY}/src/kernel/kgemm_gen.sh)
set(U8S8_KGEMM_GEN_CMD ${CMAKE_HOME_DIRECTORY}/src/kernel/u8s8_kgemm_gen.sh)
set(KCONV_GEN_CMD ${CMAKE_HOME_DIRECTORY}/src/kernel/kconv_gen.sh)
set(VMG_KCONV_GEN_CMD ${CMAKE_HOME_DIRECTORY}/src/kernel/vmg_kconv_gen.sh)
set(U8S8_KCONV_GEN_CMD ${CMAKE_HOME_DIRECTORY}/src/kernel/u8s8_kconv_gen.sh)
set(U8S8_DEPTHWISE_KCONV_GEN_CMD ${CMAKE_HOME_DIRECTORY}/src/kernel/u8s8_depthwise_kconv_gen.sh)
set(KGEMM_GEN_SRC1 ${CMAKE_HOME_DIRECTORY}/src/kernel/elk_gemm_otj_binder.hxx)
set(KGEMM_GEN_SRC2 ${CMAKE_HOME_DIRECTORY}/src/kernel/elk_u8s8_gemm_otj_binder.hxx)
set(KCONV_GEN_SRC1 ${CMAKE_HOME_DIRECTORY}/src/kernel/elk_conv_otj_binder.hxx)
set(KCONV_GEN_SRC2 ${CMAKE_HOME_DIRECTORY}/src/kernel/elk_u8s8_conv_otj_binder.hxx)
set(KCONV_GEN_SRC3 ${CMAKE_HOME_DIRECTORY}/src/kernel/elk_vmg_conv_otj_binder.hxx)
set(KCONV_GEN_SRC4 ${CMAKE_HOME_DIRECTORY}/src/kernel/elk_u8s8_depthwise_conv_otj_binder.hxx)
execute_process(COMMAND mkdir -p ${KGEMM_GEN_DIR})
configure_file(${KGEMM_GEN_CMD} ${BUILD_KGEMM_GEN_CMD} COPYONLY)
configure_file(${U8S8_KGEMM_GEN_CMD} ${BUILD_U8S8_KGEMM_GEN_CMD} COPYONLY)
configure_file(${KCONV_GEN_CMD} ${BUILD_KCONV_GEN_CMD} COPYONLY)
configure_file(${VMG_KCONV_GEN_CMD} ${BUILD_VMG_KCONV_GEN_CMD} COPYONLY)
configure_file(${U8S8_KCONV_GEN_CMD} ${BUILD_U8S8_KCONV_GEN_CMD} COPYONLY)
configure_file(${U8S8_DEPTHWISE_KCONV_GEN_CMD} ${BUILD_U8S8_DEPTHWISE_KCONV_GEN_CMD} COPYONLY)
configure_file(${KGEMM_GEN_SRC1} ${BUILD_KGEMM_GEN_SRC1} COPYONLY)
configure_file(${KGEMM_GEN_SRC2} ${BUILD_KGEMM_GEN_SRC2} COPYONLY)
configure_file(${KCONV_GEN_SRC1} ${BUILD_KCONV_GEN_SRC1} COPYONLY)
configure_file(${KCONV_GEN_SRC2} ${BUILD_KCONV_GEN_SRC2} COPYONLY)
configure_file(${KCONV_GEN_SRC3} ${BUILD_KCONV_GEN_SRC3} COPYONLY)
configure_file(${KCONV_GEN_SRC4} ${BUILD_KCONV_GEN_SRC4} COPYONLY)
execute_process(COMMAND ${BUILD_KGEMM_GEN_CMD} ${BUILD_KGEMM_GEN_SRC1}
${KGEMM_GEN_DIR} ${CMAKE_CXX_COMPILER} ${ENABLE_USER_FP16})
execute_process(COMMAND ${BUILD_U8S8_KGEMM_GEN_CMD} ${BUILD_KGEMM_GEN_SRC2}
${KGEMM_GEN_DIR} ${CMAKE_CXX_COMPILER} ${ENABLE_USER_FP16})
execute_process(COMMAND ${BUILD_KCONV_GEN_CMD} ${BUILD_KCONV_GEN_SRC1}
${KGEMM_GEN_DIR} ${CMAKE_CXX_COMPILER} ${ENABLE_USER_FP16})
execute_process(COMMAND ${BUILD_U8S8_KCONV_GEN_CMD} ${BUILD_KCONV_GEN_SRC2}
${KGEMM_GEN_DIR} ${CMAKE_CXX_COMPILER} ${ENABLE_USER_FP16})
execute_process(COMMAND ${BUILD_VMG_KCONV_GEN_CMD} ${BUILD_KCONV_GEN_SRC3}
${KGEMM_GEN_DIR} ${CMAKE_CXX_COMPILER} ${ENABLE_USER_FP16})
execute_process(COMMAND ${BUILD_U8S8_DEPTHWISE_KCONV_GEN_CMD} ${BUILD_KCONV_GEN_SRC4}
${KGEMM_GEN_DIR} ${CMAKE_CXX_COMPILER} ${ENABLE_USER_FP16})
file (GLOB __euler_gemm_kernel_source ${KGEMM_GEN_DIR}/*.cpp)
include_directories(AFTER . include src tests src/common)
link_directories(lib)
# build lib
add_library(${lib_name} SHARED ${__euler_source} ${__euler_gemm_kernel_source})
set_target_properties(${lib_name} PROPERTIES CXX_VISIBILITY_PRESET hidden)
target_link_libraries(${lib_name} PUBLIC iomp5)
target_link_libraries(${lib_name} PUBLIC rt)
if (WITH_TEST)
add_subdirectory(tests)
endif()