Skip to content

Commit bd0cd24

Browse files
committed
Post-rebase fix
1 parent 90f4c7f commit bd0cd24

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

src/VecSim/algorithms/svs/svs.h

-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ class SVSIndex : public VecSimIndexAbstract<svs_details::vecsim_dt<DataType>, fl
166166

167167
int addVectorsImpl(const void *vectors_data, const labelType *labels, size_t n) {
168168
if (n == 0) {
169-
assert(false && "Empty batch of vectors"); // This case to be enabled for TieredSVS
170169
return 0;
171170
}
172171

src/VecSim/algorithms/svs/svs_tiered.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,11 @@ class TieredSVSIndex : public VecSimTieredIndex<DataType, float> {
428428
assert(index);
429429
// prevent parallel updates
430430
std::lock_guard<std::mutex> lock(index->updateJobMutex);
431+
// Release the scheduled flag to allow scheduling again
432+
index->indexUpdateScheduled.clear();
433+
// Update the SVS index
431434
index->GetSVSIndex()->setNumThreads(availableThreads);
432435
index->updateSVSIndex();
433-
index->indexUpdateScheduled.clear();
434436
}
435437

436438
#ifdef BUILD_TESTS

tests/unit/test_svs_tiered.cpp

+11-5
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ struct SVSIndexType {
7373

7474
// clang-format off
7575
using SVSDataTypeSet = ::testing::Types<SVSIndexType<VecSimType_FLOAT32, float, VecSimSvsQuant_NONE>
76-
// ,SVSIndexType<VecSimType_FLOAT32, float, VecSimSvsQuant_8>
76+
#if HAVE_SVS_LVQ
77+
,SVSIndexType<VecSimType_FLOAT32, float, VecSimSvsQuant_8>
78+
#endif
7779
>;
7880
// clang-format on
7981

@@ -139,7 +141,7 @@ TYPED_TEST(SVSTieredIndexTest, ThreadsReservation) {
139141
// The number of reserved threads should be equal to requested
140142
ASSERT_EQ(num_reserved_threads, num_threads - 2);
141143

142-
// Request and more threads than available
144+
// Request more threads than available
143145
jobs = SVSMultiThreadJob::createJobs(allocator, HNSW_INSERT_VECTOR_JOB, update_job_mock,
144146
tiered_index, num_threads + 2, timeout);
145147
tiered_index->submitJobs(jobs);
@@ -214,7 +216,7 @@ TYPED_TEST(SVSTieredIndexTest, addVector) {
214216
ASSERT_EQ(tiered_index->GetFlatIndex()->indexSize(), 1);
215217
ASSERT_EQ(tiered_index->GetBackendIndex()->indexSize(), 0);
216218
ASSERT_EQ(tiered_index->GetFlatIndex()->indexCapacity(), DEFAULT_BLOCK_SIZE);
217-
ASSERT_EQ(tiered_index->indexCapacity(), DEFAULT_BLOCK_SIZE + 1);
219+
ASSERT_EQ(tiered_index->indexCapacity(), DEFAULT_BLOCK_SIZE);
218220
ASSERT_EQ(tiered_index->GetFlatIndex()->getDistanceFrom_Unsafe(vec_label, vector), 0);
219221
ASSERT_EQ(mock_thread_pool.jobQ.size(), mock_thread_pool.thread_pool_size);
220222
// Validate that the job was created properly
@@ -264,7 +266,10 @@ TYPED_TEST(SVSTieredIndexTest, insertJob) {
264266
ASSERT_EQ(tiered_index->GetBackendIndex()->indexSize(), 1);
265267
// SVS index should have allocated a single record, while flat index should remove the
266268
// block.
267-
ASSERT_EQ(tiered_index->indexCapacity(), DEFAULT_BLOCK_SIZE);
269+
// LVQDataset does not provide a capacity method
270+
const size_t expected_capacity =
271+
TypeParam::get_quant_bits() > 0 ? tiered_index->indexSize() : DEFAULT_BLOCK_SIZE;
272+
ASSERT_EQ(tiered_index->indexCapacity(), expected_capacity);
268273
ASSERT_EQ(tiered_index->GetFlatIndex()->indexCapacity(), 0);
269274
ASSERT_EQ(tiered_index->getDistanceFrom_Unsafe(vec_label, vector), 0);
270275
}
@@ -287,7 +292,7 @@ TYPED_TEST(SVSTieredIndexTest, insertJobAsync) {
287292
GenerateAndAddVector<TEST_DATA_T>(tiered_index, dim, i, i);
288293
}
289294

290-
mock_thread_pool.thread_pool_join();
295+
mock_thread_pool.thread_pool_wait();
291296
ASSERT_EQ(tiered_index->indexSize(), n);
292297
ASSERT_EQ(mock_thread_pool.jobQ.size(), 0);
293298
auto sz_f = tiered_index->GetFlatIndex()->indexSize();
@@ -302,6 +307,7 @@ TYPED_TEST(SVSTieredIndexTest, insertJobAsync) {
302307
<< "Vector label: " << i;
303308
}
304309

310+
mock_thread_pool.thread_pool_join();
305311
// Verify that all vectors were moved to SVS as expected
306312
sz_f = tiered_index->GetFlatIndex()->indexSize();
307313
sz_b = tiered_index->GetBackendIndex()->indexSize();

0 commit comments

Comments
 (0)