Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
0b8f7e8
Initial version of SQDataset
ahuber21 Mar 20, 2025
9314910
more dynamic max error calculation
ahuber21 Mar 21, 2025
254cceb
clean up tests
ahuber21 Mar 24, 2025
d464e23
refactor to a single scalar.h
ahuber21 Mar 25, 2025
5a45645
revert some changes
ahuber21 Mar 25, 2025
01b3d80
remove _impl file
ahuber21 Mar 26, 2025
a386aaa
Add compressed distances
ahuber21 Mar 26, 2025
083a9b8
add compressed distances
ahuber21 Mar 26, 2025
ba8e71e
refactor: move some helpers to detail namespace
ahuber21 Mar 27, 2025
247e8d2
adding more to compressed distance metrics
ahuber21 Mar 27, 2025
1ba7c2e
template compression data type
ahuber21 Mar 27, 2025
be95013
Use linear transformation s*v+b for compression
ahuber21 Mar 28, 2025
f2e8f0d
Revert "Use linear transformation s*v+b for compression"
ahuber21 Mar 28, 2025
3c1811e
Compute everything in float
ahuber21 Mar 28, 2025
21bae3c
refactor directories and concepts
ahuber21 Mar 28, 2025
9051128
fix compressed distance calculations
ahuber21 Mar 28, 2025
e8b9284
Update examples/cpp/vamana.cpp
ahuber21 Mar 28, 2025
1ea1894
make dataset resizeable
ahuber21 Apr 17, 2025
13062e1
add first distance computation checks
ahuber21 Apr 17, 2025
e6916d4
evaluate IP with SQDataset
ahuber21 Apr 17, 2025
20c6f9f
unit test for all distances with updated reference calculations
ahuber21 Apr 17, 2025
13f20f8
fix argument for reference distance
ahuber21 Apr 22, 2025
d0cec00
dedicated test for compressed queries
ahuber21 Apr 23, 2025
d7e4e55
add first set of vamana search integration tests
ahuber21 Apr 23, 2025
283cfa1
add first set of vamana search integration tests
ahuber21 Apr 23, 2025
6233152
fix reload test
ahuber21 Apr 24, 2025
b6df7f8
passing scalar build tests
ahuber21 Apr 24, 2025
440aa0c
update license
ahuber21 Apr 24, 2025
097e794
add other distances
ahuber21 Apr 24, 2025
952b49b
fix groundtruths
ahuber21 Apr 24, 2025
1c4c940
use load_groundtruth utility function
ahuber21 Apr 24, 2025
3853fe5
clean up some comments
ahuber21 Apr 25, 2025
d716062
add index iterator tests
ahuber21 Apr 25, 2025
d18182c
set_datum: recalculate scale and bias if necessary
ahuber21 Apr 25, 2025
a73438e
update eve
Apr 29, 2025
50bbd54
fix includes
Apr 29, 2025
a6cb37a
modify cmake
Apr 29, 2025
c81730d
fix
Apr 29, 2025
7dd17fa
moove arm hint block
Apr 29, 2025
546f5c2
update eve cmake
Apr 29, 2025
adbedb1
define EVE_SUPPORTS_NEON
Apr 29, 2025
59d97f7
more updates for eve
Apr 29, 2025
af40c9c
clean-up
Apr 29, 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
2 changes: 1 addition & 1 deletion cmake/eve.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Include(FetchContent)
FetchContent_Declare(
eve
GIT_REPOSITORY https://github.com/jfalcou/eve
GIT_TAG v2022.09.1
GIT_TAG 1666dae546371ea11c84ffc197e98a372afaa988
)

set(EVE_BUILD_TEST OFF)
Expand Down
36 changes: 34 additions & 2 deletions examples/cpp/vamana.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@

//! [Includes]
// SVS Dependencies
#include "svs/orchestrators/vamana.h" // bulk of the dependencies required.
#include "svs/core/recall.h" // Convenient k-recall@n computation.
#include "svs/orchestrators/vamana.h" // bulk of the dependencies required.
#include "svs/core/recall.h" // Convenient k-recall@n computation.
#include "svs/extensions/vamana/scalar.h" // SQ vamana extensions.
#include "svs/quantization/scalar/scalar.h" // SQ implementation.

// Alternative main definition
#include "svsmain.h"
Expand Down Expand Up @@ -156,6 +158,36 @@ int svs_main(std::vector<std::string> args) {
index.set_threadpool(svs::threads::DefaultThreadPool(4));
//! [Set a new thread pool with n-threads]

//! [Compressed Loader]
// Quantization
namespace scalar = svs::quantization::scalar;

// Wrap the compressor object in a lazy functor.
// This will defer loading and compression of the SQ dataset until the threadpool
// used in the index has been created.
auto compressor = svs::lib::Lazy([=](svs::threads::ThreadPool auto& threadpool) {
auto data = svs::VectorDataLoader<float, 128>("example_data").load();
return scalar::SQDataset<std::int8_t, 128>::compress(data, threadpool);
});
index = svs::Vamana::assemble<float>(
"example_config",
svs::GraphLoader("example_graph"),
compressor,
svs::DistanceType::L2,
4
);
recall = run_recall(index, queries, groundtruth, 30, 10, "Compressed load");
check(0.8215, recall);
//! [Compressed Loader]

//! [Build Index Compressed]
// Compressed building
index =
svs::Vamana::build<float>(parameters, compressor, svs::DistanceL2(), num_threads);
recall = run_recall(index, queries, groundtruth, 30, 10, "Compressed Build");
check(0.8212, recall);
//! [Build Index Compressed]

return 0;
}

Expand Down
41 changes: 41 additions & 0 deletions include/svs/extensions/vamana/scalar.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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.
*/

#include "svs/index/vamana/extensions.h"
#include "svs/quantization/scalar/scalar.h"

namespace svs::quantization::scalar {

template <IsSQData Data>
SVS_FORCE_INLINE data::GetDatumAccessor svs_invoke(
svs::tag_t<svs::index::vamana::extensions::reconstruct_accessor> SVS_UNUSED(cpo),
const Data& SVS_UNUSED(data)
) {
return data::GetDatumAccessor();
}

template <IsSQData Data, typename Distance>
auto svs_invoke(
svs::tag_t<svs::index::vamana::extensions::single_search_setup>,
const Data& data,
const Distance& SVS_UNUSED(distance)
) {
return compressed_distance_t<Distance, typename Data::element_type>(
data.get_scale(), data.get_bias(), data.dimensions()
);
}

} // namespace svs::quantization::scalar
Loading
Loading