-
Notifications
You must be signed in to change notification settings - Fork 35
Initial implementation of SVS Runtime package #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
84 commits
Select commit
Hold shift + click to select a range
b182f54
Initial implementation of SVS Runtime package
rfsaliev af23806
Initial support for private source
ethanglaser 2e820ed
Point SVS_URL to LTO-enabled tarball
ethanglaser d35d7e3
Improve svs_runtime CMakeLists.txt to use pre-defined LVQ heades and …
rfsaliev 55095a2
Fixup C++ runtime CMakeLists for internal build
rfsaliev dd1324d
Apply formatting
rfsaliev 40177d8
Re-add private source build condition
ethanglaser 9d9643b
Add pipeline to build cpp bindings
ethanglaser 88032d3
rename bash script
ethanglaser c9d2170
add steps to fix yaml error
ethanglaser 2968bb1
Change runs-on to ubuntu-22.04
ethanglaser a409a4a
Add missing repo checkout
ethanglaser 3549b4e
clean up copyright/docker files
ethanglaser 3510961
set CMAKE_INSTALL_LIBDIR
ethanglaser d1918a5
Add flexibility to gcc version check 11.2.*
ethanglaser 5622713
Add resuable function for linking statically to MKL
ethanglaser 07bebdd
Initial faiss python test validation
ethanglaser aa5c4d9
Improved runtime API draft in new header
rfsaliev ce44171
Update API header with comments
rfsaliev e4cf769
Fix upload path
ethanglaser 0dfacfc
Actually fix upload path
ethanglaser 7fd8e81
Add conda env creation
ethanglaser 7ac6519
Add faiss c++ tests
ethanglaser da8ce1a
First implementation of the improved runtime Vamana API
rfsaliev 9c2aaa0
Fix `LeanVecTrainingData` API
rfsaliev 454b682
Refactored VamanaIndex implementation code
rfsaliev a834e5a
Fix non-filtered case in `DynamicVamanaIndex::search()`
rfsaliev 851e1ce
Add new `FlatIndex` API and fix abstract interface descructors
rfsaliev e11e3d3
Update static library tarball
ethanglaser e3ae09c
feature: add version namespace
yuejiaointel 9e5e09d
fix: add version.h to cmake
yuejiaointel 2ee3c71
Replace macros with runtime_error_wrapper() for error handling (#214)
ahuber21 260bd38
Clang-format
rfsaliev 96410aa
Fix Flat index wrapper and LeanVec Training
rfsaliev 876e1b8
Inline versioning namespace
rfsaliev 463e4f3
Remove outdated SVS Runtime code
rfsaliev f2151fe
Improve Status structure to avoid potential memory leaks
rfsaliev c36101c
Move public headers to svs/runtime subdir
rfsaliev 50e88dd
Fix Status linkage visibility
rfsaliev a60b330
Fix non-LVQ failures on non-Intel platforms
rfsaliev 45ac2db
Update static library/tarball to latest
ethanglaser d390fda
Avoid passing exact same LeanVecMatricesType args
ethanglaser 13737cc
Fix "<mkl.h> not found" compilation error
rfsaliev f954ce6
Update static library tarball link
ethanglaser e7cf948
Clean up docker and pipeline
ethanglaser bbb8c7f
Pull svs-io branch for validation
ethanglaser 026dc53
Code review s1e1
rfsaliev 02e3d5b
Add supported storage kind query for index and remove "fallback" mode…
rfsaliev 295134a
test(runtime): add initial set of runtime tests (#218)
ahuber21 d1a5155
fix is_supported_storage_kind() implementation
ahuber21 48f2d5f
update SVS_URL
ahuber21 16428b4
Fixup gitignore
rfsaliev e099248
fixup tests according svs::runtime::v0::ResultsAllocator changes
rfsaliev 0566ca4
Update comments according to code review
rfsaliev dff0b96
Update tarball
ethanglaser eafc674
update test filter
ahuber21 1d6d23f
fix DynamicVamanaIndex::check_storage_kind() implementation
ahuber21 ee0168d
Add runtime tests to pipeline
ethanglaser 618a449
remove custom allocator for assemble
ahuber21 e643504
fix loader forwarding
ahuber21 adcd2cb
Refactor SVS runtime to support public sources-only build.
rfsaliev 2284227
Address default index parameters code review issue
rfsaliev f9df456
Add fully public build + validation to pipeline
ethanglaser 702c4ee
Merge branch 'main' into rfsaliev/cpp-runtime-binding
ethanglaser 9e9c5f3
Add SetIfSpecifiedUtility test
rfsaliev ce0e957
Clean up CI scripts
ethanglaser d4ad7f4
Merge branch 'main' into rfsaliev/cpp-runtime-binding
ethanglaser b15037f
fix codefactor warnings
ahuber21 9f301eb
Minor updates and cleanup
ethanglaser fa29dc3
Merge branch 'rfsaliev/cpp-runtime-binding' of https://github.com/int…
ethanglaser 862c6aa
revert specifying deps versions
ethanglaser c14fa9b
Add newline to eof
ethanglaser 0ae5606
improve names & fail test properly
ahuber21 0f55477
bump Catch2 to same version as in core repo
ahuber21 f14965d
improve memory tests
ahuber21 19bd194
refactor/harmonize flat and dynamic write/read tests
ahuber21 d4eccda
Update CMakeLists.txt according to code review
rfsaliev 2775c42
Apply code review change requests
rfsaliev ea59ba4
Update non gcc-11 SVS_URL to latest release
ethanglaser f95049b
Merge branch 'main' into rfsaliev/cpp-runtime-binding
ethanglaser 4d566da
restore specifying deps versions
ethanglaser 2bf5df1
Merge branch 'main' into rfsaliev/cpp-runtime-binding
ethanglaser 44e90e0
Restore SVS_BUILD_RUNTIME_TESTS
ethanglaser dad2276
Update bindings/cpp/tests/runtime_test.cpp
ethanglaser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| # 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 and test C++ Runtime Bindings | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| # 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: | ||
| name: Build and unit tests for C++ runtime bindings | ||
| runs-on: ubuntu-22.04 | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - name: "with static library" | ||
| enable_lvq_leanvec: "ON" | ||
| suffix: "" | ||
| - name: "public only" | ||
| enable_lvq_leanvec: "OFF" | ||
| suffix: "-public-only" | ||
| fail-fast: false | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
|
|
||
| - 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 \ | ||
| -e ENABLE_LVQ_LEANVEC=${{ matrix.enable_lvq_leanvec }} \ | ||
| -e SUFFIX=${{ matrix.suffix }} \ | ||
| 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${{ matrix.suffix }} | ||
| path: svs-cpp-runtime-bindings${{ matrix.suffix }}.tar.gz | ||
| retention-days: 7 # Reduce retention due to size | ||
|
|
||
| # Run unit tests that were built as part of this job | ||
| - name: Run unit tests in Docker container | ||
| run: | | ||
| docker run --rm \ | ||
| -v ${{ github.workspace }}:/workspace \ | ||
| -w /workspace \ | ||
| svs-manylinux228:latest \ | ||
| /bin/bash -c "source /etc/bashrc || true && ctest --test-dir bindings/cpp/build_cpp_bindings/tests --output-on-failure --verbose" | ||
|
|
||
| # Run full test script using the built artifacts | ||
| test: | ||
| name: Integration tests for C++ runtime | ||
| needs: build-cpp-runtime-bindings | ||
| runs-on: ubuntu-22.04 | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - name: "with static library" | ||
| suffix: "" | ||
| - name: "public only" | ||
| suffix: "-public-only" | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
|
|
||
| - 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${{ matrix.suffix }} | ||
| 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 \ | ||
| -e SUFFIX=${{ matrix.suffix }} \ | ||
| svs-manylinux228:latest \ | ||
| /bin/bash -c "chmod +x docker/x86_64/test-cpp-runtime-bindings.sh && ./docker/x86_64/test-cpp-runtime-bindings.sh" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| # Build directories | ||
| /build*/ | ||
| build/ | ||
| build-*/ | ||
| build_*/ | ||
| usr/ | ||
| wheelhouse/ | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.11 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/dynamic_vamana_index_leanvec_impl.h | ||
| src/training_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 (SVS_RUNTIME_ENABLE_LVQ_LEANVEC) | ||
| 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") | ||
ahuber21 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| endif() | ||
|
|
||
| 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::svs) | ||
| message(FATAL_ERROR | ||
| "Pre-built LVQ/LeanVec SVS library cannot be used in SVS main build. " | ||
| "Please build SVS Runtime using bindings/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-20251119-807-lto.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/v0.0.11/svs-shared-library-0.0.11.tar.gz" | ||
| CACHE STRING "URL to download SVS shared library") | ||
| endif() | ||
| include(FetchContent) | ||
| FetchContent_Declare( | ||
| svs | ||
| URL ${SVS_URL} | ||
| DOWNLOAD_EXTRACT_TIMESTAMP TRUE | ||
| ) | ||
| 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 | ||
mihaic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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}" | ||
| ) | ||
|
|
||
| # Build tests if requested | ||
| if(SVS_BUILD_RUNTIME_TESTS) | ||
| add_subdirectory(tests) | ||
| endif() | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.