Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion cmake/libs/libfaiss.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ if(__AARCH64)
target_link_libraries(knowhere_utils PUBLIC glog::glog)
endif()


if(__RISCV64)
set(UTILS_SRC src/simd/hook.cc src/simd/distances_ref.cc)
add_library(knowhere_utils STATIC ${UTILS_SRC})
target_link_libraries(knowhere_utils PUBLIC glog::glog)
endif()

# ToDo: Add distances_vsx.cc for powerpc64 SIMD acceleration
if(__PPC64)
Expand Down Expand Up @@ -192,6 +196,28 @@ if(__AARCH64)
target_compile_definitions(faiss PRIVATE FINTEGER=int)
endif()

if(__RISCV64)
knowhere_file_glob(GLOB FAISS_AVX_SRCS thirdparty/faiss/faiss/impl/*avx.cpp)

list(REMOVE_ITEM FAISS_SRCS ${FAISS_AVX_SRCS})
add_library(faiss STATIC ${FAISS_SRCS})

target_compile_options(
faiss
PRIVATE $<$<COMPILE_LANGUAGE:CXX>:
-Wno-sign-compare
-Wno-unused-variable
-Wno-reorder
-Wno-unused-local-typedefs
-Wno-unused-function
-Wno-strict-aliasing>)

add_dependencies(faiss knowhere_utils)
target_link_libraries(faiss PUBLIC OpenMP::OpenMP_CXX ${BLAS_LIBRARIES}
${LAPACK_LIBRARIES} knowhere_utils)
target_compile_definitions(faiss PRIVATE FINTEGER=int)
endif()

if(__PPC64)
knowhere_file_glob(GLOB FAISS_AVX_SRCS thirdparty/faiss/faiss/impl/*avx.cpp)
list(REMOVE_ITEM FAISS_SRCS ${FAISS_AVX_SRCS})
Expand Down
6 changes: 4 additions & 2 deletions cmake/utils/platform_check.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ macro(detect_target_arch)
check_symbol_exists(__aarch64__ "" __AARCH64)
check_symbol_exists(__x86_64__ "" __X86_64)
check_symbol_exists(__powerpc64__ "" __PPC64)
check_symbol_exists(__riscv "" __RISCV64)

if(NOT __AARCH64
AND NOT __X86_64
AND NOT __PPC64)
message(FATAL "knowhere only support amd64, ppc64 and arm64 architecture.")
AND NOT __PPC64
AND NOT __RISCV64)
message(FATAL "knowhere only support amd64, ppc64, riscv64 and arm64 architecture.")
endif()
endmacro()

Expand Down
Loading