Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
b2d6285
Initial implementation of SVS Runtime package
rfsaliev Oct 30, 2025
71a3f83
Initial support for private source
ethanglaser Oct 31, 2025
3f95bab
Point SVS_URL to LTO-enabled tarball
ethanglaser Oct 31, 2025
111448e
Improve svs_runtime CMakeLists.txt to use pre-defined LVQ heades and …
rfsaliev Oct 31, 2025
0ca8bbf
Fixup C++ runtime CMakeLists for internal build
rfsaliev Oct 31, 2025
923e002
Apply formatting
rfsaliev Oct 31, 2025
0c490d1
Re-add private source build condition
ethanglaser Oct 31, 2025
0067a3a
Add pipeline to build cpp bindings
ethanglaser Oct 31, 2025
54fe550
rename bash script
ethanglaser Oct 31, 2025
4d74c8b
add steps to fix yaml error
ethanglaser Oct 31, 2025
e42d806
Change runs-on to ubuntu-22.04
ethanglaser Oct 31, 2025
8e3b15f
Add missing repo checkout
ethanglaser Nov 3, 2025
0a9c3d6
clean up copyright/docker files
ethanglaser Nov 3, 2025
32d3d9a
set CMAKE_INSTALL_LIBDIR
ethanglaser Nov 3, 2025
f8791dc
Add flexibility to gcc version check 11.2.*
ethanglaser Nov 3, 2025
473a74b
Add resuable function for linking statically to MKL
ethanglaser Nov 4, 2025
8966732
Improved runtime API draft in new header
rfsaliev Nov 4, 2025
3bbc18c
Update API header with comments
rfsaliev Nov 4, 2025
0540d00
Initial faiss python test validation
ethanglaser Nov 4, 2025
a8361cd
Merge branch 'rfsaliev/cpp-runtime-binding' of https://github.com/int…
ethanglaser Nov 4, 2025
d5d6956
Fix upload path
ethanglaser Nov 4, 2025
883266f
Actually fix upload path
ethanglaser Nov 4, 2025
dc6aa10
Add conda env creation
ethanglaser Nov 4, 2025
ec1cce5
First implementation of the improved runtime Vamana API
rfsaliev Nov 5, 2025
696519b
Add faiss c++ tests
ethanglaser Nov 5, 2025
35afd2a
Merge branch 'rfsaliev/cpp-runtime-binding' of https://github.com/int…
ethanglaser Nov 5, 2025
5b2707e
Apply formatting
rfsaliev Nov 6, 2025
fdcffe2
Fix `LeanVecTrainingData` API
rfsaliev Nov 6, 2025
ae0f97d
Refactored VamanaIndex implementation code
rfsaliev Nov 6, 2025
5ab0758
Fix non-filtered case in `DynamicVamanaIndex::search()`
rfsaliev Nov 6, 2025
f7fbdfc
rebase
ethanglaser Nov 6, 2025
ad9bd20
Add new `FlatIndex` API and fix abstract interface descructors
rfsaliev Nov 6, 2025
1a1e2df
Update static library tarball
ethanglaser Nov 6, 2025
a551e9b
feature: add version namespace
yuejiaointel Nov 7, 2025
bcd7cb3
fix: add version.h to cmake
yuejiaointel Nov 7, 2025
1d100af
Replace macros with runtime_error_wrapper() for error handling (#214)
ahuber21 Nov 7, 2025
c2181e2
Clang-format
rfsaliev Nov 7, 2025
73c18ab
Fix Flat index wrapper and LeanVec Training
rfsaliev Nov 7, 2025
c7e039f
Inline versioning namespace
rfsaliev Nov 7, 2025
597c4b5
Remove outdated SVS Runtime code
rfsaliev Nov 7, 2025
b2c61ba
Improve Status structure to avoid potential memory leaks
rfsaliev Nov 7, 2025
fc11a3a
Move public headers to svs/runtime subdir
rfsaliev Nov 7, 2025
3e25ae3
Fix Status linkage visibility
rfsaliev Nov 7, 2025
33bbe21
Fix non-LVQ failures on non-Intel platforms
rfsaliev Nov 7, 2025
dfc84a8
Fix "<mkl.h> not found" compilation error
rfsaliev Nov 7, 2025
a65a641
Update static library/tarball to latest
ethanglaser Nov 7, 2025
1f20a5b
Avoid passing exact same LeanVecMatricesType args
ethanglaser Nov 7, 2025
1c92666
Merge branch 'rfsaliev/cpp-runtime-binding' of https://github.com/int…
ethanglaser Nov 7, 2025
df8630f
Update static library tarball link
ethanglaser Nov 7, 2025
bb0d1b6
Clean up docker and pipeline
ethanglaser Nov 8, 2025
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
92 changes: 92 additions & 0 deletions .github/workflows/build-cpp-runtime-bindings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Copyright 2025 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Build C++ Runtime Bindings
run-name: ${{ github.event.inputs.run_name || github.event.pull_request.title }}

on:
workflow_dispatch:
inputs:
run_name:
description: "Custom workflow name"
required: false
submodule_url:
description: "Submodule url (e.g. https://github.com/intel/ScalableVectorSearch.git)"
required: false
submodule_sha:
description: "Submodule sha/branch"
required: false
pull_request:

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
build-cpp-runtime-bindings:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v5

- name: Build Docker image
run: |
docker build -t svs-manylinux228:latest -f docker/x86_64/manylinux228/Dockerfile .

- name: Build libraries in Docker container
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
svs-manylinux228:latest \
/bin/bash -c "chmod +x docker/x86_64/build-cpp-runtime-bindings.sh && ./docker/x86_64/build-cpp-runtime-bindings.sh"

- name: Upload cpp runtime bindings artifacts
uses: actions/upload-artifact@v4
with:
name: svs-cpp-runtime-bindings
path: svs-cpp-runtime-bindings.tar.gz
retention-days: 7 # Reduce retention due to size

test:
needs: build-cpp-runtime-bindings
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v5

- name: Build Docker image
run: |
docker build -t svs-manylinux228:latest -f docker/x86_64/manylinux228/Dockerfile .

# Need to download for a new job
- name: Download shared libraries
uses: actions/download-artifact@v4
with:
name: svs-cpp-runtime-bindings
path: runtime_lib

- name: List available artifacts
run: |
ls -la runtime_lib/

- name: Test in Docker container
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-v ${{ github.workspace }}/runtime_lib:/runtime_lib \
-w /workspace \
svs-manylinux228:latest \
/bin/bash -c "chmod +x docker/x86_64/test-cpp-runtime-bindings.sh && ./docker/x86_64/test-cpp-runtime-bindings.sh"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@ __pycache__/
/bindings/python/_skbuild/
/bindings/python/dist/

# CPP bindings build files
/bindings/cpp/build/

# Example generated files.
example_data_*/
194 changes: 194 additions & 0 deletions bindings/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
# Copyright 2025 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.21)
project(svs_runtime VERSION 0.0.10 LANGUAGES CXX)
set(TARGET_NAME svs_runtime)

set(SVS_RUNTIME_HEADERS
include/svs/runtime/version.h
include/svs/runtime/api_defs.h
include/svs/runtime/training.h
include/svs/runtime/vamana_index.h
include/svs/runtime/dynamic_vamana_index.h
include/svs/runtime/flat_index.h
)

set(SVS_RUNTIME_SOURCES
src/svs_runtime_utils.h
src/dynamic_vamana_index_impl.h
src/flat_index_impl.h
src/api_defs.cpp
src/training.cpp
src/vamana_index.cpp
src/dynamic_vamana_index.cpp
src/flat_index.cpp
)

option(SVS_RUNTIME_ENABLE_LVQ_LEANVEC "Enable compilation of SVS runtime with LVQ and LeanVec support" ON)
if (SVS_RUNTIME_ENABLE_LVQ_LEANVEC)
message(STATUS "SVS runtime will be built with LVQ support")
else()
message(STATUS "SVS runtime will be built without LVQ or LeanVec support")
endif()

add_library(${TARGET_NAME} SHARED
${SVS_RUNTIME_HEADERS}
${SVS_RUNTIME_SOURCES}
)

target_include_directories(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
)

find_package(OpenMP REQUIRED)
target_link_libraries(${TARGET_NAME} PUBLIC OpenMP::OpenMP_CXX)

target_compile_options(${TARGET_NAME} PRIVATE
-DSVS_ENABLE_OMP=1
-fvisibility=hidden
)

if(UNIX AND NOT APPLE)
# Don't export 3rd-party symbols from the lib
target_link_options(${TARGET_NAME} PRIVATE "SHELL:-Wl,--exclude-libs,ALL")
endif()

target_compile_features(${TARGET_NAME} INTERFACE cxx_std_20)
set_target_properties(${TARGET_NAME} PROPERTIES PUBLIC_HEADER "${SVS_RUNTIME_HEADERS}")
set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD 20)
set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON)
set_target_properties(${TARGET_NAME} PROPERTIES CXX_EXTENSIONS OFF)
set_target_properties(${TARGET_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} )

