summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2020-10-14 16:59:11 +0200
committerGitHub <noreply@github.com>2020-10-14 16:59:11 +0200
commit9920cb5846b0dd3e3815b08ffcded77a24e04715 (patch)
tree8d88608296b578635b1dc06f4f1b5ca48d570ef2 /searchcore
parentb25a527dc0706eaadf8960f1e74900c67ea27d4a (diff)
parentaaa26f54453ebead04736f1daec0cd369a380b67 (diff)
Merge pull request #14860 from vespa-engine/geirst/tensor-implementation-proton-config
Add proton config to select which tensor implementation to use for al…
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/config/proton.def7
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton.cpp36
2 files changed, 33 insertions, 10 deletions
diff --git a/searchcore/src/vespa/searchcore/config/proton.def b/searchcore/src/vespa/searchcore/config/proton.def
index bcc35204efd..52a7c9b05a1 100644
--- a/searchcore/src/vespa/searchcore/config/proton.def
+++ b/searchcore/src/vespa/searchcore/config/proton.def
@@ -500,3 +500,10 @@ maintenancejobs.maxoutstandingmoveops int default=10
## Controls the type of bucket checksum used. Do not change unless
## in depth understanding is present.
bucketdb.checksumtype enum {LEGACY, XXHASH64} default = LEGACY restart
+
+## Specifies which tensor implementation to use for all backend code.
+##
+## TENSOR_ENGINE (default) uses DefaultTensorEngine, which has been the production implementation for years.
+## FAST_VALUE uses the new and optimized FastValueBuilderFactory instead.
+## TODO: Remove when default has been switched to FAST_VALUE.
+tensor_implementation enum {TENSOR_ENGINE, FAST_VALUE} default = TENSOR_ENGINE
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
index 5817e729950..85d44506565 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
@@ -14,26 +14,29 @@
#include "searchhandlerproxy.h"
#include "simpleflush.h"
-#include <vespa/searchcore/proton/flushengine/flushengine.h>
+#include <vespa/document/base/exceptions.h>
+#include <vespa/document/datatype/documenttype.h>
+#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/eval/eval/engine_or_factory.h>
+#include <vespa/eval/eval/fast_value.h>
+#include <vespa/eval/tensor/default_tensor_engine.h>
#include <vespa/searchcore/proton/flushengine/flush_engine_explorer.h>
+#include <vespa/searchcore/proton/flushengine/flushengine.h>
#include <vespa/searchcore/proton/flushengine/tls_stats_factory.h>
+#include <vespa/searchcore/proton/matchengine/matchengine.h>
#include <vespa/searchcore/proton/reference/document_db_reference_registry.h>
-#include <vespa/searchcore/proton/summaryengine/summaryengine.h>
#include <vespa/searchcore/proton/summaryengine/docsum_by_slime.h>
-#include <vespa/searchcore/proton/matchengine/matchengine.h>
+#include <vespa/searchcore/proton/summaryengine/summaryengine.h>
+#include <vespa/searchlib/common/packets.h>
#include <vespa/searchlib/transactionlog/trans_log_server_explorer.h>
#include <vespa/searchlib/transactionlog/translogserverapp.h>
#include <vespa/searchlib/util/fileheadertk.h>
-#include <vespa/searchlib/common/packets.h>
-#include <vespa/document/base/exceptions.h>
-#include <vespa/document/datatype/documenttype.h>
-#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/vespalib/io/fileutil.h>
-#include <vespa/vespalib/util/lambdatask.h>
-#include <vespa/vespalib/util/host_name.h>
-#include <vespa/vespalib/util/random.h>
#include <vespa/vespalib/net/state_server.h>
#include <vespa/vespalib/util/blockingthreadstackexecutor.h>
+#include <vespa/vespalib/util/host_name.h>
+#include <vespa/vespalib/util/lambdatask.h>
+#include <vespa/vespalib/util/random.h>
#include <vespa/searchlib/aggregation/forcelink.hpp>
#include <vespa/searchlib/expression/forcelink.hpp>
@@ -54,6 +57,7 @@ using search::transactionlog::DomainStats;
using vespa::config::search::core::ProtonConfig;
using vespa::config::search::core::internal::InternalProtonType;
using vespalib::compression::CompressionConfig;
+using vespalib::eval::EngineOrFactory;
namespace proton {
@@ -71,6 +75,17 @@ convert(InternalProtonType::Packetcompresstype type)
}
void
+set_tensor_implementation(const ProtonConfig& cfg)
+{
+ if (cfg.tensorImplementation == ProtonConfig::TensorImplementation::TENSOR_ENGINE) {
+ EngineOrFactory::set(vespalib::tensor::DefaultTensorEngine::ref());
+ } else if (cfg.tensorImplementation == ProtonConfig::TensorImplementation::FAST_VALUE) {
+ EngineOrFactory::set(vespalib::eval::FastValueBuilderFactory::get());
+ }
+ LOG(info, "Tensor implementation used: %s", EngineOrFactory::get().to_string().c_str());
+}
+
+void
setBucketCheckSumType(const ProtonConfig & proton)
{
switch (proton.bucketdb.checksumtype) {
@@ -254,6 +269,7 @@ Proton::init(const BootstrapConfig::SP & configSnapshot)
const ProtonConfig &protonConfig = configSnapshot->getProtonConfig();
const HwInfo & hwInfo = configSnapshot->getHwInfo();
+ set_tensor_implementation(protonConfig);
setBucketCheckSumType(protonConfig);
setFS4Compression(protonConfig);
_diskMemUsageSampler = std::make_unique<DiskMemUsageSampler>(protonConfig.basedir,