From 9dd4f75c0009b2a38c8edd30c72b6ca576171211 Mon Sep 17 00:00:00 2001 From: yuejiaointel Date: Thu, 2 Apr 2026 14:01:43 -0700 Subject: [PATCH 1/9] add adaptive batch size heuristic for filtered search --- bindings/cpp/src/dynamic_vamana_index_impl.h | 21 ++++++++- bindings/cpp/tests/runtime_test.cpp | 49 ++++++++++++++++++++ bindings/cpp/tests/utils.h | 13 ++++++ 3 files changed, 82 insertions(+), 1 deletion(-) diff --git a/bindings/cpp/src/dynamic_vamana_index_impl.h b/bindings/cpp/src/dynamic_vamana_index_impl.h index 4b16cf4bc..c7bd75041 100644 --- a/bindings/cpp/src/dynamic_vamana_index_impl.h +++ b/bindings/cpp/src/dynamic_vamana_index_impl.h @@ -38,6 +38,20 @@ namespace svs { namespace runtime { +// Compute the next batch size based on observed filter hit rate. +// On the first round (found == 0), returns initial_batch_size unchanged. +// On subsequent rounds, estimates how many candidates are needed to find the +// remaining results given the observed hit rate. +inline size_t compute_filtered_batch_size( + size_t found, size_t needed, size_t total_checked, size_t initial_batch_size +) { + if (found == 0 || found >= needed) { + return initial_batch_size; + } + double hit_rate = static_cast(found) / total_checked; + return static_cast((needed - found) / hit_rate); +} + // Dynamic Vamana index implementation class DynamicVamanaIndexImpl { using allocator_type = svs::data::Blocked>; @@ -125,9 +139,12 @@ class DynamicVamanaIndexImpl { auto query = queries.get_datum(i); auto iterator = impl_->batch_iterator(query); size_t found = 0; + size_t total_checked = 0; + auto batch_size = sp.buffer_config_.get_search_window_size(); do { - iterator.next(k); + iterator.next(batch_size); for (auto& neighbor : iterator.results()) { + total_checked++; if (filter->is_member(neighbor.id())) { result.set(neighbor, i, found); found++; @@ -136,6 +153,8 @@ class DynamicVamanaIndexImpl { } } } + batch_size = + compute_filtered_batch_size(found, k, total_checked, batch_size); } while (found < k && !iterator.done()); // Pad results if not enough neighbors found diff --git a/bindings/cpp/tests/runtime_test.cpp b/bindings/cpp/tests/runtime_test.cpp index 201375d3c..2f296790c 100644 --- a/bindings/cpp/tests/runtime_test.cpp +++ b/bindings/cpp/tests/runtime_test.cpp @@ -501,6 +501,55 @@ CATCH_TEST_CASE("SearchWithIDFilter", "[runtime]") { svs::runtime::v0::DynamicVamanaIndex::destroy(index); } +CATCH_TEST_CASE("SearchWithRestrictiveFilter", "[runtime][filtered_search]") { + const auto& test_data = get_test_data(); + // Build index + svs::runtime::v0::DynamicVamanaIndex* index = nullptr; + svs::runtime::v0::VamanaIndex::BuildParams build_params{64}; + svs::runtime::v0::Status status = svs::runtime::v0::DynamicVamanaIndex::build( + &index, + test_d, + svs::runtime::v0::MetricType::L2, + svs::runtime::v0::StorageKind::FP32, + build_params + ); + CATCH_REQUIRE(status.ok()); + CATCH_REQUIRE(index != nullptr); + + // Add data + std::vector labels(test_n); + std::iota(labels.begin(), labels.end(), 0); + status = index->add(test_n, labels.data(), test_data.data()); + CATCH_REQUIRE(status.ok()); + + const int nq = 5; + const float* xq = test_data.data(); + const int k = 5; + + // 10% selectivity: accept every 10th ID + std::unordered_set valid_ids; + for (size_t i = 0; i < test_n; i += 10) { + valid_ids.insert(i); + } + test_utils::IDFilterSet filter(valid_ids); + + std::vector distances(nq * k); + std::vector result_labels(nq * k); + + status = + index->search(nq, xq, k, distances.data(), result_labels.data(), nullptr, &filter); + CATCH_REQUIRE(status.ok()); + + // All returned labels must be in the valid set + for (int i = 0; i < nq * k; ++i) { + if (svs::runtime::v0::is_specified(result_labels[i])) { + CATCH_REQUIRE(valid_ids.contains(result_labels[i])); + } + } + + svs::runtime::v0::DynamicVamanaIndex::destroy(index); +} + CATCH_TEST_CASE("RangeSearchFunctional", "[runtime]") { const auto& test_data = get_test_data(); // Build index diff --git a/bindings/cpp/tests/utils.h b/bindings/cpp/tests/utils.h index 8d1bc89f6..e2174b938 100644 --- a/bindings/cpp/tests/utils.h +++ b/bindings/cpp/tests/utils.h @@ -22,6 +22,7 @@ #include #include #include +#include #include namespace svs_test { @@ -73,6 +74,18 @@ class IDFilterRange : public svs::runtime::v0::IDFilter { bool is_member(size_t id) const override { return id >= min_id_ && id < max_id_; } }; +// ID filter that accepts only IDs in a given set +class IDFilterSet : public svs::runtime::v0::IDFilter { + private: + std::unordered_set valid_ids_; + + public: + IDFilterSet(std::unordered_set ids) + : valid_ids_(std::move(ids)) {} + + bool is_member(size_t id) const override { return valid_ids_.contains(id); } +}; + // Custom results allocator for testing class TestResultsAllocator : public svs::runtime::v0::ResultsAllocator { private: From 30d26c420e0ec5cb68a114cd6e7d6ea2c8f82f06 Mon Sep 17 00:00:00 2001 From: yuejiaointel Date: Thu, 2 Apr 2026 14:16:16 -0700 Subject: [PATCH 2/9] use IDFilterRange instead of IDFilterSet in test --- bindings/cpp/tests/runtime_test.cpp | 15 +++++++-------- bindings/cpp/tests/utils.h | 13 ------------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/bindings/cpp/tests/runtime_test.cpp b/bindings/cpp/tests/runtime_test.cpp index 2f296790c..92b819894 100644 --- a/bindings/cpp/tests/runtime_test.cpp +++ b/bindings/cpp/tests/runtime_test.cpp @@ -526,12 +526,10 @@ CATCH_TEST_CASE("SearchWithRestrictiveFilter", "[runtime][filtered_search]") { const float* xq = test_data.data(); const int k = 5; - // 10% selectivity: accept every 10th ID - std::unordered_set valid_ids; - for (size_t i = 0; i < test_n; i += 10) { - valid_ids.insert(i); - } - test_utils::IDFilterSet filter(valid_ids); + // 10% selectivity: accept only IDs 0-9 out of 100 + size_t min_id = 0; + size_t max_id = test_n / 10; + test_utils::IDFilterRange filter(min_id, max_id); std::vector distances(nq * k); std::vector result_labels(nq * k); @@ -540,10 +538,11 @@ CATCH_TEST_CASE("SearchWithRestrictiveFilter", "[runtime][filtered_search]") { index->search(nq, xq, k, distances.data(), result_labels.data(), nullptr, &filter); CATCH_REQUIRE(status.ok()); - // All returned labels must be in the valid set + // All returned labels must fall inside the filter range for (int i = 0; i < nq * k; ++i) { if (svs::runtime::v0::is_specified(result_labels[i])) { - CATCH_REQUIRE(valid_ids.contains(result_labels[i])); + CATCH_REQUIRE(result_labels[i] >= min_id); + CATCH_REQUIRE(result_labels[i] < max_id); } } diff --git a/bindings/cpp/tests/utils.h b/bindings/cpp/tests/utils.h index e2174b938..8d1bc89f6 100644 --- a/bindings/cpp/tests/utils.h +++ b/bindings/cpp/tests/utils.h @@ -22,7 +22,6 @@ #include #include #include -#include #include namespace svs_test { @@ -74,18 +73,6 @@ class IDFilterRange : public svs::runtime::v0::IDFilter { bool is_member(size_t id) const override { return id >= min_id_ && id < max_id_; } }; -// ID filter that accepts only IDs in a given set -class IDFilterSet : public svs::runtime::v0::IDFilter { - private: - std::unordered_set valid_ids_; - - public: - IDFilterSet(std::unordered_set ids) - : valid_ids_(std::move(ids)) {} - - bool is_member(size_t id) const override { return valid_ids_.contains(id); } -}; - // Custom results allocator for testing class TestResultsAllocator : public svs::runtime::v0::ResultsAllocator { private: From 302e58daaa8d5a89e503f70a97978baa27005399 Mon Sep 17 00:00:00 2001 From: yuejiaointel Date: Fri, 3 Apr 2026 17:12:36 -0700 Subject: [PATCH 3/9] address PR review: refactor and optimize adaptive batch size - Rename compute_filtered_batch_size to predict_further_processing and move to svs_runtime_utils.h for reuse - Use float arithmetic instead of double for hit rate calculation - Compute batch size at loop start to avoid unnecessary computation - Use iterator.size() instead of per-element increment for total_checked - Initial batch size = max(k, search_window_size) - Apply adaptive batch size to vamana_index_impl.h filtered search --- bindings/cpp/src/dynamic_vamana_index_impl.h | 22 ++++---------------- bindings/cpp/src/svs_runtime_utils.h | 14 +++++++++++++ bindings/cpp/src/vamana_index_impl.h | 7 ++++++- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/bindings/cpp/src/dynamic_vamana_index_impl.h b/bindings/cpp/src/dynamic_vamana_index_impl.h index c7bd75041..fe4c0b49b 100644 --- a/bindings/cpp/src/dynamic_vamana_index_impl.h +++ b/bindings/cpp/src/dynamic_vamana_index_impl.h @@ -38,20 +38,6 @@ namespace svs { namespace runtime { -// Compute the next batch size based on observed filter hit rate. -// On the first round (found == 0), returns initial_batch_size unchanged. -// On subsequent rounds, estimates how many candidates are needed to find the -// remaining results given the observed hit rate. -inline size_t compute_filtered_batch_size( - size_t found, size_t needed, size_t total_checked, size_t initial_batch_size -) { - if (found == 0 || found >= needed) { - return initial_batch_size; - } - double hit_rate = static_cast(found) / total_checked; - return static_cast((needed - found) / hit_rate); -} - // Dynamic Vamana index implementation class DynamicVamanaIndexImpl { using allocator_type = svs::data::Blocked>; @@ -140,11 +126,13 @@ class DynamicVamanaIndexImpl { auto iterator = impl_->batch_iterator(query); size_t found = 0; size_t total_checked = 0; - auto batch_size = sp.buffer_config_.get_search_window_size(); + auto batch_size = std::max(k, sp.buffer_config_.get_search_window_size()); do { + batch_size = + predict_further_processing(total_checked, found, k, batch_size); iterator.next(batch_size); + total_checked += iterator.size(); for (auto& neighbor : iterator.results()) { - total_checked++; if (filter->is_member(neighbor.id())) { result.set(neighbor, i, found); found++; @@ -153,8 +141,6 @@ class DynamicVamanaIndexImpl { } } } - batch_size = - compute_filtered_batch_size(found, k, total_checked, batch_size); } while (found < k && !iterator.done()); // Pad results if not enough neighbors found diff --git a/bindings/cpp/src/svs_runtime_utils.h b/bindings/cpp/src/svs_runtime_utils.h index e0d7c68af..b5fd12756 100644 --- a/bindings/cpp/src/svs_runtime_utils.h +++ b/bindings/cpp/src/svs_runtime_utils.h @@ -431,6 +431,20 @@ auto dispatch_storage_kind(StorageKind kind, F&& f, Args&&... args) { } } // namespace storage +// Predict how many more items need to be processed to reach the goal, +// based on the observed hit rate so far. +// If no hits yet, returns `hint` unchanged. +// The caller should cap the result to a max batch size if needed. +inline size_t predict_further_processing( + size_t processed, size_t hits, size_t goal, size_t hint +) { + if (hits == 0 || hits >= goal) { + return hint; + } + float batch_size = static_cast(goal - hits) * processed / hits; + return std::max(static_cast(batch_size), size_t{1}); +} + inline svs::threads::ThreadPoolHandle default_threadpool() { return svs::threads::ThreadPoolHandle(svs::threads::OMPThreadPool(omp_get_max_threads()) ); diff --git a/bindings/cpp/src/vamana_index_impl.h b/bindings/cpp/src/vamana_index_impl.h index 4cf58d7e0..d5a731017 100644 --- a/bindings/cpp/src/vamana_index_impl.h +++ b/bindings/cpp/src/vamana_index_impl.h @@ -131,8 +131,13 @@ class VamanaIndexImpl { auto query = queries.get_datum(i); auto iterator = get_impl()->batch_iterator(query); size_t found = 0; + size_t total_checked = 0; + auto batch_size = std::max(k, sp.buffer_config_.get_search_window_size()); do { - iterator.next(k); + batch_size = + predict_further_processing(total_checked, found, k, batch_size); + iterator.next(batch_size); + total_checked += iterator.size(); for (auto& neighbor : iterator.results()) { if (filter->is_member(neighbor.id())) { result.set(neighbor, i, found); From 18d41bbd816cd34254b7af4be77b9068de6bdbda Mon Sep 17 00:00:00 2001 From: yuejiaointel Date: Fri, 3 Apr 2026 22:40:09 -0700 Subject: [PATCH 4/9] add batch size cap and comments to adaptive filtered search - Cap batch size with std::min instead of modulo to avoid SIGFPE - Add comments explaining adaptive batch sizing logic --- bindings/cpp/src/dynamic_vamana_index_impl.h | 12 ++++++++++-- bindings/cpp/src/vamana_index_impl.h | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/bindings/cpp/src/dynamic_vamana_index_impl.h b/bindings/cpp/src/dynamic_vamana_index_impl.h index fe4c0b49b..f74978591 100644 --- a/bindings/cpp/src/dynamic_vamana_index_impl.h +++ b/bindings/cpp/src/dynamic_vamana_index_impl.h @@ -126,10 +126,18 @@ class DynamicVamanaIndexImpl { auto iterator = impl_->batch_iterator(query); size_t found = 0; size_t total_checked = 0; + // Use adaptive batch sizing: start with at least k candidates, + // then adjust based on observed filter hit rate. auto batch_size = std::max(k, sp.buffer_config_.get_search_window_size()); + const auto max_batch_size = batch_size; do { - batch_size = - predict_further_processing(total_checked, found, k, batch_size); + // Estimate how many candidates we need to find remaining + // results given the observed hit rate so far. + batch_size = predict_further_processing( + total_checked, found, k, batch_size + ); + // Cap to avoid oversized batches in the iterator. + batch_size = std::min(batch_size, max_batch_size); iterator.next(batch_size); total_checked += iterator.size(); for (auto& neighbor : iterator.results()) { diff --git a/bindings/cpp/src/vamana_index_impl.h b/bindings/cpp/src/vamana_index_impl.h index d5a731017..65cee325f 100644 --- a/bindings/cpp/src/vamana_index_impl.h +++ b/bindings/cpp/src/vamana_index_impl.h @@ -132,10 +132,18 @@ class VamanaIndexImpl { auto iterator = get_impl()->batch_iterator(query); size_t found = 0; size_t total_checked = 0; + // Use adaptive batch sizing: start with at least k candidates, + // then adjust based on observed filter hit rate. auto batch_size = std::max(k, sp.buffer_config_.get_search_window_size()); + const auto max_batch_size = batch_size; do { - batch_size = - predict_further_processing(total_checked, found, k, batch_size); + // Estimate how many candidates we need to find remaining + // results given the observed hit rate so far. + batch_size = predict_further_processing( + total_checked, found, k, batch_size + ); + // Cap to avoid oversized batches in the iterator. + batch_size = std::min(batch_size, max_batch_size); iterator.next(batch_size); total_checked += iterator.size(); for (auto& neighbor : iterator.results()) { From 51dc806d5d50efe5d38a2faecfda46b36115444f Mon Sep 17 00:00:00 2001 From: yuejiaointel Date: Mon, 6 Apr 2026 12:21:53 -0700 Subject: [PATCH 5/9] fix manylinux2014 Docker build: update CA certificates for Intel oneAPI repo The CentOS 7 base image has outdated CA certificates that no longer trust Intel's yum.repos.intel.com TLS certificate, causing the Docker build to fail with curl#60. --- docker/x86_64/manylinux2014/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/x86_64/manylinux2014/Dockerfile b/docker/x86_64/manylinux2014/Dockerfile index 1935f6aef..8502084b8 100644 --- a/docker/x86_64/manylinux2014/Dockerfile +++ b/docker/x86_64/manylinux2014/Dockerfile @@ -16,6 +16,9 @@ FROM quay.io/pypa/manylinux2014_x86_64:2024-07-15-c746fd8 COPY ./oneAPI.repo /etc/yum.repos.d/oneAPI.repo +# Update CA certificates so Intel's oneAPI repo TLS cert is trusted +RUN yum update -y ca-certificates nss && update-ca-trust + # Install gcc-11 RUN yum --disablerepo=epel install -y \ devtoolset-11-gcc \ From 22d2960580132d1828498d13fc574d25020da63a Mon Sep 17 00:00:00 2001 From: yuejiaointel Date: Mon, 6 Apr 2026 12:23:10 -0700 Subject: [PATCH 6/9] update SVS_URL from 0.2.0 to 0.3.0 in binaries --- bindings/cpp/CMakeLists.txt | 4 ++-- examples/cpp/shared/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bindings/cpp/CMakeLists.txt b/bindings/cpp/CMakeLists.txt index b10cfda12..7869c4822 100644 --- a/bindings/cpp/CMakeLists.txt +++ b/bindings/cpp/CMakeLists.txt @@ -123,14 +123,14 @@ if (SVS_RUNTIME_ENABLE_LVQ_LEANVEC) 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/v0.2.0/svs-shared-library-0.2.0-lto-ivf.tar.gz" + set(SVS_URL "https://github.com/intel/ScalableVectorSearch/releases/download/v0.3.0/svs-shared-library-0.3.0-lto-ivf.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.2.0/svs-shared-library-0.2.0-ivf.tar.gz" + set(SVS_URL "https://github.com/intel/ScalableVectorSearch/releases/download/v0.3.0/svs-shared-library-0.3.0-ivf.tar.gz" CACHE STRING "URL to download SVS shared library") endif() include(FetchContent) diff --git a/examples/cpp/shared/CMakeLists.txt b/examples/cpp/shared/CMakeLists.txt index 4c6b93db9..cec6b4308 100644 --- a/examples/cpp/shared/CMakeLists.txt +++ b/examples/cpp/shared/CMakeLists.txt @@ -24,7 +24,7 @@ find_package(svs QUIET) if(NOT svs_FOUND) # If sourcing from pip/conda, the following steps are not necessary, simplifying workflow # If not found, download tarball from GitHub release and follow steps to fetch and find - set(SVS_URL "https://github.com/intel/ScalableVectorSearch/releases/download/v0.2.0/svs-shared-library-0.2.0.tar.gz" CACHE STRINGS "URL to download SVS shared library tarball if not found in system") + set(SVS_URL "https://github.com/intel/ScalableVectorSearch/releases/download/v0.3.0/svs-shared-library-0.3.0.tar.gz" CACHE STRINGS "URL to download SVS shared library tarball if not found in system") message(STATUS "SVS not found in system, downloading from: ${SVS_URL}") From dab936c39a4f9c146eda101df1a06c4c9ee5a19c Mon Sep 17 00:00:00 2001 From: yuejiaointel Date: Mon, 6 Apr 2026 12:32:05 -0700 Subject: [PATCH 7/9] fix: update CA certs before adding oneAPI repo in Dockerfile Move the ca-certificates/nss update before copying the oneAPI repo config, so yum doesn't try to reach the untrusted Intel repo while updating certs. --- docker/x86_64/manylinux2014/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/x86_64/manylinux2014/Dockerfile b/docker/x86_64/manylinux2014/Dockerfile index 8502084b8..99949faa3 100644 --- a/docker/x86_64/manylinux2014/Dockerfile +++ b/docker/x86_64/manylinux2014/Dockerfile @@ -14,11 +14,11 @@ FROM quay.io/pypa/manylinux2014_x86_64:2024-07-15-c746fd8 -COPY ./oneAPI.repo /etc/yum.repos.d/oneAPI.repo - -# Update CA certificates so Intel's oneAPI repo TLS cert is trusted +# Update CA certificates before adding oneAPI repo (its TLS cert needs newer CAs) RUN yum update -y ca-certificates nss && update-ca-trust +COPY ./oneAPI.repo /etc/yum.repos.d/oneAPI.repo + # Install gcc-11 RUN yum --disablerepo=epel install -y \ devtoolset-11-gcc \ From c626865c24e4d5672daf62f4316da9bbdd4e486e Mon Sep 17 00:00:00 2001 From: yuejiaointel Date: Mon, 6 Apr 2026 13:16:29 -0700 Subject: [PATCH 8/9] fix Docker build: disable TLS verify for Intel oneAPI repo CentOS 7 CA certificates are too old to trust Intel's current TLS cert. Add sslverify=0 to oneAPI.repo (packages are still GPG-verified). Remove the ineffective ca-certificates update step. --- docker/x86_64/manylinux2014/Dockerfile | 3 --- docker/x86_64/manylinux2014/oneAPI.repo | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/docker/x86_64/manylinux2014/Dockerfile b/docker/x86_64/manylinux2014/Dockerfile index 99949faa3..1935f6aef 100644 --- a/docker/x86_64/manylinux2014/Dockerfile +++ b/docker/x86_64/manylinux2014/Dockerfile @@ -14,9 +14,6 @@ FROM quay.io/pypa/manylinux2014_x86_64:2024-07-15-c746fd8 -# Update CA certificates before adding oneAPI repo (its TLS cert needs newer CAs) -RUN yum update -y ca-certificates nss && update-ca-trust - COPY ./oneAPI.repo /etc/yum.repos.d/oneAPI.repo # Install gcc-11 diff --git a/docker/x86_64/manylinux2014/oneAPI.repo b/docker/x86_64/manylinux2014/oneAPI.repo index ba35b673e..ccf387ba8 100644 --- a/docker/x86_64/manylinux2014/oneAPI.repo +++ b/docker/x86_64/manylinux2014/oneAPI.repo @@ -5,3 +5,4 @@ enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB +sslverify=0 From 3994881748c33d950acb49752ca504a0d81864d4 Mon Sep 17 00:00:00 2001 From: yuejiaointel Date: Mon, 6 Apr 2026 13:17:34 -0700 Subject: [PATCH 9/9] apply clang-format to adaptive batch size code --- bindings/cpp/src/dynamic_vamana_index_impl.h | 5 ++--- bindings/cpp/src/svs_runtime_utils.h | 5 ++--- bindings/cpp/src/vamana_index_impl.h | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/bindings/cpp/src/dynamic_vamana_index_impl.h b/bindings/cpp/src/dynamic_vamana_index_impl.h index f74978591..b27958703 100644 --- a/bindings/cpp/src/dynamic_vamana_index_impl.h +++ b/bindings/cpp/src/dynamic_vamana_index_impl.h @@ -133,9 +133,8 @@ class DynamicVamanaIndexImpl { do { // Estimate how many candidates we need to find remaining // results given the observed hit rate so far. - batch_size = predict_further_processing( - total_checked, found, k, batch_size - ); + batch_size = + predict_further_processing(total_checked, found, k, batch_size); // Cap to avoid oversized batches in the iterator. batch_size = std::min(batch_size, max_batch_size); iterator.next(batch_size); diff --git a/bindings/cpp/src/svs_runtime_utils.h b/bindings/cpp/src/svs_runtime_utils.h index b5fd12756..6caa1a325 100644 --- a/bindings/cpp/src/svs_runtime_utils.h +++ b/bindings/cpp/src/svs_runtime_utils.h @@ -435,9 +435,8 @@ auto dispatch_storage_kind(StorageKind kind, F&& f, Args&&... args) { // based on the observed hit rate so far. // If no hits yet, returns `hint` unchanged. // The caller should cap the result to a max batch size if needed. -inline size_t predict_further_processing( - size_t processed, size_t hits, size_t goal, size_t hint -) { +inline size_t +predict_further_processing(size_t processed, size_t hits, size_t goal, size_t hint) { if (hits == 0 || hits >= goal) { return hint; } diff --git a/bindings/cpp/src/vamana_index_impl.h b/bindings/cpp/src/vamana_index_impl.h index 65cee325f..2fd1f1452 100644 --- a/bindings/cpp/src/vamana_index_impl.h +++ b/bindings/cpp/src/vamana_index_impl.h @@ -139,9 +139,8 @@ class VamanaIndexImpl { do { // Estimate how many candidates we need to find remaining // results given the observed hit rate so far. - batch_size = predict_further_processing( - total_checked, found, k, batch_size - ); + batch_size = + predict_further_processing(total_checked, found, k, batch_size); // Cap to avoid oversized batches in the iterator. batch_size = std::min(batch_size, max_batch_size); iterator.next(batch_size);