if(DEFINED SVS_LVQ_HEADER AND DEFINED SVS_LEANVEC_HEADER)
# expected that pre-defined headers are implementation headers
message(STATUS "Using pre-defined LVQ header: ${SVS_LVQ_HEADER}")
message(STATUS "Using pre-defined LeanVec header: ${SVS_LEANVEC_HEADER}")
else()
set(SVS_LVQ_HEADER "svs/extensions/vamana/lvq.h")
set(SVS_LEANVEC_HEADER "svs/extensions/vamana/leanvec.h")
endif()

if ((SVS_RUNTIME_ENABLE_LVQ_LEANVEC))
if(RUNTIME_BINDINGS_PRIVATE_SOURCE_BUILD)
message(STATUS "Building directly from private sources")
target_link_libraries(${TARGET_NAME} PRIVATE
svs::svs
)
link_mkl_static(${TARGET_NAME})
elseif(TARGET svs_static_library)
# Links to SVS static library built as part of the main SVS build
target_link_libraries(${TARGET_NAME} PRIVATE
svs_devel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is svs_devel? Is there a reason linking here would be different than lines 131-135?

svs_static_library
svs_compile_options
svs_x86_options_base
)
elseif(TARGET svs::svs)
message(FATAL_ERROR
"Pre-built LVQ/LeanVec SVS library cannot be used in SVS main build. "
"Please build SVS Runtime using bindins/cpp directory as CMake source root."
)
else()
# Links to LTO-enabled static library, requires GCC/G++ 11.2
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11.2" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11.3")
set(SVS_URL "https://github.com/intel/ScalableVectorSearch/releases/download/v1.0.0-dev/svs-shared-library-1.0.0-NIGHTLY-20251107-773.tar.gz"
CACHE STRING "URL to download SVS shared library")
else()
message(WARNING
"Pre-built LVQ/LeanVec SVS library requires GCC/G++ v.11.2 to apply LTO optimizations."
"Current compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}"
)
set(SVS_URL "https://github.com/intel/ScalableVectorSearch/releases/download/v1.0.0-dev/svs-shared-library-1.0.0-NIGHTLY-20251017-faiss.tar.gz")
endif()
include(FetchContent)
FetchContent_Declare(
svs
URL ${SVS_URL}
)
FetchContent_MakeAvailable(svs)
list(APPEND CMAKE_PREFIX_PATH "${svs_SOURCE_DIR}")
find_package(svs REQUIRED)
target_link_libraries(${TARGET_NAME} PRIVATE
svs::svs
svs::svs_compile_options
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice when svs::svs_compile_options is not included, performance decreases. I tried it because we do not link it in https://github.com/RedisAI/VectorSimilarity/blob/main/src/VecSim/CMakeLists.txt#L47-L52 - should we?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try it and check VecSim performance.

svs::svs_static_library
)
endif()
target_compile_definitions(${TARGET_NAME} PRIVATE
PUBLIC "SVS_LVQ_HEADER=\"${SVS_LVQ_HEADER}\""
PUBLIC "SVS_LEANVEC_HEADER=\"${SVS_LEANVEC_HEADER}\""
)
else()
# Include the SVS library directly if needed.
if (NOT TARGET svs::svs)
add_subdirectory("../.." "${CMAKE_CURRENT_BINARY_DIR}/svs")
endif()
target_link_libraries(${TARGET_NAME} PRIVATE
svs::svs
svs_compile_options
svs_x86_options_base
)
endif()

