-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- refactor all simd functions, just like FP32 - add openblas for ubuntu-aarch deps Signed-off-by: LHT129 <tianlan.lht@antgroup.com>
- Loading branch information
Showing
32 changed files
with
1,193 additions
and
1,106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,64 @@ | ||
set (SIMD_SRCS | ||
set(SIMD_SRCS | ||
generic.cpp | ||
sse.cpp | ||
avx.cpp | ||
avx2.cpp | ||
avx512.cpp | ||
simd.cpp | ||
basic_func.cpp | ||
fp32_simd.cpp | ||
sq8_simd.cpp | ||
sq4_simd.cpp | ||
sq4_uniform_simd.cpp | ||
sq8_uniform_simd.cpp | ||
sse.cpp | ||
avx.cpp | ||
avx512.cpp | ||
normalize.cpp | ||
) | ||
if (DIST_CONTAINS_SSE) | ||
set (SIMD_SRCS ${SIMD_SRCS} sse.cpp) | ||
set_source_files_properties ( | ||
set(SIMD_SRCS ${SIMD_SRCS} sse.cpp) | ||
set_source_files_properties( | ||
sse.cpp | ||
PROPERTIES COMPILE_FLAGS | ||
"-msse -msse2 -msse3 -mssse3 -msse4 -msse4a -msse4.1 -msse4.2") | ||
endif () | ||
if (DIST_CONTAINS_AVX) | ||
set (SIMD_SRCS ${SIMD_SRCS} avx.cpp) | ||
set_source_files_properties (avx.cpp PROPERTIES COMPILE_FLAGS "-mavx") | ||
set(SIMD_SRCS ${SIMD_SRCS} avx.cpp) | ||
set_source_files_properties(avx.cpp PROPERTIES COMPILE_FLAGS "-mavx") | ||
endif () | ||
if (DIST_CONTAINS_AVX2) | ||
set_source_files_properties(avx2.cpp PROPERTIES COMPILE_FLAGS "-mavx2 -mfma") | ||
endif () | ||
# FIXME(LHT): cause illegal instruction on platform which has avx only | ||
#if (DIST_CONTAINS_AVX2) | ||
# set_source_files_properties (avx.cpp PROPERTIES COMPILE_FLAGS "-mavx2 -mfma") | ||
#endif () | ||
if (DIST_CONTAINS_AVX512) | ||
set (SIMD_SRCS ${SIMD_SRCS} avx512.cpp | ||
set(SIMD_SRCS ${SIMD_SRCS} avx512.cpp | ||
normalize.cpp) | ||
set_source_files_properties ( | ||
set_source_files_properties( | ||
avx512.cpp | ||
PROPERTIES | ||
COMPILE_FLAGS | ||
"-mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi" | ||
) | ||
endif () | ||
|
||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") | ||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftree-vectorize") | ||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-malloc") | ||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-calloc") | ||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-realloc") | ||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-free") | ||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -fopenmp-simd") | ||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -funroll-loops") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftree-vectorize") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-malloc") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-calloc") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-realloc") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-free") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -fopenmp-simd") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -funroll-loops") | ||
|
||
add_library (simd ${SIMD_SRCS}) | ||
add_library(simd ${SIMD_SRCS}) | ||
|
||
macro (simd_add_definitions flag1 flag2) | ||
macro(simd_add_definitions flag1 flag2) | ||
if (${flag1}) | ||
target_compile_definitions (simd PUBLIC ${flag2}) | ||
target_compile_definitions(simd PUBLIC ${flag2}) | ||
endif () | ||
endmacro () | ||
endmacro() | ||
|
||
simd_add_definitions (DIST_CONTAINS_SSE -DENABLE_SSE=1) | ||
simd_add_definitions (DIST_CONTAINS_AVX -DENABLE_AVX=1) | ||
#simd_add_definitions (DIST_CONTAINS_AVX2 -DENABLE_AVX2=1) | ||
simd_add_definitions (DIST_CONTAINS_AVX512 -DENABLE_AVX512=1) | ||
simd_add_definitions(DIST_CONTAINS_SSE -DENABLE_SSE=1) | ||
simd_add_definitions(DIST_CONTAINS_AVX -DENABLE_AVX=1) | ||
simd_add_definitions(DIST_CONTAINS_AVX2 -DENABLE_AVX2=1) | ||
simd_add_definitions(DIST_CONTAINS_AVX512 -DENABLE_AVX512=1) | ||
|
||
target_link_libraries (simd PRIVATE cpuinfo) | ||
install (TARGETS simd ARCHIVE DESTINATION lib) | ||
target_link_libraries(simd PRIVATE cpuinfo) | ||
install(TARGETS simd ARCHIVE DESTINATION lib) |
Oops, something went wrong.