summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eval/src/tests/eval/simple_value/simple_value_test.cpp14
-rw-r--r--eval/src/tests/tensor/default_value_builder_factory/default_value_builder_factory_test.cpp11
-rw-r--r--eval/src/tests/tensor/direct_sparse_tensor_builder/direct_sparse_tensor_builder_test.cpp2
-rw-r--r--eval/src/tests/tensor/onnx_wrapper/onnx_wrapper_test.cpp12
-rw-r--r--eval/src/tests/tensor/packed_mappings/packed_mixed_test.cpp53
-rw-r--r--eval/src/vespa/eval/eval/CMakeLists.txt1
-rw-r--r--eval/src/vespa/eval/eval/double_value_builder.h2
-rw-r--r--eval/src/vespa/eval/eval/simple_value.cpp8
-rw-r--r--eval/src/vespa/eval/eval/simple_value.h6
-rw-r--r--eval/src/vespa/eval/eval/typed_cells.cpp (renamed from eval/src/vespa/eval/tensor/dense/typed_cells.cpp)4
-rw-r--r--eval/src/vespa/eval/eval/typed_cells.h (renamed from eval/src/vespa/eval/tensor/dense/typed_cells.h)37
-rw-r--r--eval/src/vespa/eval/eval/value.cpp4
-rw-r--r--eval/src/vespa/eval/eval/value.h9
-rw-r--r--eval/src/vespa/eval/instruction/generic_join.cpp1
-rw-r--r--eval/src/vespa/eval/tensor/dense/CMakeLists.txt2
-rw-r--r--eval/src/vespa/eval/tensor/dense/dense_tensor_cells_iterator.h4
-rw-r--r--eval/src/vespa/eval/tensor/dense/dense_tensor_value_builder.h2
-rw-r--r--eval/src/vespa/eval/tensor/dense/dense_tensor_view.cpp2
-rw-r--r--eval/src/vespa/eval/tensor/dense/dense_tensor_view.h2
-rw-r--r--eval/src/vespa/eval/tensor/dense/typed_cells_dispatch.cpp3
-rw-r--r--eval/src/vespa/eval/tensor/dense/typed_cells_dispatch.h40
-rw-r--r--eval/src/vespa/eval/tensor/mixed/packed_mappings_builder.cpp9
-rw-r--r--eval/src/vespa/eval/tensor/mixed/packed_mappings_builder.h5
-rw-r--r--eval/src/vespa/eval/tensor/mixed/packed_mixed_tensor.cpp24
-rw-r--r--eval/src/vespa/eval/tensor/mixed/packed_mixed_tensor_builder.cpp3
-rw-r--r--eval/src/vespa/eval/tensor/mixed/packed_mixed_tensor_builder.h2
-rw-r--r--eval/src/vespa/eval/tensor/sparse/sparse_tensor_index.cpp24
-rw-r--r--eval/src/vespa/eval/tensor/sparse/sparse_tensor_t.cpp12
-rw-r--r--eval/src/vespa/eval/tensor/sparse/sparse_tensor_t.h2
-rw-r--r--eval/src/vespa/eval/tensor/sparse/sparse_tensor_value_builder.cpp2
-rw-r--r--eval/src/vespa/eval/tensor/sparse/sparse_tensor_value_builder.h2
-rw-r--r--eval/src/vespa/eval/tensor/wrapped_simple_tensor.h2
-rw-r--r--searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp6
-rw-r--r--searchlib/src/tests/tensor/distance_functions/distance_functions_test.cpp4
-rw-r--r--searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp5
-rw-r--r--searchlib/src/tests/tensor/hnsw_index/stress_hnsw_mt.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_iterator.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.h2
-rw-r--r--searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp12
-rw-r--r--searchlib/src/vespa/searchlib/tensor/dense_tensor_store.h4
-rw-r--r--searchlib/src/vespa/searchlib/tensor/distance_function.h8
-rw-r--r--searchlib/src/vespa/searchlib/tensor/distance_functions.h32
-rw-r--r--searchlib/src/vespa/searchlib/tensor/doc_vector_access.h4
-rw-r--r--searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/tensor/hnsw_index.h4
-rw-r--r--searchlib/src/vespa/searchlib/tensor/nearest_neighbor_index.h7
47 files changed, 212 insertions, 195 deletions
diff --git a/eval/src/tests/eval/simple_value/simple_value_test.cpp b/eval/src/tests/eval/simple_value/simple_value_test.cpp
index 4827fa3be3c..e989b567e20 100644
--- a/eval/src/tests/eval/simple_value/simple_value_test.cpp
+++ b/eval/src/tests/eval/simple_value/simple_value_test.cpp
@@ -15,6 +15,9 @@ using namespace vespalib::eval::test;
using vespalib::make_string_short::fmt;
+using PA = std::vector<vespalib::stringref *>;
+using CPA = std::vector<const vespalib::stringref *>;
+
std::vector<Layout> layouts = {
{},
{x(3)},
@@ -91,7 +94,8 @@ TEST(SimpleValueTest, simple_value_can_be_built_and_inspected) {
float seq = 0.0;
for (vespalib::string x: {"a", "b", "c"}) {
for (vespalib::string y: {"aa", "bb"}) {
- auto subspace = builder->add_subspace({x, y});
+ std::vector<vespalib::stringref> addr = {x, y};
+ auto subspace = builder->add_subspace(addr);
EXPECT_EQ(subspace.size(), 2);
subspace[0] = seq + 1.0;
subspace[1] = seq + 5.0;
@@ -105,14 +109,14 @@ TEST(SimpleValueTest, simple_value_can_be_built_and_inspected) {
vespalib::stringref query = "b";
vespalib::stringref label;
size_t subspace;
- view->lookup({&query});
- EXPECT_TRUE(view->next_result({&label}, subspace));
+ view->lookup(CPA{&query});
+ EXPECT_TRUE(view->next_result(PA{&label}, subspace));
EXPECT_EQ(label, "aa");
EXPECT_EQ(subspace, 2);
- EXPECT_TRUE(view->next_result({&label}, subspace));
+ EXPECT_TRUE(view->next_result(PA{&label}, subspace));
EXPECT_EQ(label, "bb");
EXPECT_EQ(subspace, 3);
- EXPECT_FALSE(view->next_result({&label}, subspace));
+ EXPECT_FALSE(view->next_result(PA{&label}, subspace));
}
TEST(SimpleValueTest, new_generic_join_works_for_simple_values) {
diff --git a/eval/src/tests/tensor/default_value_builder_factory/default_value_builder_factory_test.cpp b/eval/src/tests/tensor/default_value_builder_factory/default_value_builder_factory_test.cpp
index 28f8fcc7eb8..bd18f3a2341 100644
--- a/eval/src/tests/tensor/default_value_builder_factory/default_value_builder_factory_test.cpp
+++ b/eval/src/tests/tensor/default_value_builder_factory/default_value_builder_factory_test.cpp
@@ -18,6 +18,9 @@ Value::UP v_of(const TensorSpec &spec) {
return value_from_spec(spec, DefaultValueBuilderFactory::get());
}
+using PA = std::vector<vespalib::stringref *>;
+using CPA = std::vector<const vespalib::stringref *>;
+
TEST(DefaultValueBuilderFactoryTest, all_built_value_types_are_correct) {
auto dbl = v_of(TensorSpec("double").add({}, 3.0));
auto trivial = v_of(TensorSpec("tensor(x[1])").add({{"x",0}}, 7.0));
@@ -40,19 +43,19 @@ TEST(DefaultValueBuilderFactoryTest, all_built_value_types_are_correct) {
stringref y_look = "bar";
stringref x_res = "xxx";
auto view = sparse->index().create_view({1});
- view->lookup({&y_look});
+ view->lookup(CPA{&y_look});
size_t ss = 12345;
- bool br = view->next_result({&x_res}, ss);
+ bool br = view->next_result(PA{&x_res}, ss);
EXPECT_TRUE(br);
EXPECT_EQ(ss, 0);
EXPECT_EQ(x_res, "foo");
- br = view->next_result({&x_res}, ss);
+ br = view->next_result(PA{&x_res}, ss);
EXPECT_FALSE(br);
ss = 12345;
view = mixed->index().create_view({});
view->lookup({});
- br = view->next_result({&x_res}, ss);
+ br = view->next_result(PA{&x_res}, ss);
EXPECT_TRUE(br);
EXPECT_EQ(ss, 0);
EXPECT_EQ(x_res, "quux");
diff --git a/eval/src/tests/tensor/direct_sparse_tensor_builder/direct_sparse_tensor_builder_test.cpp b/eval/src/tests/tensor/direct_sparse_tensor_builder/direct_sparse_tensor_builder_test.cpp
index a0883ccfa4b..d9d4c221164 100644
--- a/eval/src/tests/tensor/direct_sparse_tensor_builder/direct_sparse_tensor_builder_test.cpp
+++ b/eval/src/tests/tensor/direct_sparse_tensor_builder/direct_sparse_tensor_builder_test.cpp
@@ -36,7 +36,7 @@ assertCellValue(double expValue, const TensorAddress &address,
bool found = tensor.index().lookup_address(addressRef, idx);
EXPECT_TRUE(found);
auto cells = tensor.cells();
- if (EXPECT_TRUE(cells.type == CellType::DOUBLE)) {
+ if (EXPECT_TRUE(cells.type == ValueType::CellType::DOUBLE)) {
auto arr = cells.typify<double>();
EXPECT_EQUAL(expValue, arr[idx]);
}
diff --git a/eval/src/tests/tensor/onnx_wrapper/onnx_wrapper_test.cpp b/eval/src/tests/tensor/onnx_wrapper/onnx_wrapper_test.cpp
index c733f922194..d1d8bc796ba 100644
--- a/eval/src/tests/tensor/onnx_wrapper/onnx_wrapper_test.cpp
+++ b/eval/src/tests/tensor/onnx_wrapper/onnx_wrapper_test.cpp
@@ -165,13 +165,13 @@ TEST(OnnxTest, simple_onnx_model_can_be_evaluated)
auto cells = static_cast<const DenseTensorView&>(output).cellsRef();
EXPECT_EQ(cells.type, ValueType::CellType::FLOAT);
EXPECT_EQ(cells.size, 1);
- EXPECT_EQ(cells.get(0), 79.0);
+ EXPECT_EQ(GetCell::from(cells, 0), 79.0);
//-------------------------------------------------------------------------
std::vector<float> new_bias_values({10.0});
DenseTensorView new_bias(bias_type, TypedCells(new_bias_values));
ctx.bind_param(2, new_bias);
ctx.eval();
- EXPECT_EQ(static_cast<const DenseTensorView&>(output).cellsRef().get(0), 80.0);
+ EXPECT_EQ(GetCell::from(output.cells(), 0), 80.0);
//-------------------------------------------------------------------------
}
@@ -211,13 +211,13 @@ TEST(OnnxTest, dynamic_onnx_model_can_be_evaluated)
auto cells = static_cast<const DenseTensorView&>(output).cellsRef();
EXPECT_EQ(cells.type, ValueType::CellType::FLOAT);
EXPECT_EQ(cells.size, 1);
- EXPECT_EQ(cells.get(0), 79.0);
+ EXPECT_EQ(GetCell::from(cells, 0), 79.0);
//-------------------------------------------------------------------------
std::vector<float> new_bias_values({5.0,6.0});
DenseTensorView new_bias(bias_type, TypedCells(new_bias_values));
ctx.bind_param(2, new_bias);
ctx.eval();
- EXPECT_EQ(static_cast<const DenseTensorView&>(output).cellsRef().get(0), 81.0);
+ EXPECT_EQ(GetCell::from(output.cells(), 0), 81.0);
//-------------------------------------------------------------------------
}
@@ -257,13 +257,13 @@ TEST(OnnxTest, int_types_onnx_model_can_be_evaluated)
auto cells = static_cast<const DenseTensorView&>(output).cellsRef();
EXPECT_EQ(cells.type, ValueType::CellType::DOUBLE);
EXPECT_EQ(cells.size, 1);
- EXPECT_EQ(cells.get(0), 79.0);
+ EXPECT_EQ(GetCell::from(cells, 0), 79.0);
//-------------------------------------------------------------------------
std::vector<double> new_bias_values({10.0});
DenseTensorView new_bias(bias_type, TypedCells(new_bias_values));
ctx.bind_param(2, new_bias);
ctx.eval();
- EXPECT_EQ(static_cast<const DenseTensorView&>(output).cellsRef().get(0), 80.0);
+ EXPECT_EQ(GetCell::from(output.cells(), 0), 80.0);
//-------------------------------------------------------------------------
}
diff --git a/eval/src/tests/tensor/packed_mappings/packed_mixed_test.cpp b/eval/src/tests/tensor/packed_mappings/packed_mixed_test.cpp
index bc1efdaba1d..e8c57384335 100644
--- a/eval/src/tests/tensor/packed_mappings/packed_mixed_test.cpp
+++ b/eval/src/tests/tensor/packed_mappings/packed_mixed_test.cpp
@@ -9,6 +9,9 @@
using namespace vespalib::eval;
using namespace vespalib::eval::test;
+using PA = std::vector<vespalib::stringref *>;
+using CPA = std::vector<const vespalib::stringref *>;
+
std::vector<Layout> layouts = {
{},
{x(3)},
@@ -40,7 +43,8 @@ TEST(PackedMixedTest, packed_mixed_tensors_can_be_built_and_inspected) {
float seq = 0.0;
for (vespalib::string x: {"a", "b", "c"}) {
for (vespalib::string y: {"aa", "bb"}) {
- auto subspace = builder->add_subspace({x, y});
+ std::vector<vespalib::stringref> addr = {x, y};
+ auto subspace = builder->add_subspace(addr);
EXPECT_EQ(subspace.size(), 2);
subspace[0] = seq + 1.0;
subspace[1] = seq + 5.0;
@@ -54,64 +58,65 @@ TEST(PackedMixedTest, packed_mixed_tensors_can_be_built_and_inspected) {
vespalib::stringref query = "b";
vespalib::stringref label;
size_t subspace;
- view->lookup({&query});
- EXPECT_TRUE(view->next_result({&label}, subspace));
+ view->lookup(CPA{&query});
+ EXPECT_TRUE(view->next_result(PA{&label}, subspace));
EXPECT_EQ(label, "aa");
EXPECT_EQ(subspace, 2);
- EXPECT_TRUE(view->next_result({&label}, subspace));
+ EXPECT_TRUE(view->next_result(PA{&label}, subspace));
EXPECT_EQ(label, "bb");
EXPECT_EQ(subspace, 3);
- EXPECT_FALSE(view->next_result({&label}, subspace));
+ EXPECT_FALSE(view->next_result(PA{&label}, subspace));
query = "c";
- view->lookup({&query});
- EXPECT_TRUE(view->next_result({&label}, subspace));
+ view->lookup(CPA{&query});
+ EXPECT_TRUE(view->next_result(PA{&label}, subspace));
EXPECT_EQ(label, "aa");
EXPECT_EQ(subspace, 4);
- EXPECT_TRUE(view->next_result({&label}, subspace));
+ EXPECT_TRUE(view->next_result(PA{&label}, subspace));
EXPECT_EQ(label, "bb");
EXPECT_EQ(subspace, 5);
- EXPECT_FALSE(view->next_result({&label}, subspace));
+ EXPECT_FALSE(view->next_result(PA{&label}, subspace));
query = "notpresent";
- view->lookup({&query});
- EXPECT_FALSE(view->next_result({&label}, subspace));
+ view->lookup(CPA{&query});
+ EXPECT_FALSE(view->next_result(PA{&label}, subspace));
view = value->index().create_view({1});
query = "aa";
- view->lookup({&query});
- EXPECT_TRUE(view->next_result({&label}, subspace));
+ view->lookup(CPA{&query});
+ EXPECT_TRUE(view->next_result(PA{&label}, subspace));
EXPECT_EQ(label, "a");
EXPECT_EQ(subspace, 0);
- EXPECT_TRUE(view->next_result({&label}, subspace));
+ EXPECT_TRUE(view->next_result(PA{&label}, subspace));
EXPECT_EQ(label, "b");
EXPECT_EQ(subspace, 2);
- EXPECT_TRUE(view->next_result({&label}, subspace));
+ EXPECT_TRUE(view->next_result(PA{&label}, subspace));
EXPECT_EQ(label, "c");
EXPECT_EQ(subspace, 4);
- EXPECT_FALSE(view->next_result({&label}, subspace));
+ EXPECT_FALSE(view->next_result(PA{&label}, subspace));
query = "bb";
- view->lookup({&query});
- EXPECT_TRUE(view->next_result({&label}, subspace));
+ view->lookup(CPA{&query});
+ EXPECT_TRUE(view->next_result(PA{&label}, subspace));
EXPECT_EQ(label, "a");
EXPECT_EQ(subspace, 1);
- EXPECT_TRUE(view->next_result({&label}, subspace));
+ EXPECT_TRUE(view->next_result(PA{&label}, subspace));
EXPECT_EQ(label, "b");
EXPECT_EQ(subspace, 3);
- EXPECT_TRUE(view->next_result({&label}, subspace));
+ EXPECT_TRUE(view->next_result(PA{&label}, subspace));
EXPECT_EQ(label, "c");
EXPECT_EQ(subspace, 5);
- EXPECT_FALSE(view->next_result({&label}, subspace));
+ EXPECT_FALSE(view->next_result(PA{&label}, subspace));
query = "notpresent";
- view->lookup({&query});
- EXPECT_FALSE(view->next_result({&label}, subspace));
+ view->lookup(CPA{&query});
+ EXPECT_FALSE(view->next_result(PA{&label}, subspace));
view = value->index().create_view({0,1});
vespalib::stringref query_x = "b";
vespalib::stringref query_y = "bb";
- view->lookup({&query_x, &query_y});
+ CPA addr = {&query_x, &query_y};
+ view->lookup(addr);
EXPECT_TRUE(view->next_result({}, subspace));
EXPECT_EQ(subspace, 3);
EXPECT_FALSE(view->next_result({}, subspace));
diff --git a/eval/src/vespa/eval/eval/CMakeLists.txt b/eval/src/vespa/eval/eval/CMakeLists.txt
index d108c516e73..fa19f80c4af 100644
--- a/eval/src/vespa/eval/eval/CMakeLists.txt
+++ b/eval/src/vespa/eval/eval/CMakeLists.txt
@@ -28,6 +28,7 @@ vespa_add_library(eval_eval OBJECT
tensor_function.cpp
tensor_nodes.cpp
tensor_spec.cpp
+ typed_cells.cpp
value.cpp
value_codec.cpp
value_type.cpp
diff --git a/eval/src/vespa/eval/eval/double_value_builder.h b/eval/src/vespa/eval/eval/double_value_builder.h
index ba85d5838ad..4d5aa258b5f 100644
--- a/eval/src/vespa/eval/eval/double_value_builder.h
+++ b/eval/src/vespa/eval/eval/double_value_builder.h
@@ -17,7 +17,7 @@ public:
DoubleValueBuilder() : _value(0.0) {}
~DoubleValueBuilder() override;
ArrayRef<double>
- add_subspace(const std::vector<vespalib::stringref> &) override {
+ add_subspace(ConstArrayRef<vespalib::stringref>) override {
return ArrayRef<double>(&_value, 1);
}
std::unique_ptr<Value>
diff --git a/eval/src/vespa/eval/eval/simple_value.cpp b/eval/src/vespa/eval/eval/simple_value.cpp
index 1ccf6f8cd25..304244532d8 100644
--- a/eval/src/vespa/eval/eval/simple_value.cpp
+++ b/eval/src/vespa/eval/eval/simple_value.cpp
@@ -64,7 +64,7 @@ public:
assert((_match_dims.size() + _extract_dims.size()) == _num_mapped_dims);
}
- void lookup(const std::vector<const vespalib::stringref*> &addr) override {
+ void lookup(ConstArrayRef<const vespalib::stringref*> addr) override {
assert(addr.size() == _match_dims.size());
for (size_t i = 0; i < _match_dims.size(); ++i) {
_query[_match_dims[i]] = *addr[i];
@@ -76,7 +76,7 @@ public:
}
}
- bool next_result(const std::vector<vespalib::stringref*> &addr_out, size_t &idx_out) override {
+ bool next_result(ConstArrayRef<vespalib::stringref*> addr_out, size_t &idx_out) override {
assert(addr_out.size() == _extract_dims.size());
while (_pos != _index.end()) {
if (is_match()) {
@@ -102,7 +102,7 @@ public:
//-----------------------------------------------------------------------------
void
-SimpleValue::add_mapping(const std::vector<vespalib::stringref> &addr)
+SimpleValue::add_mapping(ConstArrayRef<vespalib::stringref> addr)
{
size_t id = _index.size();
std::vector<vespalib::string> my_addr;
@@ -145,7 +145,7 @@ SimpleValueT<T>::~SimpleValueT() = default;
template <typename T>
ArrayRef<T>
-SimpleValueT<T>::add_subspace(const std::vector<vespalib::stringref> &addr)
+SimpleValueT<T>::add_subspace(ConstArrayRef<vespalib::stringref> addr)
{
size_t old_size = _cells.size();
assert(old_size == (index().size() * subspace_size()));
diff --git a/eval/src/vespa/eval/eval/simple_value.h b/eval/src/vespa/eval/eval/simple_value.h
index af943b2904d..8fef9ea1dc8 100644
--- a/eval/src/vespa/eval/eval/simple_value.h
+++ b/eval/src/vespa/eval/eval/simple_value.h
@@ -13,8 +13,6 @@ namespace vespalib::eval {
class TensorSpec;
-using TypedCells = ::vespalib::tensor::TypedCells;
-
/**
* A simple implementation of a generic value that can also be used to
* build new values. This class focuses on simplicity over speed and
@@ -32,7 +30,7 @@ private:
std::map<Addr,size_t> _index;
protected:
size_t subspace_size() const { return _subspace_size; }
- void add_mapping(const std::vector<vespalib::stringref> &addr);
+ void add_mapping(ConstArrayRef<vespalib::stringref> addr);
public:
SimpleValue(const ValueType &type, size_t num_mapped_dims_in, size_t subspace_size_in);
~SimpleValue() override;
@@ -54,7 +52,7 @@ public:
SimpleValueT(const ValueType &type, size_t num_mapped_dims_in, size_t subspace_size_in);
~SimpleValueT() override;
TypedCells cells() const override { return TypedCells(ConstArrayRef<T>(_cells)); }
- ArrayRef<T> add_subspace(const std::vector<vespalib::stringref> &addr) override;
+ ArrayRef<T> add_subspace(ConstArrayRef<vespalib::stringref> addr) override;
std::unique_ptr<Value> build(std::unique_ptr<ValueBuilder<T>> self) override {
ValueBuilder<T>* me = this;
assert(me == self.get());
diff --git a/eval/src/vespa/eval/tensor/dense/typed_cells.cpp b/eval/src/vespa/eval/eval/typed_cells.cpp
index e56325bffd2..ca23f9d0bfc 100644
--- a/eval/src/vespa/eval/tensor/dense/typed_cells.cpp
+++ b/eval/src/vespa/eval/eval/typed_cells.cpp
@@ -1,7 +1,3 @@
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "typed_cells.h"
-
-namespace vespalib::tensor {
-
-} // namespace
diff --git a/eval/src/vespa/eval/tensor/dense/typed_cells.h b/eval/src/vespa/eval/eval/typed_cells.h
index 6ea2b40689e..09d5c080cf7 100644
--- a/eval/src/vespa/eval/tensor/dense/typed_cells.h
+++ b/eval/src/vespa/eval/eval/typed_cells.h
@@ -6,13 +6,13 @@
#include <vespa/vespalib/util/arrayref.h>
#include <vespa/eval/eval/value_type.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
// Low-level typed cells reference
-using CellType = vespalib::eval::ValueType::CellType;
-
struct TypedCells {
+ using CellType = vespalib::eval::ValueType::CellType;
+
const void *data;
CellType type;
size_t size:56;
@@ -24,6 +24,7 @@ struct TypedCells {
TypedCells(const void *dp, CellType ct, size_t sz) : data(dp), type(ct), size(sz) {}
template <typename T> bool check_type() const { return vespalib::eval::check_cell_type<T>(type); }
+
template <typename T> ConstArrayRef<T> typify() const {
assert(check_type<T>());
return ConstArrayRef<T>((const T *)data, size);
@@ -32,40 +33,10 @@ struct TypedCells {
return ConstArrayRef<T>((const T *)data, size);
}
- double get(size_t idx) const {
- if (type == CellType::DOUBLE) {
- const double *p = (const double *)data;
- return p[idx];
- }
- if (type == CellType::FLOAT) {
- const float *p = (const float *)data;
- return p[idx];
- }
- abort();
- }
-
TypedCells(TypedCells &&other) = default;
TypedCells(const TypedCells &other) = default;
TypedCells & operator= (TypedCells &&other) = default;
TypedCells & operator= (const TypedCells &other) = default;
};
-template <typename TGT, typename... Args>
-decltype(auto) dispatch_1(const TypedCells &a, Args &&...args) {
- switch (a.type) {
- case CellType::DOUBLE: return TGT::call(a.unsafe_typify<double>(), std::forward<Args>(args)...);
- case CellType::FLOAT: return TGT::call(a.unsafe_typify<float>(), std::forward<Args>(args)...);
- }
- abort();
-}
-
-template <typename TGT, typename A1, typename... Args>
-decltype(auto) dispatch_2(A1 &&a, const TypedCells &b, Args &&...args) {
- switch (b.type) {
- case CellType::DOUBLE: return dispatch_1<TGT>(std::forward<A1>(a), b.unsafe_typify<double>(), std::forward<Args>(args)...);
- case CellType::FLOAT: return dispatch_1<TGT>(std::forward<A1>(a), b.unsafe_typify<float>(), std::forward<Args>(args)...);
- }
- abort();
-}
-
} // namespace
diff --git a/eval/src/vespa/eval/eval/value.cpp b/eval/src/vespa/eval/eval/value.cpp
index 283950a6a67..7bf2d587904 100644
--- a/eval/src/vespa/eval/eval/value.cpp
+++ b/eval/src/vespa/eval/eval/value.cpp
@@ -10,8 +10,8 @@ namespace {
struct TrivialView : Value::Index::View {
bool first = false;
- void lookup(const std::vector<const vespalib::stringref*> &) override { first = true; }
- bool next_result(const std::vector<vespalib::stringref*> &, size_t &idx_out) override {
+ void lookup(ConstArrayRef<const vespalib::stringref*> ) override { first = true; }
+ bool next_result(ConstArrayRef<vespalib::stringref*> , size_t &idx_out) override {
if (first) {
idx_out = 0;
first = false;
diff --git a/eval/src/vespa/eval/eval/value.h b/eval/src/vespa/eval/eval/value.h
index a084d267cec..35a9b347e8b 100644
--- a/eval/src/vespa/eval/eval/value.h
+++ b/eval/src/vespa/eval/eval/value.h
@@ -3,7 +3,7 @@
#pragma once
#include "value_type.h"
-#include <vespa/eval/tensor/dense/typed_cells.h>
+#include "typed_cells.h"
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/util/traits.h>
#include <vector>
@@ -19,7 +19,6 @@ class Tensor;
struct Value {
using UP = std::unique_ptr<Value>;
using CREF = std::reference_wrapper<const Value>;
- using TypedCells = tensor::TypedCells;
virtual const ValueType &type() const = 0;
virtual ~Value() {}
@@ -38,13 +37,13 @@ struct Value {
// partial address for the dimensions given to
// create_view. Results from the lookup is extracted using
// the next_result function.
- virtual void lookup(const std::vector<const vespalib::stringref*> &addr) = 0;
+ virtual void lookup(ConstArrayRef<const vespalib::stringref*> addr) = 0;
// Extract the next result (if any) from the previous
// lookup into the given partial address and index. Only
// the labels for the dimensions NOT specified in
// create_view will be extracted here.
- virtual bool next_result(const std::vector<vespalib::stringref*> &addr_out, size_t &idx_out) = 0;
+ virtual bool next_result(ConstArrayRef<vespalib::stringref*> addr_out, size_t &idx_out) = 0;
virtual ~View() {}
};
@@ -136,7 +135,7 @@ struct ValueBuilder : ValueBuilderBase {
// returned subspaces will be invalidated when new subspaces are
// added. Also note that adding the same subspace multiple times
// is not allowed.
- virtual ArrayRef<T> add_subspace(const std::vector<vespalib::stringref> &addr) = 0;
+ virtual ArrayRef<T> add_subspace(ConstArrayRef<vespalib::stringref> addr) = 0;
// Given the ownership of the builder itself, produce the newly
// created value. This means that builders can only be used once,
diff --git a/eval/src/vespa/eval/instruction/generic_join.cpp b/eval/src/vespa/eval/instruction/generic_join.cpp
index b54f7d8952a..0f2fa4970db 100644
--- a/eval/src/vespa/eval/instruction/generic_join.cpp
+++ b/eval/src/vespa/eval/instruction/generic_join.cpp
@@ -10,7 +10,6 @@
namespace vespalib::eval::instruction {
-using TypedCells = Value::TypedCells;
using State = InterpretedFunction::State;
using Instruction = InterpretedFunction::Instruction;
diff --git a/eval/src/vespa/eval/tensor/dense/CMakeLists.txt b/eval/src/vespa/eval/tensor/dense/CMakeLists.txt
index 3a41fed132e..4ad4c3ac960 100644
--- a/eval/src/vespa/eval/tensor/dense/CMakeLists.txt
+++ b/eval/src/vespa/eval/tensor/dense/CMakeLists.txt
@@ -32,7 +32,7 @@ vespa_add_library(eval_tensor_dense OBJECT
index_lookup_table.cpp
mutable_dense_tensor_view.cpp
onnx_wrapper.cpp
- typed_cells.cpp
+ typed_cells_dispatch.cpp
typed_dense_tensor_builder.cpp
vector_from_doubles_function.cpp
)
diff --git a/eval/src/vespa/eval/tensor/dense/dense_tensor_cells_iterator.h b/eval/src/vespa/eval/tensor/dense/dense_tensor_cells_iterator.h
index 8d189027be2..4611ffaf1d1 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_tensor_cells_iterator.h
+++ b/eval/src/vespa/eval/tensor/dense/dense_tensor_cells_iterator.h
@@ -4,7 +4,7 @@
#include <vespa/eval/eval/value_type.h>
#include <vespa/vespalib/util/arrayref.h>
-#include "typed_cells.h"
+#include "typed_cells_dispatch.h"
namespace vespalib::tensor {
@@ -39,7 +39,7 @@ public:
}
}
bool valid() const { return _cellIdx < _cells.size; }
- double cell() const { return _cells.get(_cellIdx); }
+ double cell() const { return GetCell::from(_cells, _cellIdx); }
const Address &address() const { return _address; }
const eval::ValueType &fast_type() const { return _type; }
};
diff --git a/eval/src/vespa/eval/tensor/dense/dense_tensor_value_builder.h b/eval/src/vespa/eval/tensor/dense/dense_tensor_value_builder.h
index c420be2c582..49a660553ee 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_tensor_value_builder.h
+++ b/eval/src/vespa/eval/tensor/dense/dense_tensor_value_builder.h
@@ -19,7 +19,7 @@ public:
DenseTensorValueBuilder(const eval::ValueType &type, size_t subspace_size_in);
~DenseTensorValueBuilder() override;
ArrayRef<T>
- add_subspace(const std::vector<vespalib::stringref> &) override {
+ add_subspace(ConstArrayRef<vespalib::stringref>) override {
return _cells;
}
std::unique_ptr<eval::Value>
diff --git a/eval/src/vespa/eval/tensor/dense/dense_tensor_view.cpp b/eval/src/vespa/eval/tensor/dense/dense_tensor_view.cpp
index 9cb0b7d2510..b845ccf93a5 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_tensor_view.cpp
+++ b/eval/src/vespa/eval/tensor/dense/dense_tensor_view.cpp
@@ -152,7 +152,7 @@ bool sameCells(TypedCells lhs, TypedCells rhs)
return false;
}
for (size_t i = 0; i < lhs.size; ++i) {
- if (lhs.get(i) != rhs.get(i)) {
+ if (GetCell::from(lhs, i) != GetCell::from(rhs, i)) {
return false;
}
}
diff --git a/eval/src/vespa/eval/tensor/dense/dense_tensor_view.h b/eval/src/vespa/eval/tensor/dense/dense_tensor_view.h
index f69c068192a..2cea3c855a6 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_tensor_view.h
+++ b/eval/src/vespa/eval/tensor/dense/dense_tensor_view.h
@@ -2,7 +2,7 @@
#pragma once
-#include "typed_cells.h"
+#include "typed_cells_dispatch.h"
#include "dense_tensor_cells_iterator.h"
#include <vespa/eval/tensor/tensor.h>
diff --git a/eval/src/vespa/eval/tensor/dense/typed_cells_dispatch.cpp b/eval/src/vespa/eval/tensor/dense/typed_cells_dispatch.cpp
new file mode 100644
index 00000000000..874a530e767
--- /dev/null
+++ b/eval/src/vespa/eval/tensor/dense/typed_cells_dispatch.cpp
@@ -0,0 +1,3 @@
+// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "typed_cells_dispatch.h"
diff --git a/eval/src/vespa/eval/tensor/dense/typed_cells_dispatch.h b/eval/src/vespa/eval/tensor/dense/typed_cells_dispatch.h
new file mode 100644
index 00000000000..87b1a5b47ed
--- /dev/null
+++ b/eval/src/vespa/eval/tensor/dense/typed_cells_dispatch.h
@@ -0,0 +1,40 @@
+// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+#include <vespa/eval/eval/typed_cells.h>
+
+namespace vespalib::tensor {
+
+using CellType = vespalib::eval::ValueType::CellType;
+using TypedCells = vespalib::eval::TypedCells;
+
+template <typename TGT, typename... Args>
+decltype(auto) dispatch_1(const TypedCells &a, Args &&...args) {
+ switch (a.type) {
+ case CellType::DOUBLE: return TGT::call(a.unsafe_typify<double>(), std::forward<Args>(args)...);
+ case CellType::FLOAT: return TGT::call(a.unsafe_typify<float>(), std::forward<Args>(args)...);
+ }
+ abort();
+}
+
+template <typename TGT, typename A1, typename... Args>
+decltype(auto) dispatch_2(A1 &&a, const TypedCells &b, Args &&...args) {
+ switch (b.type) {
+ case CellType::DOUBLE: return dispatch_1<TGT>(std::forward<A1>(a), b.unsafe_typify<double>(), std::forward<Args>(args)...);
+ case CellType::FLOAT: return dispatch_1<TGT>(std::forward<A1>(a), b.unsafe_typify<float>(), std::forward<Args>(args)...);
+ }
+ abort();
+}
+
+struct GetCell {
+ template<typename T>
+ static double call(ConstArrayRef<T> arr, size_t idx) {
+ return arr[idx];
+ }
+ static double from(TypedCells src, size_t idx) {
+ return dispatch_1<GetCell>(src, idx);
+ }
+};
+
+} // namespace
diff --git a/eval/src/vespa/eval/tensor/mixed/packed_mappings_builder.cpp b/eval/src/vespa/eval/tensor/mixed/packed_mappings_builder.cpp
index fdfe5957a3f..1b3349324ba 100644
--- a/eval/src/vespa/eval/tensor/mixed/packed_mappings_builder.cpp
+++ b/eval/src/vespa/eval/tensor/mixed/packed_mappings_builder.cpp
@@ -8,14 +8,15 @@ namespace vespalib::eval::packed_mixed_tensor {
PackedMappingsBuilder::~PackedMappingsBuilder() = default;
uint32_t
-PackedMappingsBuilder::add_mapping_for(SparseAddress address)
+PackedMappingsBuilder::add_mapping_for(ConstArrayRef<vespalib::stringref> address_in)
{
- assert(address.size() == _num_dims);
- for (auto & label_value : address) {
+ SparseAddress address;
+ for (auto & label_value : address_in) {
// store label string in our own set:
auto iter = _labels.insert(label_value).first;
- label_value = *iter;
+ address.push_back(*iter);
}
+ assert(address.size() == _num_dims);
uint32_t next_index = _mappings.size();
auto iter = _mappings.emplace(address, next_index).first;
return iter->second;
diff --git a/eval/src/vespa/eval/tensor/mixed/packed_mappings_builder.h b/eval/src/vespa/eval/tensor/mixed/packed_mappings_builder.h
index bf2ae434275..01f16a8b8e1 100644
--- a/eval/src/vespa/eval/tensor/mixed/packed_mappings_builder.h
+++ b/eval/src/vespa/eval/tensor/mixed/packed_mappings_builder.h
@@ -20,8 +20,6 @@ namespace vespalib::eval::packed_mixed_tensor {
**/
class PackedMappingsBuilder {
public:
- using SparseAddress = std::vector<vespalib::stringref>;
-
PackedMappingsBuilder(uint32_t num_mapped_dims)
: _num_dims(num_mapped_dims),
_labels(),
@@ -33,7 +31,7 @@ public:
// returns a new index for new addresses
// may be called multiple times with same address,
// will then return the same index for that address.
- uint32_t add_mapping_for(SparseAddress address);
+ uint32_t add_mapping_for(ConstArrayRef<vespalib::stringref> address);
// how much extra memory is needed by target_memory
// not including sizeof(PackedMappings)
@@ -56,6 +54,7 @@ public:
private:
uint32_t _num_dims;
std::set<vespalib::string> _labels;
+ using SparseAddress = std::vector<vespalib::stringref>;
using IndexMap = std::map<SparseAddress, uint32_t>;
IndexMap _mappings;
};
diff --git a/eval/src/vespa/eval/tensor/mixed/packed_mixed_tensor.cpp b/eval/src/vespa/eval/tensor/mixed/packed_mixed_tensor.cpp
index 43f0c27ffbd..660cad82e4f 100644
--- a/eval/src/vespa/eval/tensor/mixed/packed_mixed_tensor.cpp
+++ b/eval/src/vespa/eval/tensor/mixed/packed_mixed_tensor.cpp
@@ -30,13 +30,13 @@ public:
_full_enums.resize(num_full_dims());
}
- void lookup(const std::vector<const vespalib::stringref*> &addr) override;
- bool next_result(const std::vector<vespalib::stringref*> &addr_out, size_t &idx_out) override;
+ void lookup(ConstArrayRef<const vespalib::stringref*> addr) override;
+ bool next_result(ConstArrayRef<vespalib::stringref*> addr_out, size_t &idx_out) override;
~PackedMixedTensorIndexView() override = default;
};
void
-PackedMixedTensorIndexView::lookup(const std::vector<const vespalib::stringref*> &addr)
+PackedMixedTensorIndexView::lookup(ConstArrayRef<const vespalib::stringref*> addr)
{
_index = 0;
assert(addr.size() == num_view_dims());
@@ -53,7 +53,7 @@ PackedMixedTensorIndexView::lookup(const std::vector<const vespalib::stringref*>
}
bool
-PackedMixedTensorIndexView::next_result(const std::vector<vespalib::stringref*> &addr_out, size_t &idx_out)
+PackedMixedTensorIndexView::next_result(ConstArrayRef<vespalib::stringref*> addr_out, size_t &idx_out)
{
assert(addr_out.size() == num_rest_dims());
while (_index < _mappings.size()) {
@@ -109,13 +109,13 @@ public:
_lookup_enums.reserve(num_full_dims());
}
- void lookup(const std::vector<const vespalib::stringref*> &addr) override;
- bool next_result(const std::vector<vespalib::stringref*> &addr_out, size_t &idx_out) override;
+ void lookup(ConstArrayRef<const vespalib::stringref*> addr) override;
+ bool next_result(ConstArrayRef<vespalib::stringref*> addr_out, size_t &idx_out) override;
~PackedMixedTensorLookup() override = default;
};
void
-PackedMixedTensorLookup::lookup(const std::vector<const vespalib::stringref*> &addr)
+PackedMixedTensorLookup::lookup(ConstArrayRef<const vespalib::stringref*> addr)
{
assert(addr.size() == num_full_dims());
_lookup_enums.clear();
@@ -132,7 +132,7 @@ PackedMixedTensorLookup::lookup(const std::vector<const vespalib::stringref*> &a
}
bool
-PackedMixedTensorLookup::next_result(const std::vector<vespalib::stringref*> &addr_out, size_t &idx_out)
+PackedMixedTensorLookup::next_result(ConstArrayRef<vespalib::stringref*> addr_out, size_t &idx_out)
{
assert(addr_out.size() == 0);
if (_first_time) {
@@ -164,20 +164,20 @@ public:
_full_address.resize(_mappings.num_mapped_dims());
}
- void lookup(const std::vector<const vespalib::stringref*> &addr) override;
- bool next_result(const std::vector<vespalib::stringref*> &addr_out, size_t &idx_out) override;
+ void lookup(ConstArrayRef<const vespalib::stringref*> addr) override;
+ bool next_result(ConstArrayRef<vespalib::stringref*> addr_out, size_t &idx_out) override;
~PackedMixedTensorAllMappings() override = default;
};
void
-PackedMixedTensorAllMappings::lookup(const std::vector<const vespalib::stringref*> &addr)
+PackedMixedTensorAllMappings::lookup(ConstArrayRef<const vespalib::stringref*> addr)
{
_index = 0;
assert(addr.size() == 0);
}
bool
-PackedMixedTensorAllMappings::next_result(const std::vector<vespalib::stringref*> &addr_out, size_t &idx_out)
+PackedMixedTensorAllMappings::next_result(ConstArrayRef<vespalib::stringref*> addr_out, size_t &idx_out)
{
assert(addr_out.size() == _mappings.num_mapped_dims());
while (_index < _mappings.size()) {
diff --git a/eval/src/vespa/eval/tensor/mixed/packed_mixed_tensor_builder.cpp b/eval/src/vespa/eval/tensor/mixed/packed_mixed_tensor_builder.cpp
index 75b307b1aa7..e419673ee22 100644
--- a/eval/src/vespa/eval/tensor/mixed/packed_mixed_tensor_builder.cpp
+++ b/eval/src/vespa/eval/tensor/mixed/packed_mixed_tensor_builder.cpp
@@ -6,8 +6,9 @@ namespace vespalib::eval::packed_mixed_tensor {
template <typename T>
ArrayRef<T>
-PackedMixedTensorBuilder<T>::add_subspace(const std::vector<vespalib::stringref> &addr)
+PackedMixedTensorBuilder<T>::add_subspace(ConstArrayRef<vespalib::stringref> addr_in)
{
+ std::vector<vespalib::stringref> addr(addr_in.begin(), addr_in.end());
uint32_t idx = _mappings_builder.add_mapping_for(addr);
size_t offset = idx * _subspace_size;
assert(offset <= _cells.size());
diff --git a/eval/src/vespa/eval/tensor/mixed/packed_mixed_tensor_builder.h b/eval/src/vespa/eval/tensor/mixed/packed_mixed_tensor_builder.h
index c99762b7e8b..a683b82dd24 100644
--- a/eval/src/vespa/eval/tensor/mixed/packed_mixed_tensor_builder.h
+++ b/eval/src/vespa/eval/tensor/mixed/packed_mixed_tensor_builder.h
@@ -33,7 +33,7 @@ public:
~PackedMixedTensorBuilder() override = default;
- ArrayRef<T> add_subspace(const std::vector<vespalib::stringref> &addr) override;
+ ArrayRef<T> add_subspace(ConstArrayRef<vespalib::stringref> addr) override;
std::unique_ptr<Value> build(std::unique_ptr<ValueBuilder<T>> self) override;
};
diff --git a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_index.cpp b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_index.cpp
index 275acb51af3..b30d734f9ab 100644
--- a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_index.cpp
+++ b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_index.cpp
@@ -40,14 +40,14 @@ public:
const std::vector<size_t> &dims)
: map(map_in), iter(map.end()), lookup_dims(dims), lookup_refs() {}
~SparseTensorValueView();
- void lookup(const std::vector<const vespalib::stringref*> &addr) override;
- bool next_result(const std::vector<vespalib::stringref*> &addr_out, size_t &idx_out) override;
+ void lookup(ConstArrayRef<const vespalib::stringref*> addr) override;
+ bool next_result(ConstArrayRef<vespalib::stringref*> addr_out, size_t &idx_out) override;
};
SparseTensorValueView::~SparseTensorValueView() = default;
void
-SparseTensorValueView::lookup(const std::vector<const vespalib::stringref*> &addr)
+SparseTensorValueView::lookup(ConstArrayRef<const vespalib::stringref*> addr)
{
lookup_refs.clear();
for (auto ptr : addr) {
@@ -58,7 +58,7 @@ SparseTensorValueView::lookup(const std::vector<const vespalib::stringref*> &add
}
bool
-SparseTensorValueView::next_result(const std::vector<vespalib::stringref*> &addr_out, size_t &idx_out)
+SparseTensorValueView::next_result(ConstArrayRef<vespalib::stringref*> addr_out, size_t &idx_out)
{
size_t total_dims = lookup_refs.size() + addr_out.size();
while (iter != map.end()) {
@@ -108,14 +108,14 @@ private:
public:
SparseTensorValueLookup(const IndexMap & map_in) : map(map_in), iter(map.end()) {}
~SparseTensorValueLookup();
- void lookup(const std::vector<const vespalib::stringref*> &addr) override;
- bool next_result(const std::vector<vespalib::stringref*> &addr_out, size_t &idx_out) override;
+ void lookup(ConstArrayRef<const vespalib::stringref*> addr) override;
+ bool next_result(ConstArrayRef<vespalib::stringref*> addr_out, size_t &idx_out) override;
};
SparseTensorValueLookup::~SparseTensorValueLookup() = default;
void
-SparseTensorValueLookup::lookup(const std::vector<const vespalib::stringref*> &addr)
+SparseTensorValueLookup::lookup(ConstArrayRef<const vespalib::stringref*> addr)
{
SparseTensorAddressBuilder builder;
for (const auto & label : addr) {
@@ -126,7 +126,7 @@ SparseTensorValueLookup::lookup(const std::vector<const vespalib::stringref*> &a
}
bool
-SparseTensorValueLookup::next_result(const std::vector<vespalib::stringref*> &, size_t &idx_out)
+SparseTensorValueLookup::next_result(ConstArrayRef<vespalib::stringref*>, size_t &idx_out)
{
if (iter != map.end()) {
idx_out = iter->second;
@@ -146,20 +146,20 @@ private:
public:
SparseTensorValueAllMappings(const IndexMap & map_in) : map(map_in), iter(map.end()) {}
~SparseTensorValueAllMappings();
- void lookup(const std::vector<const vespalib::stringref*> &addr) override;
- bool next_result(const std::vector<vespalib::stringref*> &addr_out, size_t &idx_out) override;
+ void lookup(ConstArrayRef<const vespalib::stringref*> addr) override;
+ bool next_result(ConstArrayRef<vespalib::stringref*> addr_out, size_t &idx_out) override;
};
SparseTensorValueAllMappings::~SparseTensorValueAllMappings() = default;
void
-SparseTensorValueAllMappings::lookup(const std::vector<const vespalib::stringref*> &)
+SparseTensorValueAllMappings::lookup(ConstArrayRef<const vespalib::stringref*>)
{
iter = map.begin();
}
bool
-SparseTensorValueAllMappings::next_result(const std::vector<vespalib::stringref*> &addr_out, size_t &idx_out)
+SparseTensorValueAllMappings::next_result(ConstArrayRef<vespalib::stringref*> addr_out, size_t &idx_out)
{
if (iter != map.end()) {
const auto & ref = iter->first;
diff --git a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_t.cpp b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_t.cpp
index f185f571561..cb1370475ba 100644
--- a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_t.cpp
+++ b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_t.cpp
@@ -104,10 +104,10 @@ template<typename T>
SparseTensorT<T>::~SparseTensorT() = default;
template<typename T>
-TypedCells
+eval::TypedCells
SparseTensorT<T>::cells() const
{
- return TypedCells(_values);
+ return eval::TypedCells(_values);
}
template<typename T>
@@ -184,16 +184,16 @@ SparseTensorT<T>::join(join_fun_t function, const Tensor &arg) const
}
const auto & lhs_type = fast_type();
const auto & rhs_type = rhs->fast_type();
+ auto rhs_ct = rhs_type.cell_type();
auto res_type = eval::ValueType::join(lhs_type, rhs_type);
if (function == eval::operation::Mul::f) {
if (lhs_type.dimensions() == rhs_type.dimensions()) {
- return typify_invoke<1,eval::TypifyCellType,FastSparseJoin<T>>(
- rhs_type.cell_type(),
+ return typify_invoke<1,eval::TypifyCellType,FastSparseJoin<T>>(rhs_ct,
*this, *rhs, std::move(res_type));
}
}
- return typify_invoke<2,eval::TypifyCellType,GenericSparseJoin<T>>(
- rhs_type.cell_type(), res_type.cell_type(),
+ auto res_ct = res_type.cell_type();
+ return typify_invoke<2,eval::TypifyCellType,GenericSparseJoin<T>>(rhs_ct, res_ct,
*this, *rhs, std::move(res_type), function);
}
diff --git a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_t.h b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_t.h
index 1bd0f7caafd..abe2c429d53 100644
--- a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_t.h
+++ b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_t.h
@@ -21,7 +21,7 @@ private:
public:
SparseTensorT(eval::ValueType type_in, SparseTensorIndex index_in, std::vector<T> cells_in);
~SparseTensorT() override;
- TypedCells cells() const override;
+ eval::TypedCells cells() const override;
T get_value(size_t idx) const { return _values[idx]; }
size_t my_size() const { return _values.size(); }
const std::vector<T> &my_values() const { return _values; }
diff --git a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_value_builder.cpp b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_value_builder.cpp
index 7c584246d83..2152a2c3b6e 100644
--- a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_value_builder.cpp
+++ b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_value_builder.cpp
@@ -7,7 +7,7 @@ namespace vespalib::tensor {
template <typename T>
ArrayRef<T>
-SparseTensorValueBuilder<T>::add_subspace(const std::vector<vespalib::stringref> &addr)
+SparseTensorValueBuilder<T>::add_subspace(ConstArrayRef<vespalib::stringref> addr)
{
uint32_t idx = _cells.size();
_addr_builder.clear();
diff --git a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_value_builder.h b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_value_builder.h
index db3ff314ed2..a48af150b15 100644
--- a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_value_builder.h
+++ b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_value_builder.h
@@ -34,7 +34,7 @@ public:
~SparseTensorValueBuilder() override = default;
- ArrayRef<T> add_subspace(const std::vector<vespalib::stringref> &addr) override;
+ ArrayRef<T> add_subspace(ConstArrayRef<vespalib::stringref> addr) override;
std::unique_ptr<eval::Value> build(std::unique_ptr<eval::ValueBuilder<T>> self) override;
};
diff --git a/eval/src/vespa/eval/tensor/wrapped_simple_tensor.h b/eval/src/vespa/eval/tensor/wrapped_simple_tensor.h
index 9c4031ac171..87b08427765 100644
--- a/eval/src/vespa/eval/tensor/wrapped_simple_tensor.h
+++ b/eval/src/vespa/eval/tensor/wrapped_simple_tensor.h
@@ -26,7 +26,7 @@ public:
: _space(), _tensor(tensor) {}
explicit WrappedSimpleTensor(std::unique_ptr<eval::SimpleTensor> tensor)
: _space(std::move(tensor)), _tensor(*_space) {}
- TypedCells cells() const override { abort(); }
+ eval::TypedCells cells() const override { abort(); }
const Index &index() const override { abort(); }
~WrappedSimpleTensor() {}
const eval::SimpleTensor &get() const { return _tensor; }
diff --git a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp
index 1a342a92b3d..b4bf571c756 100644
--- a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp
+++ b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp
@@ -181,7 +181,7 @@ public:
_adds.emplace_back(docid, DoubleVector(vector.begin(), vector.end()));
}
std::unique_ptr<PrepareResult> prepare_add_document(uint32_t docid,
- vespalib::tensor::TypedCells vector,
+ vespalib::eval::TypedCells vector,
vespalib::GenerationHandler::Guard guard) const override {
(void) guard;
auto d_vector = vector.typify<double>();
@@ -222,13 +222,13 @@ public:
_index_value = (reinterpret_cast<const int*>(buf.buffer()))[0];
return true;
}
- std::vector<Neighbor> find_top_k(uint32_t k, vespalib::tensor::TypedCells vector, uint32_t explore_k) const override {
+ std::vector<Neighbor> find_top_k(uint32_t k, vespalib::eval::TypedCells vector, uint32_t explore_k) const override {
(void) k;
(void) vector;
(void) explore_k;
return std::vector<Neighbor>();
}
- std::vector<Neighbor> find_top_k_with_filter(uint32_t k, vespalib::tensor::TypedCells vector,
+ std::vector<Neighbor> find_top_k_with_filter(uint32_t k, vespalib::eval::TypedCells vector,
const search::BitVector& filter, uint32_t explore_k) const override
{
(void) k;
diff --git a/searchlib/src/tests/tensor/distance_functions/distance_functions_test.cpp b/searchlib/src/tests/tensor/distance_functions/distance_functions_test.cpp
index f11a28b8716..a9e24e056f2 100644
--- a/searchlib/src/tests/tensor/distance_functions/distance_functions_test.cpp
+++ b/searchlib/src/tests/tensor/distance_functions/distance_functions_test.cpp
@@ -1,6 +1,6 @@
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/eval/tensor/dense/typed_cells.h>
+#include <vespa/eval/eval/typed_cells.h>
#include <vespa/searchlib/tensor/distance_functions.h>
#include <vespa/searchlib/tensor/distance_function_factory.h>
#include <vespa/vespalib/gtest/gtest.h>
@@ -10,7 +10,7 @@
LOG_SETUP("distance_function_test");
using namespace search::tensor;
-using vespalib::tensor::TypedCells;
+using vespalib::eval::TypedCells;
using search::attribute::DistanceMetric;
TypedCells t(const std::vector<double> &v) { return TypedCells(v); }
diff --git a/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp b/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp
index cd989c03b4e..acc157709c0 100644
--- a/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp
+++ b/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp
@@ -1,6 +1,5 @@
// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/eval/tensor/dense/typed_cells.h>
#include <vespa/searchlib/common/bitvector.h>
#include <vespa/searchlib/tensor/distance_functions.h>
#include <vespa/searchlib/tensor/doc_vector_access.h>
@@ -39,9 +38,9 @@ public:
_vectors[docid] = vec;
return *this;
}
- vespalib::tensor::TypedCells get_vector(uint32_t docid) const override {
+ vespalib::eval::TypedCells get_vector(uint32_t docid) const override {
ArrayRef ref(_vectors[docid]);
- return vespalib::tensor::TypedCells(ref);
+ return vespalib::eval::TypedCells(ref);
}
};
diff --git a/searchlib/src/tests/tensor/hnsw_index/stress_hnsw_mt.cpp b/searchlib/src/tests/tensor/hnsw_index/stress_hnsw_mt.cpp
index a5e0e1e2b6a..8790df5a140 100644
--- a/searchlib/src/tests/tensor/hnsw_index/stress_hnsw_mt.cpp
+++ b/searchlib/src/tests/tensor/hnsw_index/stress_hnsw_mt.cpp
@@ -8,7 +8,7 @@
#include <future>
#include <vector>
-#include <vespa/eval/tensor/dense/typed_cells.h>
+#include <vespa/eval/eval/typed_cells.h>
#include <vespa/searchlib/common/bitvector.h>
#include <vespa/searchlib/tensor/distance_functions.h>
#include <vespa/searchlib/tensor/doc_vector_access.h>
@@ -109,10 +109,10 @@ public:
memcpy(&_vectors[docid], vec.cbegin(), sizeof(MallocPointVector));
return *this;
}
- vespalib::tensor::TypedCells get_vector(uint32_t docid) const override {
+ vespalib::eval::TypedCells get_vector(uint32_t docid) const override {
assert(docid < NUM_POSSIBLE_DOCS);
ConstVectorRef ref(_vectors[docid]);
- return vespalib::tensor::TypedCells(ref);
+ return vespalib::eval::TypedCells(ref);
}
};
@@ -175,7 +175,7 @@ public:
return result_promise.get_future();
}
void run() override {
- auto v = vespalib::tensor::TypedCells(vec);
+ auto v = vespalib::eval::TypedCells(vec);
auto up = parent.index->prepare_add_document(docid, v, read_guard);
result_promise.set_value(std::move(up));
}
diff --git a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_iterator.cpp b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_iterator.cpp
index a64168469f0..cf4e8ae2f6a 100644
--- a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_iterator.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_iterator.cpp
@@ -7,7 +7,7 @@ using search::tensor::DenseTensorAttribute;
using vespalib::ConstArrayRef;
using vespalib::tensor::DenseTensorView;
using vespalib::tensor::MutableDenseTensorView;
-using vespalib::tensor::TypedCells;
+using vespalib::eval::TypedCells;
using CellType = vespalib::eval::ValueType::CellType;
diff --git a/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp
index d63249b816f..0a34c18bae9 100644
--- a/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp
@@ -287,7 +287,7 @@ DenseTensorAttribute::get_state(const vespalib::slime::Inserter& inserter) const
}
}
-vespalib::tensor::TypedCells
+vespalib::eval::TypedCells
DenseTensorAttribute::get_vector(uint32_t docid) const
{
assert(docid < _refVector.size());
diff --git a/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.h b/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.h
index 1de74d4238d..859ea82cee6 100644
--- a/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.h
+++ b/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.h
@@ -48,7 +48,7 @@ public:
void get_state(const vespalib::slime::Inserter& inserter) const override;
// Implements DocVectorAccess
- vespalib::tensor::TypedCells get_vector(uint32_t docid) const override;
+ vespalib::eval::TypedCells get_vector(uint32_t docid) const override;
const NearestNeighborIndex* nearest_neighbor_index() const { return _index.get(); }
};
diff --git a/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp b/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp
index 99afcd92fa6..7a020d33d5c 100644
--- a/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.cpp
@@ -137,7 +137,7 @@ DenseTensorStore::getTensor(EntryRef ref) const
if (!ref.valid()) {
return std::unique_ptr<Tensor>();
}
- vespalib::tensor::TypedCells cells_ref(getRawBuffer(ref), _type.cell_type(), getNumCells());
+ vespalib::eval::TypedCells cells_ref(getRawBuffer(ref), _type.cell_type(), getNumCells());
return std::make_unique<DenseTensorView>(_type, cells_ref);
}
@@ -145,21 +145,21 @@ void
DenseTensorStore::getTensor(EntryRef ref, MutableDenseTensorView &tensor) const
{
if (!ref.valid()) {
- vespalib::tensor::TypedCells cells_ref(&_emptySpace[0], _type.cell_type(), getNumCells());
+ vespalib::eval::TypedCells cells_ref(&_emptySpace[0], _type.cell_type(), getNumCells());
tensor.setCells(cells_ref);
} else {
- vespalib::tensor::TypedCells cells_ref(getRawBuffer(ref), _type.cell_type(), getNumCells());
+ vespalib::eval::TypedCells cells_ref(getRawBuffer(ref), _type.cell_type(), getNumCells());
tensor.setCells(cells_ref);
}
}
-vespalib::tensor::TypedCells
+vespalib::eval::TypedCells
DenseTensorStore::get_typed_cells(EntryRef ref) const
{
if (!ref.valid()) {
- return vespalib::tensor::TypedCells(&_emptySpace[0], _type.cell_type(), getNumCells());
+ return vespalib::eval::TypedCells(&_emptySpace[0], _type.cell_type(), getNumCells());
}
- return vespalib::tensor::TypedCells(getRawBuffer(ref), _type.cell_type(), getNumCells());
+ return vespalib::eval::TypedCells(getRawBuffer(ref), _type.cell_type(), getNumCells());
}
template <class TensorType>
diff --git a/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.h b/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.h
index 75b48da0f25..979df1a9a4e 100644
--- a/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.h
+++ b/searchlib/src/vespa/searchlib/tensor/dense_tensor_store.h
@@ -4,7 +4,7 @@
#include "tensor_store.h"
#include <vespa/eval/eval/value_type.h>
-#include <vespa/eval/tensor/dense/typed_cells.h>
+#include <vespa/eval/eval/typed_cells.h>
namespace vespalib { namespace tensor { class MutableDenseTensorView; }}
@@ -66,7 +66,7 @@ public:
EntryRef move(EntryRef ref) override;
std::unique_ptr<Tensor> getTensor(EntryRef ref) const;
void getTensor(EntryRef ref, vespalib::tensor::MutableDenseTensorView &tensor) const;
- vespalib::tensor::TypedCells get_typed_cells(EntryRef ref) const;
+ vespalib::eval::TypedCells get_typed_cells(EntryRef ref) const;
EntryRef setTensor(const Tensor &tensor);
// The following method is meant to be used only for unit tests.
uint32_t getArraySize() const { return _bufferType.getArraySize(); }
diff --git a/searchlib/src/vespa/searchlib/tensor/distance_function.h b/searchlib/src/vespa/searchlib/tensor/distance_function.h
index 7665ca09f5a..30ad1876317 100644
--- a/searchlib/src/vespa/searchlib/tensor/distance_function.h
+++ b/searchlib/src/vespa/searchlib/tensor/distance_function.h
@@ -4,7 +4,7 @@
#include <memory>
-namespace vespalib::tensor { struct TypedCells; }
+namespace vespalib::eval { struct TypedCells; }
namespace search::tensor {
@@ -18,10 +18,10 @@ class DistanceFunction {
public:
using UP = std::unique_ptr<DistanceFunction>;
virtual ~DistanceFunction() {}
- virtual double calc(const vespalib::tensor::TypedCells& lhs, const vespalib::tensor::TypedCells& rhs) const = 0;
+ virtual double calc(const vespalib::eval::TypedCells& lhs, const vespalib::eval::TypedCells& rhs) const = 0;
virtual double to_rawscore(double distance) const = 0;
- virtual double calc_with_limit(const vespalib::tensor::TypedCells& lhs,
- const vespalib::tensor::TypedCells& rhs,
+ virtual double calc_with_limit(const vespalib::eval::TypedCells& lhs,
+ const vespalib::eval::TypedCells& rhs,
double limit) const = 0;
};
diff --git a/searchlib/src/vespa/searchlib/tensor/distance_functions.h b/searchlib/src/vespa/searchlib/tensor/distance_functions.h
index 73716395369..8db7b1f48f1 100644
--- a/searchlib/src/vespa/searchlib/tensor/distance_functions.h
+++ b/searchlib/src/vespa/searchlib/tensor/distance_functions.h
@@ -3,7 +3,7 @@
#pragma once
#include "distance_function.h"
-#include <vespa/eval/tensor/dense/typed_cells.h>
+#include <vespa/eval/eval/typed_cells.h>
#include <vespa/vespalib/hwaccelrated/iaccelrated.h>
#include <cmath>
@@ -19,7 +19,7 @@ public:
SquaredEuclideanDistance()
: _computer(vespalib::hwaccelrated::IAccelrated::getAccelerator())
{}
- double calc(const vespalib::tensor::TypedCells& lhs, const vespalib::tensor::TypedCells& rhs) const override {
+ double calc(const vespalib::eval::TypedCells& lhs, const vespalib::eval::TypedCells& rhs) const override {
auto lhs_vector = lhs.typify<FloatType>();
auto rhs_vector = rhs.typify<FloatType>();
size_t sz = lhs_vector.size();
@@ -31,8 +31,8 @@ public:
double score = 1.0 / (1.0 + d);
return score;
}
- double calc_with_limit(const vespalib::tensor::TypedCells& lhs,
- const vespalib::tensor::TypedCells& rhs,
+ double calc_with_limit(const vespalib::eval::TypedCells& lhs,
+ const vespalib::eval::TypedCells& rhs,
double limit) const override
{
auto lhs_vector = lhs.typify<FloatType>();
@@ -59,7 +59,7 @@ public:
AngularDistance()
: _computer(vespalib::hwaccelrated::IAccelrated::getAccelerator())
{}
- double calc(const vespalib::tensor::TypedCells& lhs, const vespalib::tensor::TypedCells& rhs) const override {
+ double calc(const vespalib::eval::TypedCells& lhs, const vespalib::eval::TypedCells& rhs) const override {
auto lhs_vector = lhs.typify<FloatType>();
auto rhs_vector = rhs.typify<FloatType>();
size_t sz = lhs_vector.size();
@@ -84,8 +84,8 @@ public:
double score = 1.0 / (1.0 + angle_distance);
return score;
}
- double calc_with_limit(const vespalib::tensor::TypedCells& lhs,
- const vespalib::tensor::TypedCells& rhs,
+ double calc_with_limit(const vespalib::eval::TypedCells& lhs,
+ const vespalib::eval::TypedCells& rhs,
double /*limit*/) const override
{
return calc(lhs, rhs);
@@ -104,7 +104,7 @@ public:
InnerProductDistance()
: _computer(vespalib::hwaccelrated::IAccelrated::getAccelerator())
{}
- double calc(const vespalib::tensor::TypedCells& lhs, const vespalib::tensor::TypedCells& rhs) const override {
+ double calc(const vespalib::eval::TypedCells& lhs, const vespalib::eval::TypedCells& rhs) const override {
auto lhs_vector = lhs.typify<FloatType>();
auto rhs_vector = rhs.typify<FloatType>();
size_t sz = lhs_vector.size();
@@ -116,8 +116,8 @@ public:
double score = 1.0 / (1.0 + distance);
return score;
}
- double calc_with_limit(const vespalib::tensor::TypedCells& lhs,
- const vespalib::tensor::TypedCells& rhs,
+ double calc_with_limit(const vespalib::eval::TypedCells& lhs,
+ const vespalib::eval::TypedCells& rhs,
double /*limit*/) const override
{
return calc(lhs, rhs);
@@ -141,7 +141,7 @@ public:
double s = sin(0.5*angle);
return s*s;
}
- double calc(const vespalib::tensor::TypedCells& lhs, const vespalib::tensor::TypedCells& rhs) const override {
+ double calc(const vespalib::eval::TypedCells& lhs, const vespalib::eval::TypedCells& rhs) const override {
auto lhs_vector = lhs.typify<FloatType>();
auto rhs_vector = rhs.typify<FloatType>();
assert(2 == lhs_vector.size());
@@ -169,8 +169,8 @@ public:
double d = 2 * asin(hav_diff) * 6371.0088; // Earth mean radius
return 1.0 / (1.0 + d);
}
- double calc_with_limit(const vespalib::tensor::TypedCells& lhs,
- const vespalib::tensor::TypedCells& rhs,
+ double calc_with_limit(const vespalib::eval::TypedCells& lhs,
+ const vespalib::eval::TypedCells& rhs,
double /*limit*/) const override
{
return calc(lhs, rhs);
@@ -186,7 +186,7 @@ template <typename FloatType>
class HammingDistance : public DistanceFunction {
public:
HammingDistance() {}
- double calc(const vespalib::tensor::TypedCells& lhs, const vespalib::tensor::TypedCells& rhs) const override {
+ double calc(const vespalib::eval::TypedCells& lhs, const vespalib::eval::TypedCells& rhs) const override {
auto lhs_vector = lhs.typify<FloatType>();
auto rhs_vector = rhs.typify<FloatType>();
size_t sz = lhs_vector.size();
@@ -201,8 +201,8 @@ public:
double score = 1.0 / (1.0 + distance);
return score;
}
- double calc_with_limit(const vespalib::tensor::TypedCells& lhs,
- const vespalib::tensor::TypedCells& rhs,
+ double calc_with_limit(const vespalib::eval::TypedCells& lhs,
+ const vespalib::eval::TypedCells& rhs,
double limit) const override
{
auto lhs_vector = lhs.typify<FloatType>();
diff --git a/searchlib/src/vespa/searchlib/tensor/doc_vector_access.h b/searchlib/src/vespa/searchlib/tensor/doc_vector_access.h
index e5dfa35a529..8fcebc64b78 100644
--- a/searchlib/src/vespa/searchlib/tensor/doc_vector_access.h
+++ b/searchlib/src/vespa/searchlib/tensor/doc_vector_access.h
@@ -2,7 +2,7 @@
#pragma once
-#include <vespa/eval/tensor/dense/typed_cells.h>
+#include <vespa/eval/eval/typed_cells.h>
#include <cstdint>
namespace search::tensor {
@@ -15,7 +15,7 @@ namespace search::tensor {
class DocVectorAccess {
public:
virtual ~DocVectorAccess() {}
- virtual vespalib::tensor::TypedCells get_vector(uint32_t docid) const = 0;
+ virtual vespalib::eval::TypedCells get_vector(uint32_t docid) const = 0;
};
}
diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
index 2a17378f58a..9def5a7b0a8 100644
--- a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
@@ -6,7 +6,6 @@
#include "hnsw_index_saver.h"
#include "random_level_generator.h"
#include <vespa/searchlib/util/state_explorer_utils.h>
-#include <vespa/eval/tensor/dense/typed_cells.h>
#include <vespa/vespalib/data/slime/cursor.h>
#include <vespa/vespalib/data/slime/inserter.h>
#include <vespa/vespalib/datastore/array_store.hpp>
diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index.h b/searchlib/src/vespa/searchlib/tensor/hnsw_index.h
index f9adef0b86c..c07a0642b2e 100644
--- a/searchlib/src/vespa/searchlib/tensor/hnsw_index.h
+++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index.h
@@ -9,7 +9,7 @@
#include "nearest_neighbor_index.h"
#include "random_level_generator.h"
#include "hnsw_graph.h"
-#include <vespa/eval/tensor/dense/typed_cells.h>
+#include <vespa/eval/eval/typed_cells.h>
#include <vespa/searchlib/common/bitvector.h>
#include <vespa/vespalib/datastore/array_store.h>
#include <vespa/vespalib/datastore/atomic_entry_ref.h>
@@ -72,7 +72,7 @@ protected:
using LevelArrayRef = HnswGraph::LevelArrayRef;
using LevelArray = vespalib::Array<AtomicEntryRef>;
- using TypedCells = vespalib::tensor::TypedCells;
+ using TypedCells = vespalib::eval::TypedCells;
HnswGraph _graph;
const DocVectorAccess& _vectors;
diff --git a/searchlib/src/vespa/searchlib/tensor/nearest_neighbor_index.h b/searchlib/src/vespa/searchlib/tensor/nearest_neighbor_index.h
index b46c19ac88a..74f14cea21b 100644
--- a/searchlib/src/vespa/searchlib/tensor/nearest_neighbor_index.h
+++ b/searchlib/src/vespa/searchlib/tensor/nearest_neighbor_index.h
@@ -4,7 +4,6 @@
#include "distance_function.h"
#include "prepare_result.h"
-#include <vespa/eval/tensor/dense/typed_cells.h>
#include <vespa/vespalib/util/generationhandler.h>
#include <vespa/vespalib/util/memoryusage.h>
#include <cstdint>
@@ -47,7 +46,7 @@ public:
* The given read guard must be kept in the result.
*/
virtual std::unique_ptr<PrepareResult> prepare_add_document(uint32_t docid,
- vespalib::tensor::TypedCells vector,
+ vespalib::eval::TypedCells vector,
vespalib::GenerationHandler::Guard read_guard) const = 0;
/**
* Performs the complete step in a two-phase operation to add a document to the index.
@@ -73,12 +72,12 @@ public:
virtual bool load(const fileutil::LoadedBuffer& buf) = 0;
virtual std::vector<Neighbor> find_top_k(uint32_t k,
- vespalib::tensor::TypedCells vector,
+ vespalib::eval::TypedCells vector,
uint32_t explore_k) const = 0;
// only return neighbors where the corresponding filter bit is set
virtual std::vector<Neighbor> find_top_k_with_filter(uint32_t k,
- vespalib::tensor::TypedCells vector,
+ vespalib::eval::TypedCells vector,
const BitVector &filter,
uint32_t explore_k) const = 0;