diff options
8 files changed, 66 insertions, 9 deletions
diff --git a/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java b/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java index 06d867e90c8..8f3754911a5 100644 --- a/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java +++ b/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java @@ -95,6 +95,9 @@ public interface ModelContext { // TODO Remove on 7.XXX when this is default on. boolean useDirectStorageApiRpc(); + // TODO Remove on 7.XXX when this is default on. + boolean useFastValueTensorImplementation(); + // TODO(bjorncs) Temporary feature flag default String proxyProtocol() { return "https+proxy-protocol"; } diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java index 2c6608c37ad..00c5f6e326f 100644 --- a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java +++ b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java @@ -38,6 +38,7 @@ public class TestProperties implements ModelContext.Properties { private boolean useContentNodeBtreeDb = false; private boolean useThreePhaseUpdates = false; private boolean useDirectStorageApiRpc = false; + private boolean useFastValueTensorImplementation = false; private boolean tlsUseFSync = false; private String tlsCompressionType = "NONE"; private double defaultTermwiseLimit = 1.0; @@ -79,6 +80,7 @@ public class TestProperties implements ModelContext.Properties { @Override public boolean useContentNodeBtreeDb() { return useContentNodeBtreeDb; } @Override public boolean useThreePhaseUpdates() { return useThreePhaseUpdates; } @Override public boolean useDirectStorageApiRpc() { return useDirectStorageApiRpc; } + @Override public boolean useFastValueTensorImplementation() { return useFastValueTensorImplementation; } @Override public Optional<AthenzDomain> athenzDomain() { return Optional.ofNullable(athenzDomain); } @Override public Optional<ApplicationRoles> applicationRoles() { return Optional.ofNullable(applicationRoles); } @Override public String responseSequencerType() { return responseSequencerType; } @@ -128,6 +130,11 @@ public class TestProperties implements ModelContext.Properties { return this; } + public TestProperties setUseFastValueTensorImplementation(boolean useFastValueTensorImplementation) { + this.useFastValueTensorImplementation = useFastValueTensorImplementation; + return this; + } + public TestProperties setThreadPoolSizeFactor(double threadPoolSizeFactor) { this.threadPoolSizeFactor = threadPoolSizeFactor; return this; diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java index 2198b6e278b..2c158e89ff7 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java @@ -263,7 +263,7 @@ public class ContentSearchCluster extends AbstractConfigProducer implements Prot TransactionLogServer tls; Optional<Tuning> tuning = Optional.ofNullable(this.tuning); if (element == null) { - searchNode = SearchNode.create(parent, "" + node.getDistributionKey(), node.getDistributionKey(), spec, + searchNode = SearchNode.create(deployState.getProperties(), parent, "" + node.getDistributionKey(), node.getDistributionKey(), spec, clusterName, node, flushOnShutdown, tuning, resourceLimits, parentGroup.isHosted(), combined); searchNode.setHostResource(node.getHostResource()); searchNode.initService(deployState.getDeployLogger()); diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java b/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java index 534bab4677c..51393cf51cf 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java @@ -2,6 +2,8 @@ package com.yahoo.vespa.model.search; import com.yahoo.cloud.config.filedistribution.FiledistributorrpcConfig; +import com.yahoo.config.model.api.Model; +import com.yahoo.config.model.api.ModelContext; import com.yahoo.config.model.deploy.DeployState; import com.yahoo.config.model.producer.AbstractConfigProducer; import com.yahoo.metrics.MetricsmanagerConfig; @@ -67,6 +69,7 @@ public class SearchNode extends AbstractService implements private AbstractService serviceLayerService; private final Optional<Tuning> tuning; private final Optional<ResourceLimits> resourceLimits; + private final boolean useFastValueTensorImplementation; /** Whether this search node is co-located with a container node on a hosted system */ private final boolean combined; @@ -97,31 +100,31 @@ public class SearchNode extends AbstractService implements @Override protected SearchNode doBuild(DeployState deployState, AbstractConfigProducer ancestor, Element producerSpec) { - return new SearchNode(ancestor, name, contentNode.getDistributionKey(), nodeSpec, clusterName, contentNode, + return new SearchNode(deployState.getProperties(), ancestor, name, contentNode.getDistributionKey(), nodeSpec, clusterName, contentNode, flushOnShutdown, tuning, resourceLimits, deployState.isHosted(), combined); } } - public static SearchNode create(AbstractConfigProducer parent, String name, int distributionKey, NodeSpec nodeSpec, + public static SearchNode create(ModelContext.Properties props, AbstractConfigProducer parent, String name, int distributionKey, NodeSpec nodeSpec, String clusterName, AbstractService serviceLayerService, boolean flushOnShutdown, Optional<Tuning> tuning, Optional<ResourceLimits> resourceLimits, boolean isHostedVespa, boolean combined) { - return new SearchNode(parent, name, distributionKey, nodeSpec, clusterName, serviceLayerService, + return new SearchNode(props, parent, name, distributionKey, nodeSpec, clusterName, serviceLayerService, flushOnShutdown, tuning, resourceLimits, isHostedVespa, combined); } - private SearchNode(AbstractConfigProducer parent, String name, int distributionKey, NodeSpec nodeSpec, + private SearchNode(ModelContext.Properties props, AbstractConfigProducer parent, String name, int distributionKey, NodeSpec nodeSpec, String clusterName, AbstractService serviceLayerService, boolean flushOnShutdown, Optional<Tuning> tuning, Optional<ResourceLimits> resourceLimits, boolean isHostedVespa, boolean combined) { - this(parent, name, nodeSpec, clusterName, flushOnShutdown, tuning, resourceLimits, isHostedVespa, combined); + this(props, parent, name, nodeSpec, clusterName, flushOnShutdown, tuning, resourceLimits, isHostedVespa, combined); this.distributionKey = distributionKey; this.serviceLayerService = serviceLayerService; setPropertiesElastic(clusterName, distributionKey); } - private SearchNode(AbstractConfigProducer parent, String name, NodeSpec nodeSpec, String clusterName, + private SearchNode(ModelContext.Properties props, AbstractConfigProducer parent, String name, NodeSpec nodeSpec, String clusterName, boolean flushOnShutdown, Optional<Tuning> tuning, Optional<ResourceLimits> resourceLimits, boolean isHostedVespa, boolean combined) { super(parent, name); @@ -139,6 +142,7 @@ public class SearchNode extends AbstractService implements // Properties are set in DomSearchBuilder this.tuning = tuning; this.resourceLimits = resourceLimits; + this.useFastValueTensorImplementation = props.useFastValueTensorImplementation(); } private void setPropertiesElastic(String clusterName, int distributionKey) { @@ -293,6 +297,9 @@ public class SearchNode extends AbstractService implements tuning.ifPresent(t -> t.getConfig(builder)); resourceLimits.ifPresent(l -> l.getConfig(builder)); } + if (useFastValueTensorImplementation) { + builder.tensor_implementation(ProtonConfig.Tensor_implementation.FAST_VALUE); + } } @Override diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java index 61f5ec56bb4..2ec82697f23 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java @@ -30,6 +30,7 @@ import com.yahoo.vespa.model.content.utils.ContentClusterUtils; import com.yahoo.vespa.model.content.utils.SchemaBuilder; import com.yahoo.vespa.model.routing.DocumentProtocol; import com.yahoo.vespa.model.routing.Routing; +import com.yahoo.vespa.model.search.SearchNode; import com.yahoo.vespa.model.test.utils.ApplicationPackageUtils; import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg; import org.junit.Rule; @@ -1008,4 +1009,29 @@ public class ContentClusterTest extends ContentBaseTest { assertDirectStorageApiRpcFlagIsPropagatedToConfig(true); } + + @Test + public void use_fast_value_tensor_implementation_config_is_controlled_by_properties() { + assertUseFastValueTensorImplementationFlagIsPropagatedToConfig(false); + assertUseFastValueTensorImplementationFlagIsPropagatedToConfig(true); + } + + void assertUseFastValueTensorImplementationFlagIsPropagatedToConfig(boolean useFastValueTensorImplementation) { + VespaModel model = createEnd2EndOneNode(new TestProperties().setUseFastValueTensorImplementation(useFastValueTensorImplementation)); + ContentCluster cc = model.getContentClusters().get("storage"); + var node = cc.getSearch().getSearchNodes().get(0); + if (useFastValueTensorImplementation) { + assertTensorImplementationConfig(ProtonConfig.Tensor_implementation.FAST_VALUE, node); + } else { + assertTensorImplementationConfig(ProtonConfig.Tensor_implementation.TENSOR_ENGINE, node); + } + } + + void assertTensorImplementationConfig(ProtonConfig.Tensor_implementation.Enum exp, SearchNode node) { + var builder = new ProtonConfig.Builder(); + node.getConfig(builder); + var config = new ProtonConfig(builder); + assertEquals(exp, config.tensor_implementation()); + } + } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchNodeTest.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchNodeTest.java index a04a4f196cf..5b44ece1755 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchNodeTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchNodeTest.java @@ -51,9 +51,9 @@ public class SearchNodeTest { root.freezeModelTopology(); } - private static SearchNode createSearchNode(AbstractConfigProducer parent, String name, int distributionKey, + private static SearchNode createSearchNode(MockRoot root, String name, int distributionKey, NodeSpec nodeSpec, boolean flushOnShutDown, boolean isHosted, boolean combined) { - return SearchNode.create(parent, name, distributionKey, nodeSpec, "mycluster", null, flushOnShutDown, Optional.empty(), Optional.empty(), isHosted, combined); + return SearchNode.create(root.getDeployState().getProperties(), root, name, distributionKey, nodeSpec, "mycluster", null, flushOnShutDown, Optional.empty(), Optional.empty(), isHosted, combined); } private static SearchNode createSearchNode(MockRoot root) { diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java index 3fe90fc54a0..7a55106f866 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java @@ -150,6 +150,7 @@ public class ModelContextImpl implements ModelContext { private final boolean useContentNodeBtreeDb; private final boolean useThreePhaseUpdates; private final boolean useDirectStorageApiRpc; + private final boolean useFastValueTensorImplementation; private final Optional<EndpointCertificateSecrets> endpointCertificateSecrets; private final double defaultTermwiseLimit; private final double threadPoolSizeFactor; @@ -207,6 +208,8 @@ public class ModelContextImpl implements ModelContext { .with(FetchVector.Dimension.APPLICATION_ID, applicationId.serializedForm()).value(); useDirectStorageApiRpc = Flags.USE_DIRECT_STORAGE_API_RPC.bindTo(flagSource) .with(FetchVector.Dimension.APPLICATION_ID, applicationId.serializedForm()).value(); + useFastValueTensorImplementation = Flags.USE_FAST_VALUE_TENSOR_IMPLEMENTATION.bindTo(flagSource) + .with(FetchVector.Dimension.APPLICATION_ID, applicationId.serializedForm()).value(); threadPoolSizeFactor = Flags.DEFAULT_THREADPOOL_SIZE_FACTOR.bindTo(flagSource) .with(FetchVector.Dimension.APPLICATION_ID, applicationId.serializedForm()).value(); visibilityDelay = Flags.VISIBILITY_DELAY.bindTo(flagSource) @@ -314,6 +317,11 @@ public class ModelContextImpl implements ModelContext { } @Override + public boolean useFastValueTensorImplementation() { + return useFastValueTensorImplementation; + } + + @Override public Optional<AthenzDomain> athenzDomain() { return athenzDomain; } @Override diff --git a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java index 1dce232a49a..7471774314f 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java @@ -196,6 +196,12 @@ public class Flags { "Takes effect at restart of distributor and content node process", ZONE_ID, APPLICATION_ID); + public static final UnboundBooleanFlag USE_FAST_VALUE_TENSOR_IMPLEMENTATION = defineFeatureFlag( + "use-fast-value-tensor-implementation", false, + "Whether to use FastValueBuilderFactory as the tensor implementation on all content nodes.", + "Takes effect at restart of content node process", + ZONE_ID, APPLICATION_ID); + public static final UnboundBooleanFlag HOST_HARDENING = defineFeatureFlag( "host-hardening", false, "Whether to enable host hardening Linux baseline.", |