Skip to content

Commit 98245e1

Browse files
enhance: Introduce the support of Intel SVS (#48799)
related PRs: * zilliztech/VectorDBBench#749 for vectordbbench * zilliztech/knowhere#1537 for knowhere * #48798 for Milvus 3.0 Signed-off-by: Alexandr Guzhva <alexanderguzhva@gmail.com>
1 parent a14c729 commit 98245e1

3 files changed

Lines changed: 38 additions & 5 deletions

File tree

Makefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ ifdef USE_OPENDAL
5858
use_opendal = ${USE_OPENDAL}
5959
endif
6060

61+
use_svs = OFF
62+
ifdef USE_SVS
63+
use_svs = ${USE_SVS}
64+
endif
65+
6166
# FIPS: default OFF. Set MILVUS_FIPS_ENABLED=ON to enable BoringCrypto.
6267
GOEXPERIMENT_FLAG :=
6368
ifeq ($(MILVUS_FIPS_ENABLED),ON)
@@ -293,19 +298,19 @@ generated-proto: download-milvus-proto build-3rdparty get-proto-deps
293298

294299
build-cpp: generated-proto plan-parser-lib
295300
@echo "Building Milvus cpp library ..."
296-
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -a ${use_asan} -n ${use_disk_index} -y ${use_dynamic_simd} ${AZURE_OPTION} -x ${index_engine} -o ${use_opendal} -f $(tantivy_features))
301+
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -a ${use_asan} -n ${use_disk_index} -y ${use_dynamic_simd} ${AZURE_OPTION} -x ${index_engine} -o ${use_opendal} -f $(tantivy_features) -S ${use_svs})
297302

298303
build-cpp-gpu: generated-proto plan-parser-lib
299304
@echo "Building Milvus cpp gpu library ... "
300-
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -g -n ${use_disk_index} -y ${use_dynamic_simd} ${AZURE_OPTION} -x ${index_engine} -o ${use_opendal} -f $(tantivy_features))
305+
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -g -n ${use_disk_index} -y ${use_dynamic_simd} ${AZURE_OPTION} -x ${index_engine} -o ${use_opendal} -f $(tantivy_features) -S ${use_svs})
301306

302307
build-cpp-with-unittest: generated-proto plan-parser-lib
303308
@echo "Building Milvus cpp library with unittest ... "
304-
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -a ${use_asan} -u -n ${use_disk_index} -y ${use_dynamic_simd} ${AZURE_OPTION} -x ${index_engine} -o ${use_opendal} -f $(tantivy_features))
309+
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -a ${use_asan} -u -n ${use_disk_index} -y ${use_dynamic_simd} ${AZURE_OPTION} -x ${index_engine} -o ${use_opendal} -f $(tantivy_features) -S ${use_svs})
305310

306311
build-cpp-with-coverage: generated-proto plan-parser-lib
307312
@echo "Building Milvus cpp library with coverage and unittest ..."
308-
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -a ${use_asan} -u -c -n ${use_disk_index} -y ${use_dynamic_simd} ${AZURE_OPTION} -x ${index_engine} -o ${use_opendal} -f $(tantivy_features))
313+
@(env bash $(PWD)/scripts/core_build.sh -t ${mode} -a ${use_asan} -u -c -n ${use_disk_index} -y ${use_dynamic_simd} ${AZURE_OPTION} -x ${index_engine} -o ${use_opendal} -f $(tantivy_features) -S ${use_svs})
309314

310315
check-proto-product: generated-proto
311316
@(env bash $(PWD)/scripts/check_proto_product.sh)

internal/core/thirdparty/knowhere/CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ if ( MILVUS_GPU_VERSION STREQUAL "ON" )
3939
set(WITH_CUVS ON CACHE BOOL "" FORCE )
4040
endif ()
4141

