summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHÃ¥vard Pettersen <3535158+havardpe@users.noreply.github.com>2020-12-04 23:30:44 +0100
committerGitHub <noreply@github.com>2020-12-04 23:30:44 +0100
commit57a44319f652817b5841d4d3d476a070235970f5 (patch)
tree62358c0d4ef6d332ba9598f6574463a63e9b67b5 /searchlib
parenta90709008ec0d108ee9a2e26bda20e39a10424b5 (diff)
parent15fe399eff5ade4ea12dded37c28ec4629899015 (diff)
Merge pull request #15678 from vespa-engine/havardpe/remove-engine-or-factory
remove EngineOrFactory
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/features/constant_tensor_executor.h7
-rw-r--r--searchlib/src/vespa/searchlib/features/dotproductfeature.cpp7
-rw-r--r--searchlib/src/vespa/searchlib/features/queryfeature.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h5
-rw-r--r--searchlib/src/vespa/searchlib/tensor/direct_tensor_attribute.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp11
-rw-r--r--searchlib/src/vespa/searchlib/tensor/tensor_deserialize.cpp7
8 files changed, 30 insertions, 25 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp b/searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp
index 29033944d4b..ffaec9d0779 100644
--- a/searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp
@@ -7,7 +7,7 @@
#include "singlenumericattribute.hpp"
#include "singlestringattribute.h"
#include "singleboolattribute.h"
-#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/fast_value.h>
#include <vespa/searchlib/tensor/dense_tensor_attribute.h>
#include <vespa/searchlib/tensor/serialized_tensor_attribute.h>
#include <vespa/searchlib/tensor/serialized_fast_value_attribute.h>
@@ -47,10 +47,8 @@ AttributeFactory::createSingleStd(stringref name, const Config & info)
case BasicType::TENSOR:
if (info.tensorType().is_dense()) {
return std::make_shared<tensor::DenseTensorAttribute>(name, info);
- } else if (vespalib::eval::EngineOrFactory::get().is_factory()) {
- return std::make_shared<tensor::SerializedFastValueAttribute>(name, info);
} else {
- return std::make_shared<tensor::SerializedTensorAttribute>(name, info);
+ return std::make_shared<tensor::SerializedFastValueAttribute>(name, info);
}
case BasicType::REFERENCE:
return std::make_shared<attribute::ReferenceAttribute>(name, info);
diff --git a/searchlib/src/vespa/searchlib/features/constant_tensor_executor.h b/searchlib/src/vespa/searchlib/features/constant_tensor_executor.h
index 835cd1a8e36..f95cbfa4726 100644
--- a/searchlib/src/vespa/searchlib/features/constant_tensor_executor.h
+++ b/searchlib/src/vespa/searchlib/features/constant_tensor_executor.h
@@ -6,7 +6,8 @@
#include <vespa/eval/eval/tensor_spec.h>
#include <vespa/eval/eval/value.h>
#include <vespa/eval/eval/value_type.h>
-#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/fast_value.h>
+#include <vespa/eval/eval/value_codec.h>
#include <vespa/vespalib/util/stash.h>
namespace search::features {
@@ -31,9 +32,9 @@ public:
return stash.create<ConstantTensorExecutor>(std::move(tensor));
}
static fef::FeatureExecutor &createEmpty(const vespalib::eval::ValueType &valueType, vespalib::Stash &stash) {
- const auto engine = vespalib::eval::EngineOrFactory::get();
+ const auto &factory = vespalib::eval::FastValueBuilderFactory::get();
auto spec = vespalib::eval::TensorSpec(valueType.to_spec());
- return stash.create<ConstantTensorExecutor>(engine.from_spec(spec));
+ return stash.create<ConstantTensorExecutor>(vespalib::eval::value_from_spec(spec, factory));
}
static fef::FeatureExecutor &createEmpty(vespalib::Stash &stash) {
return createEmpty(vespalib::eval::ValueType::double_type(), stash);
diff --git a/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp b/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp
index 83beee98634..06f0de631be 100644
--- a/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp
@@ -10,7 +10,8 @@
#include <vespa/searchlib/attribute/floatbase.h>
#include <vespa/searchlib/attribute/multinumericattribute.h>
#include <vespa/searchlib/attribute/multienumattribute.h>
-#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/fast_value.h>
+#include <vespa/eval/eval/value_codec.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/util/stash.h>
@@ -19,7 +20,7 @@ LOG_SETUP(".features.dotproduct");
using namespace search::attribute;
using namespace search::fef;
-using vespalib::eval::EngineOrFactory;
+using vespalib::eval::FastValueBuilderFactory;
using vespalib::eval::TypedCells;
using vespalib::hwaccelrated::IAccelrated;
@@ -500,7 +501,7 @@ template <typename T>
ArrayParam<T>::ArrayParam(vespalib::nbostream & stream) {
using vespalib::typify_invoke;
using vespalib::eval::TypifyCellType;
- auto tensor = EngineOrFactory::get().decode(stream);
+ auto tensor = vespalib::eval::decode_value(stream, FastValueBuilderFactory::get());
if (tensor->type().is_dense()) {
TypedCells cells = tensor->cells();
typify_invoke<1,TypifyCellType,CopyCellsToVector<T>>(cells.type, cells, values);
diff --git a/searchlib/src/vespa/searchlib/features/queryfeature.cpp b/searchlib/src/vespa/searchlib/features/queryfeature.cpp
index 9cded69d5de..c6196fcbc7f 100644
--- a/searchlib/src/vespa/searchlib/features/queryfeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/queryfeature.cpp
@@ -12,6 +12,8 @@
#include <vespa/searchlib/fef/feature_type.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/eval/eval/value_type.h>
+#include <vespa/eval/eval/value_codec.h>
+#include <vespa/eval/eval/fast_value.h>
#include <vespa/vespalib/locale/c.h>
#include <cerrno>
@@ -119,7 +121,7 @@ createTensorExecutor(const IQueryEnvironment &env,
if (prop.found() && !prop.get().empty()) {
const vespalib::string &value = prop.get();
vespalib::nbostream stream(value.data(), value.size());
- auto tensor = vespalib::eval::EngineOrFactory::get().decode(stream);
+ auto tensor = vespalib::eval::decode_value(stream, vespalib::eval::FastValueBuilderFactory::get());
if (!TensorDataType::isAssignableType(valueType, tensor->type())) {
LOG(warning, "Query feature type is '%s' but other tensor type is '%s'",
valueType.to_spec().c_str(), tensor->type().to_spec().c_str());
diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h b/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h
index b0cb076f65b..72520830d06 100644
--- a/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h
+++ b/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h
@@ -4,7 +4,8 @@
#include <vespa/eval/eval/tensor_spec.h>
#include <vespa/eval/eval/value.h>
-#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/fast_value.h>
+#include <vespa/eval/eval/value_codec.h>
#include <vespa/searchcommon/attribute/iattributecontext.h>
#include <vespa/searchlib/attribute/attributevector.h>
#include <vespa/searchlib/attribute/attribute_blueprint_params.h>
@@ -34,7 +35,7 @@ public:
}
vespalib::eval::Value::UP get_query_tensor(const vespalib::string& tensor_name) const override {
if (_query_tensor && (tensor_name == _query_tensor_name)) {
- return vespalib::eval::EngineOrFactory::get().from_spec(*_query_tensor);
+ return vespalib::eval::value_from_spec(*_query_tensor, vespalib::eval::FastValueBuilderFactory::get());
}
return {};
}
diff --git a/searchlib/src/vespa/searchlib/tensor/direct_tensor_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/direct_tensor_attribute.cpp
index 62beb25be22..8cda62682d0 100644
--- a/searchlib/src/vespa/searchlib/tensor/direct_tensor_attribute.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/direct_tensor_attribute.cpp
@@ -3,7 +3,7 @@
#include "direct_tensor_attribute.h"
#include "direct_tensor_saver.h"
-#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/fast_value.h>
#include <vespa/eval/eval/value.h>
#include <vespa/fastlib/io/bufferedfile.h>
#include <vespa/searchlib/attribute/readerbase.h>
@@ -14,7 +14,7 @@
#include "tensor_deserialize.h"
#include "tensor_attribute.hpp"
-using vespalib::eval::EngineOrFactory;
+using vespalib::eval::FastValueBuilderFactory;
namespace search::tensor {
@@ -73,7 +73,7 @@ DirectTensorAttribute::set_tensor(DocId lid, std::unique_ptr<vespalib::eval::Val
void
DirectTensorAttribute::setTensor(DocId lid, const vespalib::eval::Value &tensor)
{
- set_tensor(lid, EngineOrFactory::get().copy(tensor));
+ set_tensor(lid, FastValueBuilderFactory::get().copy(tensor));
}
std::unique_ptr<vespalib::eval::Value>
@@ -86,7 +86,7 @@ DirectTensorAttribute::getTensor(DocId docId) const
if (ref.valid()) {
auto ptr = _direct_store.get_tensor(ref);
if (ptr) {
- return EngineOrFactory::get().copy(*ptr);
+ return FastValueBuilderFactory::get().copy(*ptr);
}
}
std::unique_ptr<vespalib::eval::Value> empty;
diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp
index 96049375180..e0b21290284 100644
--- a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp
@@ -7,13 +7,14 @@
#include <vespa/vespalib/data/slime/cursor.h>
#include <vespa/vespalib/data/slime/inserter.h>
#include <vespa/vespalib/util/rcuvector.hpp>
-#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/fast_value.h>
+#include <vespa/eval/eval/value_codec.h>
#include <vespa/eval/eval/tensor_spec.h>
#include <vespa/eval/eval/value.h>
using document::TensorDataType;
using document::WrongTensorTypeException;
-using vespalib::eval::EngineOrFactory;
+using vespalib::eval::FastValueBuilderFactory;
using vespalib::eval::TensorSpec;
using vespalib::eval::Value;
using vespalib::eval::ValueType;
@@ -31,9 +32,9 @@ constexpr size_t DEAD_SLACK = 0x10000u;
Value::UP
createEmptyTensor(const ValueType &type)
{
- auto engine = EngineOrFactory::get();
+ const auto &factory = FastValueBuilderFactory::get();
TensorSpec empty_spec(type.to_spec());
- return engine.from_spec(empty_spec);
+ return vespalib::eval::value_from_spec(empty_spec, factory);
}
vespalib::string makeWrongTensorTypeMsg(const ValueType &fieldTensorType, const ValueType &tensorType)
@@ -183,7 +184,7 @@ TensorAttribute::populate_state(vespalib::slime::Cursor& object) const
vespalib::eval::Value::UP
TensorAttribute::getEmptyTensor() const
{
- return EngineOrFactory::get().copy(*_emptyTensor);
+ return FastValueBuilderFactory::get().copy(*_emptyTensor);
}
vespalib::eval::TypedCells
diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_deserialize.cpp b/searchlib/src/vespa/searchlib/tensor/tensor_deserialize.cpp
index 35be27bc03b..4fddd092451 100644
--- a/searchlib/src/vespa/searchlib/tensor/tensor_deserialize.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/tensor_deserialize.cpp
@@ -2,18 +2,19 @@
#include "tensor_deserialize.h"
#include <vespa/document/util/serializableexceptions.h>
-#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/fast_value.h>
+#include <vespa/eval/eval/value_codec.h>
#include <vespa/eval/eval/value.h>
using document::DeserializeException;
-using vespalib::eval::EngineOrFactory;
+using vespalib::eval::FastValueBuilderFactory;
using vespalib::eval::Value;
namespace search::tensor {
std::unique_ptr<Value> deserialize_tensor(vespalib::nbostream &buffer)
{
- auto tensor = EngineOrFactory::get().decode(buffer);
+ auto tensor = vespalib::eval::decode_value(buffer, FastValueBuilderFactory::get());
if (buffer.size() != 0) {
throw DeserializeException("Leftover bytes deserializing tensor attribute value.", VESPA_STRLOC);
}