File tree Expand file tree Collapse file tree 2 files changed +31
-3
lines changed
Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,11 @@ if(__AARCH64)
101101 target_link_libraries (knowhere_utils PUBLIC glog::glog)
102102endif ()
103103
104-
104+ if (__RISCV64)
105+ set (UTILS_SRC src/simd/hook.cc src/simd/distances_ref.cc)
106+ add_library (knowhere_utils STATIC ${UTILS_SRC} )
107+ target_link_libraries (knowhere_utils PUBLIC glog::glog)
108+ endif ()
105109
106110# ToDo: Add distances_vsx.cc for powerpc64 SIMD acceleration
107111if (__PPC64)
@@ -192,6 +196,28 @@ if(__AARCH64)
192196 target_compile_definitions (faiss PRIVATE FINTEGER=int)
193197endif ()
194198
199+ if (__RISCV64)
200+ knowhere_file_glob(GLOB FAISS_AVX_SRCS thirdparty/faiss/faiss/impl/*avx.cpp)
201+
202+ list (REMOVE_ITEM FAISS_SRCS ${FAISS_AVX_SRCS} )
203+ add_library (faiss STATIC ${FAISS_SRCS} )
204+
205+ target_compile_options (
206+ faiss
207+ PRIVATE $<$<COMPILE_LANGUAGE:CXX>:
208+ -Wno-sign-compare
209+ -Wno-unused-variable
210+ -Wno-reorder
211+ -Wno-unused-local-typedefs
212+ -Wno-unused-function
213+ -Wno-strict-aliasing>)
214+
215+ add_dependencies (faiss knowhere_utils)
216+ target_link_libraries (faiss PUBLIC OpenMP::OpenMP_CXX ${BLAS_LIBRARIES}
217+ ${LAPACK_LIBRARIES} knowhere_utils)
218+ target_compile_definitions (faiss PRIVATE FINTEGER=int)
219+ endif ()
220+
195221if (__PPC64)
196222 knowhere_file_glob(GLOB FAISS_AVX_SRCS thirdparty/faiss/faiss/impl/*avx.cpp)
197223 list (REMOVE_ITEM FAISS_SRCS ${FAISS_AVX_SRCS} )
Original file line number Diff line number Diff line change @@ -4,11 +4,13 @@ macro(detect_target_arch)
44 check_symbol_exists(__aarch64__ "" __AARCH64)
55 check_symbol_exists(__x86_64__ "" __X86_64)
66 check_symbol_exists(__powerpc64__ "" __PPC64)
7+ check_symbol_exists(__riscv "" __RISCV64)
78
89 if (NOT __AARCH64
910 AND NOT __X86_64
10- AND NOT __PPC64)
11- message (FATAL "knowhere only support amd64, ppc64 and arm64 architecture." )
11+ AND NOT __PPC64
12+ AND NOT __RISCV64)
13+ message (FATAL "knowhere only support amd64, ppc64, riscv64 and arm64 architecture." )
1214 endif ()
1315endmacro ()
1416
You can’t perform that action at this time.
0 commit comments