Skip to content

[SVS] SVS API and functionality update #676

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 24 commits into from
Jun 11, 2025
Merged

Conversation

rfsaliev
Copy link
Collaborator

Describe the changes in the pull request

This PR integrates SVS updates including following:

  • Logging system integration
  • Batch Iterator API changes
  • Scalar Quantization functionality
  • non-Linux and non-x86 platforms support: MacOS and ARM

Which issues this PR fixes

  1. SVS Index is not supported on MacOS and ARM
  2. SVS Index does not support quantization on non-Intel HW
  3. SVS Index Batch Iterator executes search routines at construction time

Main objects this PR modified

  1. SVS Index

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

@rfsaliev rfsaliev requested review from meiravgri and Copilot May 20, 2025 11:03
Copilot

This comment was marked as outdated.

Copy link

codecov bot commented May 20, 2025

Codecov Report

Attention: Patch coverage is 93.25843% with 6 lines in your changes missing coverage. Please review.

Project coverage is 96.64%. Comparing base (ca1137a) to head (a1467b5).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/VecSim/algorithms/svs/svs.h 87.50% 5 Missing ⚠️
src/VecSim/algorithms/svs/svs_batch_iterator.h 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #676      +/-   ##
==========================================
- Coverage   96.65%   96.64%   -0.02%     
==========================================
  Files         121      121              
  Lines        6756     6792      +36     
==========================================
+ Hits         6530     6564      +34     
- Misses        226      228       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

auto sink = std::make_shared<spdlog::sinks::callback_sink_mt>(callback);
auto logger = std::make_shared<spdlog::logger>("SVSIndex", sink);
// Sink all messages to VecSim
logger->set_level(spdlog::level::trace);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@alonre24, this line causes printing al lot of tracing/debug information in flow tests (unit tests use custom log callback to filter-out "debug" logs).
Do you have an idea how can we properly avoid tracing/debug information to be dumped in tests keeping ability for SVS to sink needed logs to VecSim/Redisearch?
I can set logger level to spdlog::level::info here but it will prevent possibility to trace SVS index.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we redirect the logs output to a log file in flow tests somehow?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think, there are different techniques could be used to manage VecSim logs in flow tests:

  1. Extend VecSim python bindings to allow changing VecSim log call back and modify flow tests. See pybind11 docs
  2. Manage pytest capture mode
  3. Modify default callback to print "debug" logs to stdlog + p.2

Copy link
Collaborator

Choose a reason for hiding this comment

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

@meiravgri can we address this issue in a separate PR? I believe that options 2 / 3 are better (so we still have full logs for failing tests if needed)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure I fully follow — if these logs are too verbose for flow tests, wouldn't they also be noisy in production, which we probably want to avoid as well? Or is there a difference in how logging is handled between test and production environments?

Copy link
Collaborator

Choose a reason for hiding this comment

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

In flow tests, all logs at every level are printed, while in production, the default level is "notice".
@dor-forer, can you please handle the logs redirection in tests?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you mean implementing option 2/3 in a separate pr?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes

@rfsaliev rfsaliev requested a review from alonre24 June 2, 2025 15:38
@rfsaliev rfsaliev force-pushed the rfsaliev/svs-new-api-v008-dev branch from 917dfcf to 19629e1 Compare June 3, 2025 17:36
@alonre24 alonre24 requested review from Copilot and dor-forer and removed request for meiravgri June 5, 2025 09:29
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request updates the SVS API and functionality to integrate logging, update the batch iterator API, add scalar quantization support, and enable MacOS/ARM support. Key changes include:

  • Integration of a logging system and new log callback functions.
  • Refactoring and API changes in the SVS index and batch iterator.
  • Updates to Python bindings, CMake configuration, and dependency revisions.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/unit/test_svs.cpp Updated tests to adapt to new vector addition/deletion logic and quantization skip conditions.
tests/flow/test_svs.py Replaced window_size loop variable with epsilon_rt in range query tests.
src/python_bindings/bindings.cpp Added bindings for the new epsilon parameter in SVSRuntimeParams.
src/VecSim/vec_sim_common.h Introduced the scalar quantization enum value.
src/VecSim/index_factories/svs_factory.cpp Added support for scalar quantization in index and vector size calculations.
src/VecSim/algorithms/svs/svs_utils.h Updated distance conversion functions from float to double.
src/VecSim/algorithms/svs/svs_extensions.h Adjusted SVSStorageTraits specialization enable_if condition.
src/VecSim/algorithms/svs/svs_batch_iterator.h Refactored batch iterator implementation with added done flag.
src/VecSim/algorithms/svs/svs.h Integrated logger creation and adjusted query result construction.
cmake/svs.cmake Modified SVS LVQ support check and updated the pre-compiled SVS URL.
deps/ScalableVectorSearch Updated subproject commit hash.

dor-forer
dor-forer previously approved these changes Jun 5, 2025
@dor-forer
Copy link
Collaborator

@rfsaliev Can we merge this?

@rfsaliev
Copy link
Collaborator Author

rfsaliev commented Jun 9, 2025

@rfsaliev Can we merge this?

Yes, I think so.

@dor-forer
Copy link
Collaborator

@rfsaliev I think there are some conflicts after merging #684

@rfsaliev
Copy link
Collaborator Author

@rfsaliev I think there are some conflicts after merging #684

@dor-forer, I've rebased this PR on the last main

@rfsaliev rfsaliev requested a review from dor-forer June 11, 2025 08:25
@rfsaliev
Copy link
Collaborator Author

@dor-forer, your approval is dismissed by rebase.
Can you please review again?
Thank you.

@alonre24 alonre24 enabled auto-merge June 11, 2025 12:26
@alonre24 alonre24 added this pull request to the merge queue Jun 11, 2025
Merged via the queue into main with commit 6963d58 Jun 11, 2025
16 checks passed
@alonre24 alonre24 deleted the rfsaliev/svs-new-api-v008-dev branch June 11, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants