aboutsummaryrefslogtreecommitdiffstats
path: root/ann_benchmark
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2023-05-31 14:22:50 +0200
committerTor Egge <Tor.Egge@online.no>2023-05-31 14:22:50 +0200
commit690891b6b48124fe05bca22872f923a34ecb5591 (patch)
tree2253717beb44a0cb5b7077cae60f76d9da17410a /ann_benchmark
parent45881ba514a564da1891f804a88fe066262884b6 (diff)
Add Doom to hnsw index.
Diffstat (limited to 'ann_benchmark')
-rw-r--r--ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp b/ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp
index a52e0850b7d..730ee141f83 100644
--- a/ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp
+++ b/ann_benchmark/src/vespa/ann_benchmark/vespa_ann_benchmark.cpp
@@ -10,6 +10,7 @@
#include <vespa/searchcommon/attribute/config.h>
#include <vespa/eval/eval/value.h>
#include <vespa/vespalib/test/insertion_operators.h>
+#include <vespa/vespalib/util/fake_doom.h>
#include <iostream>
#include <sstream>
#include <limits>
@@ -67,6 +68,7 @@ class HnswIndex
const NearestNeighborIndex* _nearest_neighbor_index;
size_t _dim_size;
bool _normalize_vectors;
+ vespalib::FakeDoom _no_doom;
bool check_lid(uint32_t lid);
bool check_value(const char *op, const std::vector<float>& value);
@@ -87,7 +89,8 @@ HnswIndex::HnswIndex(uint32_t dim_size, const HnswIndexParams &hnsw_index_params
_tensor_attribute(nullptr),
_nearest_neighbor_index(nullptr),
_dim_size(0u),
- _normalize_vectors(normalize_vectors)
+ _normalize_vectors(normalize_vectors),
+ _no_doom()
{
Config cfg(BasicType::TENSOR, CollectionType::SINGLE);
_tensor_type = ValueType::from_spec(make_tensor_spec(dim_size));
@@ -208,7 +211,7 @@ HnswIndex::find_top_k(uint32_t k, const std::vector<float>& value, uint32_t expl
std::vector<float> normalized_value;
auto typed_cells = get_typed_cells(value, normalized_value);
auto df = _nearest_neighbor_index->distance_function_factory().for_query_vector(typed_cells);
- auto raw_result = _nearest_neighbor_index->find_top_k(k, *df, explore_k, std::numeric_limits<double>::max());
+ auto raw_result = _nearest_neighbor_index->find_top_k(k, *df, explore_k, _no_doom.get_doom(), std::numeric_limits<double>::max());
result.reserve(raw_result.size());
switch (_hnsw_index_params.distance_metric()) {
case DistanceMetric::Euclidean: