summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2022-10-25 11:45:33 +0200
committerTor Egge <Tor.Egge@online.no>2022-10-25 11:45:33 +0200
commita40e7f5b40c337c2911e3f0c82116841f5405847 (patch)
treef9b6989679ff591e35845611cf1f42e197d18e64 /searchlib
parent70026cc89de5a1586f7b70e261d0f09c437a2263 (diff)
Remove ReusableSetPool.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/tensor/CMakeLists.txt1
-rw-r--r--searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp13
-rw-r--r--searchlib/src/vespa/searchlib/tensor/hnsw_index.h3
-rw-r--r--searchlib/src/vespa/searchlib/tensor/reusable_set_visited_tracker.cpp15
-rw-r--r--searchlib/src/vespa/searchlib/tensor/reusable_set_visited_tracker.h31
5 files changed, 0 insertions, 63 deletions
diff --git a/searchlib/src/vespa/searchlib/tensor/CMakeLists.txt b/searchlib/src/vespa/searchlib/tensor/CMakeLists.txt
index 0d87881711c..d1b88a7e2ab 100644
--- a/searchlib/src/vespa/searchlib/tensor/CMakeLists.txt
+++ b/searchlib/src/vespa/searchlib/tensor/CMakeLists.txt
@@ -35,6 +35,5 @@ vespa_add_library(searchlib_tensor OBJECT
tensor_deserialize.cpp
tensor_store.cpp
tensor_store_saver.cpp
- reusable_set_visited_tracker.cpp
DEPENDS
)
diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
index 10f06a1e1ec..a10ff1c48dc 100644
--- a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
@@ -23,8 +23,6 @@
LOG_SETUP(".searchlib.tensor.hnsw_index");
-#define USE_OLD_VISITED_TRACKER 0
-
namespace search::tensor {
using search::AddressSpaceComponents;
@@ -319,15 +317,11 @@ HnswIndex::search_layer(const TypedCells& input, uint32_t neighbors_to_find,
doc_id_limit = std::min(filter->size(), doc_id_limit);
}
uint32_t estimated_visited_nodes = estimate_visited_nodes(level, doc_id_limit, neighbors_to_find, filter);
-#if ! USE_OLD_VISITED_TRACKER
if (estimated_visited_nodes >= doc_id_limit / 128) {
search_layer_helper<BitVectorVisitedTracker>(input, neighbors_to_find, best_neighbors, level, filter, doc_id_limit, estimated_visited_nodes);
} else {
search_layer_helper<HashSetVisitedTracker>(input, neighbors_to_find, best_neighbors, level, filter, doc_id_limit, estimated_visited_nodes);
}
-#else
- search_layer_helper<ReusableSetVisitedTracker>(input, neighbors_to_find, best_neighbors, level, filter, doc_id_limit, estimated_visited_nodes);
-#endif
}
HnswIndex::HnswIndex(const DocVectorAccess& vectors, DistanceFunction::UP distance_func,
@@ -337,7 +331,6 @@ HnswIndex::HnswIndex(const DocVectorAccess& vectors, DistanceFunction::UP distan
_distance_func(std::move(distance_func)),
_level_generator(std::move(level_generator)),
_cfg(cfg),
- _visited_set_pool(),
_compaction_spec()
{
assert(_distance_func);
@@ -597,7 +590,6 @@ HnswIndex::update_stat(const CompactionStrategy& compaction_strategy)
_compaction_spec = HnswIndexCompactionSpec(compaction_strategy.should_compact(level_arrays_memory_usage, level_arrays_address_space_usage),
compaction_strategy.should_compact(link_arrays_memory_usage, link_arrays_address_space_usage));
result.merge(link_arrays_memory_usage);
- result.merge(_visited_set_pool.memory_usage());
return result;
}
@@ -608,7 +600,6 @@ HnswIndex::memory_usage() const
result.merge(_graph.node_refs.getMemoryUsage());
result.merge(_graph.nodes.getMemoryUsage());
result.merge(_graph.links.getMemoryUsage());
- result.merge(_visited_set_pool.memory_usage());
return result;
}
@@ -628,10 +619,6 @@ HnswIndex::get_state(const vespalib::slime::Inserter& inserter) const
StateExplorerUtils::memory_usage_to_slime(_graph.node_refs.getMemoryUsage(), memUsageObj.setObject("node_refs"));
StateExplorerUtils::memory_usage_to_slime(_graph.nodes.getMemoryUsage(), memUsageObj.setObject("nodes"));
StateExplorerUtils::memory_usage_to_slime(_graph.links.getMemoryUsage(), memUsageObj.setObject("links"));
- StateExplorerUtils::memory_usage_to_slime(_visited_set_pool.memory_usage(), memUsageObj.setObject("visited_set_pool"));
- auto& visitedObj = object.setObject("visited_set");
- visitedObj.setLong("create_count", _visited_set_pool.create_count());
- visitedObj.setLong("reuse_count", _visited_set_pool.reuse_count());
object.setLong("nodes", _graph.size());
auto& histogram_array = object.setArray("level_histogram");
auto& links_hst_array = object.setArray("level_0_links_histogram");
diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index.h b/searchlib/src/vespa/searchlib/tensor/hnsw_index.h
index 8a7422907ea..43e3001b496 100644
--- a/searchlib/src/vespa/searchlib/tensor/hnsw_index.h
+++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index.h
@@ -15,7 +15,6 @@
#include <vespa/vespalib/datastore/atomic_entry_ref.h>
#include <vespa/vespalib/datastore/compaction_spec.h>
#include <vespa/vespalib/datastore/entryref.h>
-#include <vespa/vespalib/util/reusable_set_pool.h>
#include <vespa/vespalib/stllike/allocator.h>
namespace search::tensor {
@@ -98,7 +97,6 @@ protected:
DistanceFunction::UP _distance_func;
RandomLevelGenerator::UP _level_generator;
Config _cfg;
- mutable vespalib::ReusableSetPool _visited_set_pool;
HnswIndexCompactionSpec _compaction_spec;
uint32_t max_links_for_level(uint32_t level) const;
@@ -221,7 +219,6 @@ public:
bool check_link_symmetry() const;
std::pair<uint32_t, bool> count_reachable_nodes() const;
HnswGraph& get_graph() { return _graph; }
- vespalib::ReusableSetPool& get_visited_set_pool() const noexcept { return _visited_set_pool; }
static vespalib::datastore::ArrayStoreConfig make_default_node_store_config();
static vespalib::datastore::ArrayStoreConfig make_default_link_store_config();
diff --git a/searchlib/src/vespa/searchlib/tensor/reusable_set_visited_tracker.cpp b/searchlib/src/vespa/searchlib/tensor/reusable_set_visited_tracker.cpp
deleted file mode 100644
index d3cdd28fea3..00000000000
--- a/searchlib/src/vespa/searchlib/tensor/reusable_set_visited_tracker.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include "reusable_set_visited_tracker.h"
-#include "hnsw_index.h"
-
-namespace search::tensor {
-
-ReusableSetVisitedTracker::ReusableSetVisitedTracker(const HnswIndex& index, uint32_t doc_id_limit, uint32_t)
- : _visited(index.get_visited_set_pool().get(doc_id_limit))
-{
-}
-
-ReusableSetVisitedTracker::~ReusableSetVisitedTracker() = default;
-
-}
diff --git a/searchlib/src/vespa/searchlib/tensor/reusable_set_visited_tracker.h b/searchlib/src/vespa/searchlib/tensor/reusable_set_visited_tracker.h
deleted file mode 100644
index 9528cfe78f9..00000000000
--- a/searchlib/src/vespa/searchlib/tensor/reusable_set_visited_tracker.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#pragma once
-
-#include <vespa/vespalib/util/reusable_set_handle.h>
-
-namespace search::tensor {
-
-class HnswIndex;
-
-/*
- * Tracker for visited nodes based on vespalib::ReusableSet.
- */
-class ReusableSetVisitedTracker
-{
- vespalib::ReusableSetHandle _visited;
-public:
- ReusableSetVisitedTracker(const HnswIndex& index, uint32_t doc_id_limit, uint32_t);
- ~ReusableSetVisitedTracker();
- void mark(uint32_t doc_id) { _visited.mark(doc_id); }
- bool try_mark(uint32_t doc_id) {
- if (_visited.is_marked(doc_id)) {
- return false;
- } else {
- _visited.mark(doc_id);
- return true;
- }
- }
-};
-
-}