# installing
include(GNUInstallDirs)

set(SVS_RUNTIME_EXPORT_NAME ${TARGET_NAME})
set(VERSION_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/${SVS_RUNTIME_EXPORT_NAME}ConfigVersion.cmake")
set(SVS_RUNTIME_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/svs_runtime)
set(SVS_RUNTIME_COMPONENT_NAME "Runtime")

install(TARGETS ${TARGET_NAME}
EXPORT ${SVS_RUNTIME_EXPORT_NAME}
COMPONENT ${SVS_RUNTIME_COMPONENT_NAME}
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include/svs/runtime
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

install(DIRECTORY include/svs/runtime
COMPONENT ${SVS_RUNTIME_COMPONENT_NAME}
DESTINATION include/svs
FILES_MATCHING PATTERN "*.h"
)

install(EXPORT ${SVS_RUNTIME_EXPORT_NAME}
COMPONENT ${SVS_RUNTIME_COMPONENT_NAME}
NAMESPACE svs::
DESTINATION ${SVS_RUNTIME_CONFIG_INSTALL_DIR}
)

include(CMakePackageConfigHelpers)
configure_package_config_file(
"${CMAKE_CURRENT_LIST_DIR}/runtimeConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${SVS_RUNTIME_EXPORT_NAME}Config.cmake"
INSTALL_DESTINATION "${SVS_RUNTIME_CONFIG_INSTALL_DIR}"
)

# Don't make compatibility guarantees until we reach a compatibility milestone.
write_basic_package_version_file(
${VERSION_CONFIG}
VERSION ${PROJECT_VERSION}
COMPATIBILITY ExactVersion
)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${SVS_RUNTIME_EXPORT_NAME}Config.cmake"
"${VERSION_CONFIG}"
COMPONENT ${SVS_RUNTIME_COMPONENT_NAME}
DESTINATION "${SVS_RUNTIME_CONFIG_INSTALL_DIR}"
)

Loading
Loading