From 15fe399eff5ade4ea12dded37c28ec4629899015 Mon Sep 17 00:00:00 2001 From: HÃ¥vard Pettersen Date: Fri, 4 Dec 2020 10:55:28 +0000 Subject: remove EngineOrFactory --- searchlib/src/vespa/searchlib/attribute/createsinglestd.cpp | 6 ++---- .../src/vespa/searchlib/features/constant_tensor_executor.h | 7 ++++--- searchlib/src/vespa/searchlib/features/dotproductfeature.cpp | 7 ++++--- searchlib/src/vespa/searchlib/features/queryfeature.cpp | 4 +++- searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h | 5 +++-- .../src/vespa/searchlib/tensor/direct_tensor_attribute.cpp | 8 ++++---- searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp | 11 ++++++----- searchlib/src/vespa/searchlib/tensor/tensor_deserialize.cpp | 7 ++++--- 8 files changed, 30 insertions(+), 25 deletions(-) (limited to 'searchlib') 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 +#include #include #include #include @@ -47,10 +47,8 @@ AttributeFactory::createSingleStd(stringref name, const Config & info) case BasicType::TENSOR: if (info.tensorType().is_dense()) { return std::make_shared(name, info); - } else if (vespalib::eval::EngineOrFactory::get().is_factory()) { - return std::make_shared(name, info); } else { - return std::make_shared(name, info); + return std::make_shared(name, info); } case BasicType::REFERENCE: return std::make_shared(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 #include #include -#include +#include +#include #include namespace search::features { @@ -31,9 +32,9 @@ public: return stash.create(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(engine.from_spec(spec)); + return stash.create(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 #include #include -#include +#include +#include #include #include @@ -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 ArrayParam::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>(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 #include #include +#include +#include #include #include @@ -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 #include -#include +#include +#include #include #include #include @@ -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 +#include #include #include #include @@ -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 @@ -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 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 #include #include -#include +#include +#include #include #include 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 -#include +#include +#include #include using document::DeserializeException; -using vespalib::eval::EngineOrFactory; +using vespalib::eval::FastValueBuilderFactory; using vespalib::eval::Value; namespace search::tensor { std::unique_ptr 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); } -- cgit v1.2.3