42+
if ( WITH_SVS STREQUAL "ON" )
43+
set(WITH_SVS ON CACHE BOOL "" FORCE )
44+
else ()
45+
set(WITH_SVS OFF CACHE BOOL "" FORCE )
46+
endif()
47+
4248
set( CMAKE_PREFIX_PATH ${CONAN_BOOST_ROOT} )
4349
FetchContent_Declare(
4450
knowhere
@@ -58,6 +64,22 @@ if ( NOT knowhere_POPULATED )
5864
${knowhere_BINARY_DIR} )
5965
endif()
6066

67+
# Install the SVS runtime shared library alongside libknowhere.so so that
68+
# the Go linker (and the final binary at runtime) can find it.
69+
# svs_SOURCE_DIR is set inside knowhere's subdirectory scope and does not
70+
# propagate here, so we derive the path from FETCHCONTENT_BASE_DIR which
71+
# is in the CMake cache (set by internal/core/CMakeLists.txt).
72+
if ( WITH_SVS STREQUAL "ON" )
73+
set( _SVS_LIB_DIR "${FETCHCONTENT_BASE_DIR}/svs-src/lib" )
74+
if ( EXISTS "${_SVS_LIB_DIR}" )
75+
install(DIRECTORY ${_SVS_LIB_DIR}/
76+
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
77+
FILES_MATCHING PATTERN "libsvs_runtime.so*")
78+
else()
79+
message(WARNING "SVS enabled but ${_SVS_LIB_DIR} not found \u2014 libsvs_runtime.so will not be installed")
80+
endif()
81+
endif()
82+
6183
# get prometheus COMPILE_OPTIONS
6284
get_property( var DIRECTORY "${knowhere_SOURCE_DIR}" PROPERTY COMPILE_OPTIONS )
6385
message( STATUS "knowhere src compile options: ${var}" )

scripts/core_build.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ BUILD_DISK_ANN="OFF"
100100
USE_ASAN="OFF"
101101
USE_DYNAMIC_SIMD="ON"
102102
USE_OPENDAL="OFF"
103+
USE_SVS="OFF"
103104
TANTIVY_FEATURES=""
104105
INDEX_ENGINE="KNOWHERE"
105106
ENABLE_AZURE_FS="ON"
@@ -111,7 +112,7 @@ fi
111112
: "${USE_PCH:="ON"}"
112113
: "${USE_UNITY_BUILD:="OFF"}"
113114

114-
while getopts "p:t:s:n:a:y:x:o:f:ulcgbZh" arg; do
115+
while getopts "p:t:s:n:a:y:x:o:f:S:ulcgbZh" arg; do
115116
case $arg in
116117
p)
117118
INSTALL_PREFIX=$OPTARG
@@ -157,6 +158,9 @@ while getopts "p:t:s:n:a:y:x:o:f:ulcgbZh" arg; do
157158
o)
158159
USE_OPENDAL=$OPTARG
159160
;;
161+
S)
162+
USE_SVS=$OPTARG
163+
;;
160164
f)
161165
TANTIVY_FEATURES=$OPTARG
162166
;;
@@ -177,6 +181,7 @@ parameter:
177181
-a: build milvus with AddressSanitizer(default: false)
178182
-Z: build milvus without azure-sdk-for-cpp, so cannot use azure blob
179183
-o: build milvus with opendal(default: false)
184+
-S: build milvus with SVS/Intel Scalable Vector Search(default: OFF)
180185
-f: build milvus with tantivy features(default: '')
181186
-h: help
182187
@@ -249,6 +254,7 @@ ${CMAKE_EXTRA_ARGS} \
249254
-DUSE_DYNAMIC_SIMD=${USE_DYNAMIC_SIMD} \
250255
-DCPU_ARCH=${CPU_ARCH} \
251256
-DUSE_OPENDAL=${USE_OPENDAL} \
257+
-DWITH_SVS=${USE_SVS} \
252258
-DINDEX_ENGINE=${INDEX_ENGINE} \
253259
-DTANTIVY_FEATURES_LIST=${TANTIVY_FEATURES} \
254260
-DENABLE_GCP_NATIVE=${ENABLE_GCP_NATIVE} \

0 commit comments

Comments
 (0)