@@ -48,15 +48,7 @@ list(REMOVE_ITEM FAISS_SRCS ${FAISS_AVX512_SRCS})
4848knowhere_file_glob (
4949 GLOB
5050 FAISS_AVX2_SRCS
51- thirdparty/faiss/faiss/impl/pq4_fast_scan_search_1.cpp
52- thirdparty/faiss/faiss/impl/pq4_fast_scan_search_qbs.cpp
53- thirdparty/faiss/faiss/IndexPQFastScan.cpp
54- thirdparty/faiss/faiss/IndexIVFFastScan.cpp
55- thirdparty/faiss/faiss/IndexIVFPQFastScan.cpp
5651 thirdparty/faiss/faiss/cppcontrib/knowhere/impl/*avx.cpp
57- thirdparty/faiss/faiss/cppcontrib/knowhere/IndexIVFFastScan.cpp
58- thirdparty/faiss/faiss/cppcontrib/knowhere/IndexIVFPQFastScan.cpp
59- thirdparty/faiss/faiss/cppcontrib/knowhere/IVFFastScanIteratorWorkspace.cpp
6052)
6153# AVX2 vanilla Faiss dynamic dispatch related files
6254knowhere_file_glob (
@@ -74,6 +66,24 @@ list(APPEND FAISS_AVX2_SRCS ${FAISS_DD_AVX2_SRCS})
7466list (REMOVE_ITEM FAISS_SRCS ${FAISS_AVX2_SRCS} )
7567
7668
69+ # FastScan files, which are supported on machine with a lookup
70+ # instructions
71+ knowhere_file_glob (
72+ GLOB
73+ FAISS_FASTSCAN_SRCS
74+ thirdparty/faiss/faiss/impl/pq4_fast_scan_search_1.cpp
75+ thirdparty/faiss/faiss/impl/pq4_fast_scan_search_qbs.cpp
76+ thirdparty/faiss/faiss/IndexPQFastScan.cpp
77+ thirdparty/faiss/faiss/IndexIVFFastScan.cpp
78+ thirdparty/faiss/faiss/IndexIVFPQFastScan.cpp
79+ thirdparty/faiss/faiss/cppcontrib/knowhere/IndexIVFFastScan.cpp
80+ thirdparty/faiss/faiss/cppcontrib/knowhere/IndexIVFPQFastScan.cpp
81+ thirdparty/faiss/faiss/cppcontrib/knowhere/IVFFastScanIteratorWorkspace.cpp
82+ )
83+ # remove fastscan files from general files (they need special flags on x86)
84+ list (REMOVE_ITEM FAISS_SRCS ${FAISS_FASTSCAN_SRCS} )
85+
86+
7787# NEON files
7888knowhere_file_glob (
7989 GLOB
@@ -288,7 +298,7 @@ include_directories(${xxHash_INCLUDE_DIRS})
288298
289299# generate `faiss` library for x86
290300if (__X86_64)
291- add_library (faiss_avx2 OBJECT ${FAISS_AVX2_SRCS} )
301+ add_library (faiss_avx2 OBJECT ${FAISS_AVX2_SRCS} ${FAISS_FASTSCAN_SRCS} )
292302 target_compile_options (faiss_avx2 PRIVATE $<$<COMPILE_LANGUAGE :CXX >: -msse4 .2
293303 -mavx2 -mfma -mf16c -mpopcnt >)
294304 target_compile_definitions (faiss_avx2 PRIVATE COMPILE_SIMD_AVX2 )
@@ -336,7 +346,7 @@ endif()
336346if (__AARCH64)
337347 add_library (faiss STATIC ${FAISS_SRCS} )
338348 target_include_directories (faiss PRIVATE ${Boost_INCLUDE_DIRS} )
339- target_sources (faiss PRIVATE ${FAISS_NEON_SRCS} )
349+ target_sources (faiss PRIVATE ${FAISS_NEON_SRCS} ${FAISS_FASTSCAN_SRCS} )
340350
341351 target_compile_options (
342352 faiss
@@ -392,7 +402,7 @@ endif()
392402if (__RISCV64)
393403 add_library (faiss STATIC ${FAISS_SRCS} )
394404 target_include_directories (faiss PRIVATE ${Boost_INCLUDE_DIRS} )
395- target_sources (faiss PRIVATE ${FAISS_RVV_SRCS} )
405+ target_sources (faiss PRIVATE ${FAISS_RVV_SRCS} ${FAISS_FASTSCAN_SRCS} )
396406
397407 target_compile_options (
398408 faiss
@@ -416,6 +426,7 @@ endif()
416426if (__PPC64)
417427 add_library (faiss STATIC ${FAISS_SRCS} )
418428 target_include_directories (faiss PRIVATE ${Boost_INCLUDE_DIRS} )
429+ target_sources (faiss PRIVATE ${FAISS_FASTSCAN_SRCS} )
419430
420431 target_compile_options (
421432 faiss
0 commit comments