summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne H Juul <arnej27959@users.noreply.github.com>2021-03-08 23:09:18 +0100
committerGitHub <noreply@github.com>2021-03-08 23:09:18 +0100
commitb4e22c76e21d9a87811b3ab954ded26b4e0aa705 (patch)
tree284230f48c9c8062736ca1d8a54cff763888f1c1
parent396733d1eebdc920e1c312927064116fd7f727f3 (diff)
parent27f38c6ed9ea29286881e1468e52e106256f2c2e (diff)
Merge pull request #16838 from vespa-engine/arnej/more-result-type-rewiring
Arnej/more result type rewiring
-rw-r--r--eval/src/vespa/eval/eval/tensor_function.cpp2
-rw-r--r--eval/src/vespa/eval/instruction/generic_concat.cpp9
-rw-r--r--eval/src/vespa/eval/instruction/generic_join.cpp4
-rw-r--r--eval/src/vespa/eval/instruction/generic_join.h5
-rw-r--r--eval/src/vespa/eval/instruction/generic_lambda.cpp4
-rw-r--r--eval/src/vespa/eval/instruction/generic_lambda.h3
-rw-r--r--eval/src/vespa/eval/instruction/generic_merge.cpp4
-rw-r--r--eval/src/vespa/eval/instruction/generic_merge.h5
-rw-r--r--eval/src/vespa/eval/instruction/generic_peek.cpp6
-rw-r--r--eval/src/vespa/eval/instruction/sparse_full_overlap_join_function.cpp4
-rw-r--r--eval/src/vespa/eval/instruction/sparse_merge_function.cpp3
-rw-r--r--eval/src/vespa/eval/instruction/sparse_no_overlap_join_function.cpp4
12 files changed, 29 insertions, 24 deletions
diff --git a/eval/src/vespa/eval/eval/tensor_function.cpp b/eval/src/vespa/eval/eval/tensor_function.cpp
index 5b8a99d25a0..fd8b20bfed0 100644
--- a/eval/src/vespa/eval/eval/tensor_function.cpp
+++ b/eval/src/vespa/eval/eval/tensor_function.cpp
@@ -316,7 +316,7 @@ Lambda::create_spec_impl(const ValueType &type, const LazyParams &params, const
InterpretedFunction::Instruction
Lambda::compile_self(const ValueBuilderFactory &factory, Stash &stash) const
{
- return instruction::GenericLambda::make_instruction(result_type(), *this, factory, stash);
+ return instruction::GenericLambda::make_instruction(*this, factory, stash);
}
void
diff --git a/eval/src/vespa/eval/instruction/generic_concat.cpp b/eval/src/vespa/eval/instruction/generic_concat.cpp
index c878d099c5e..61f736d43d2 100644
--- a/eval/src/vespa/eval/instruction/generic_concat.cpp
+++ b/eval/src/vespa/eval/instruction/generic_concat.cpp
@@ -26,9 +26,10 @@ struct ConcatParam
DenseConcatPlan dense_plan;
const ValueBuilderFactory &factory;
- ConcatParam(const ValueType &lhs_type, const ValueType &rhs_type,
+ ConcatParam(const ValueType &res_type_in,
+ const ValueType &lhs_type, const ValueType &rhs_type,
const vespalib::string &dimension, const ValueBuilderFactory &factory_in)
- : res_type(ValueType::concat(lhs_type, rhs_type, dimension)),
+ : res_type(res_type_in),
sparse_plan(lhs_type, rhs_type),
dense_plan(lhs_type, rhs_type, dimension, res_type),
factory(factory_in)
@@ -243,8 +244,8 @@ GenericConcat::make_instruction(const ValueType &result_type,
const vespalib::string &dimension,
const ValueBuilderFactory &factory, Stash &stash)
{
- auto &param = stash.create<ConcatParam>(lhs_type, rhs_type, dimension, factory);
- assert(result_type == param.res_type);
+ auto &param = stash.create<ConcatParam>(result_type, lhs_type, rhs_type, dimension, factory);
+ assert(result_type == ValueType::concat(lhs_type, rhs_type, dimension));
auto fun = typify_invoke<3,TypifyCellType,SelectGenericConcatOp>(
lhs_type.cell_type(), rhs_type.cell_type(), param.res_type.cell_type(),
param);
diff --git a/eval/src/vespa/eval/instruction/generic_join.cpp b/eval/src/vespa/eval/instruction/generic_join.cpp
index 4d528057f6f..ec84f664f65 100644
--- a/eval/src/vespa/eval/instruction/generic_join.cpp
+++ b/eval/src/vespa/eval/instruction/generic_join.cpp
@@ -294,8 +294,8 @@ GenericJoin::make_instruction(const ValueType &result_type,
const ValueType &lhs_type, const ValueType &rhs_type, join_fun_t function,
const ValueBuilderFactory &factory, Stash &stash)
{
- auto &param = stash.create<JoinParam>(lhs_type, rhs_type, function, factory);
- assert(result_type == param.res_type);
+ auto &param = stash.create<JoinParam>(result_type, lhs_type, rhs_type, function, factory);
+ assert(result_type == ValueType::join(lhs_type, rhs_type));
auto fun = typify_invoke<4,JoinTypify,SelectGenericJoinOp>(lhs_type.cell_type(), rhs_type.cell_type(), param.res_type.cell_type(), function, param);
return Instruction(fun, wrap_param<JoinParam>(param));
}
diff --git a/eval/src/vespa/eval/instruction/generic_join.h b/eval/src/vespa/eval/instruction/generic_join.h
index 6ac2472ea2a..80a1179e0d5 100644
--- a/eval/src/vespa/eval/instruction/generic_join.h
+++ b/eval/src/vespa/eval/instruction/generic_join.h
@@ -98,9 +98,10 @@ struct JoinParam {
DenseJoinPlan dense_plan;
join_fun_t function;
const ValueBuilderFactory &factory;
- JoinParam(const ValueType &lhs_type, const ValueType &rhs_type,
+ JoinParam(const ValueType &res_type_in,
+ const ValueType &lhs_type, const ValueType &rhs_type,
join_fun_t function_in, const ValueBuilderFactory &factory_in)
- : res_type(ValueType::join(lhs_type, rhs_type)),
+ : res_type(res_type_in),
sparse_plan(lhs_type, rhs_type),
dense_plan(lhs_type, rhs_type),
function(function_in),
diff --git a/eval/src/vespa/eval/instruction/generic_lambda.cpp b/eval/src/vespa/eval/instruction/generic_lambda.cpp
index 19d98773aa6..2b0d6a18035 100644
--- a/eval/src/vespa/eval/instruction/generic_lambda.cpp
+++ b/eval/src/vespa/eval/instruction/generic_lambda.cpp
@@ -121,10 +121,10 @@ struct MyInterpretedLambdaOp {
} // namespace <unnamed>
Instruction
-GenericLambda::make_instruction(const ValueType &result_type,
- const tensor_function::Lambda &lambda_in,
+GenericLambda::make_instruction(const tensor_function::Lambda &lambda_in,
const ValueBuilderFactory &factory, Stash &stash)
{
+ const ValueType & result_type = lambda_in.result_type();
assert(result_type.count_mapped_dimensions() == 0);
if (!CompiledFunction::detect_issues(lambda_in.lambda()) &&
lambda_in.types().all_types_are_double())
diff --git a/eval/src/vespa/eval/instruction/generic_lambda.h b/eval/src/vespa/eval/instruction/generic_lambda.h
index eef09c9d79f..a5f4c10e214 100644
--- a/eval/src/vespa/eval/instruction/generic_lambda.h
+++ b/eval/src/vespa/eval/instruction/generic_lambda.h
@@ -10,8 +10,7 @@ namespace vespalib::eval::instruction {
struct GenericLambda {
static InterpretedFunction::Instruction
- make_instruction(const ValueType &result_type,
- const tensor_function::Lambda &lambda_in,
+ make_instruction(const tensor_function::Lambda &lambda_in,
const ValueBuilderFactory &factory, Stash &stash);
};
diff --git a/eval/src/vespa/eval/instruction/generic_merge.cpp b/eval/src/vespa/eval/instruction/generic_merge.cpp
index 0ab6bdab67b..218746d492a 100644
--- a/eval/src/vespa/eval/instruction/generic_merge.cpp
+++ b/eval/src/vespa/eval/instruction/generic_merge.cpp
@@ -106,8 +106,8 @@ GenericMerge::make_instruction(const ValueType &result_type,
const ValueType &lhs_type, const ValueType &rhs_type, join_fun_t function,
const ValueBuilderFactory &factory, Stash &stash)
{
- const auto &param = stash.create<MergeParam>(lhs_type, rhs_type, function, factory);
- assert(result_type == param.res_type);
+ const auto &param = stash.create<MergeParam>(result_type, lhs_type, rhs_type, function, factory);
+ assert(result_type == ValueType::merge(lhs_type, rhs_type));
auto fun = typify_invoke<4,MergeTypify,SelectGenericMergeOp>(lhs_type.cell_type(), rhs_type.cell_type(), param.res_type.cell_type(), function);
return Instruction(fun, wrap_param<MergeParam>(param));
}
diff --git a/eval/src/vespa/eval/instruction/generic_merge.h b/eval/src/vespa/eval/instruction/generic_merge.h
index 448223df69f..4f06e4259fc 100644
--- a/eval/src/vespa/eval/instruction/generic_merge.h
+++ b/eval/src/vespa/eval/instruction/generic_merge.h
@@ -13,9 +13,10 @@ struct MergeParam {
const size_t dense_subspace_size;
SmallVector<size_t> all_view_dims;
const ValueBuilderFactory &factory;
- MergeParam(const ValueType &lhs_type, const ValueType &rhs_type,
+ MergeParam(const ValueType &res_type_in,
+ const ValueType &lhs_type, const ValueType &rhs_type,
join_fun_t function_in, const ValueBuilderFactory &factory_in)
- : res_type(ValueType::merge(lhs_type, rhs_type)),
+ : res_type(res_type_in),
function(function_in),
num_mapped_dimensions(lhs_type.count_mapped_dimensions()),
dense_subspace_size(lhs_type.dense_subspace_size()),
diff --git a/eval/src/vespa/eval/instruction/generic_peek.cpp b/eval/src/vespa/eval/instruction/generic_peek.cpp
index 4658b20e79d..c8198526b3d 100644
--- a/eval/src/vespa/eval/instruction/generic_peek.cpp
+++ b/eval/src/vespa/eval/instruction/generic_peek.cpp
@@ -274,8 +274,8 @@ struct PeekParam {
size_t num_children;
const ValueBuilderFactory &factory;
- PeekParam(const ValueType &input_type,
- const ValueType &res_type_in,
+ PeekParam(const ValueType &res_type_in,
+ const ValueType &input_type,
const GenericPeek::SpecMap &spec_in,
const ValueBuilderFactory &factory_in)
: res_type(res_type_in),
@@ -362,7 +362,7 @@ GenericPeek::make_instruction(const ValueType &result_type,
const ValueBuilderFactory &factory,
Stash &stash)
{
- const auto &param = stash.create<PeekParam>(input_type, result_type, spec, factory);
+ const auto &param = stash.create<PeekParam>(result_type, input_type, spec, factory);
auto fun = typify_invoke<2,TypifyCellType,SelectGenericPeekOp>(input_type.cell_type(), result_type.cell_type());
return Instruction(fun, wrap_param<PeekParam>(param));
}
diff --git a/eval/src/vespa/eval/instruction/sparse_full_overlap_join_function.cpp b/eval/src/vespa/eval/instruction/sparse_full_overlap_join_function.cpp
index 480af3315b1..85ccfd69871 100644
--- a/eval/src/vespa/eval/instruction/sparse_full_overlap_join_function.cpp
+++ b/eval/src/vespa/eval/instruction/sparse_full_overlap_join_function.cpp
@@ -96,8 +96,8 @@ SparseFullOverlapJoinFunction::SparseFullOverlapJoinFunction(const tensor_functi
InterpretedFunction::Instruction
SparseFullOverlapJoinFunction::compile_self(const ValueBuilderFactory &factory, Stash &stash) const
{
- const auto &param = stash.create<JoinParam>(lhs().result_type(), rhs().result_type(), function(), factory);
- assert(param.res_type == result_type());
+ const auto &param = stash.create<JoinParam>(result_type(), lhs().result_type(), rhs().result_type(), function(), factory);
+ assert(result_type() == ValueType::join(lhs().result_type(), rhs().result_type()));
bool single_dim = (result_type().count_mapped_dimensions() == 1);
auto op = typify_invoke<3,MyTypify,SelectSparseFullOverlapJoinOp>(result_type().cell_type(), function(), single_dim);
return InterpretedFunction::Instruction(op, wrap_param<JoinParam>(param));
diff --git a/eval/src/vespa/eval/instruction/sparse_merge_function.cpp b/eval/src/vespa/eval/instruction/sparse_merge_function.cpp
index 924c4d69fe9..16f1496d8f5 100644
--- a/eval/src/vespa/eval/instruction/sparse_merge_function.cpp
+++ b/eval/src/vespa/eval/instruction/sparse_merge_function.cpp
@@ -107,7 +107,8 @@ SparseMergeFunction::SparseMergeFunction(const tensor_function::Merge &original)
InterpretedFunction::Instruction
SparseMergeFunction::compile_self(const ValueBuilderFactory &factory, Stash &stash) const
{
- const auto &param = stash.create<MergeParam>(lhs().result_type(), rhs().result_type(),
+ const auto &param = stash.create<MergeParam>(result_type(),
+ lhs().result_type(), rhs().result_type(),
function(), factory);
size_t num_dims = result_type().count_mapped_dimensions();
auto op = typify_invoke<3,MyTypify,SelectSparseMergeOp>(result_type().cell_type(),
diff --git a/eval/src/vespa/eval/instruction/sparse_no_overlap_join_function.cpp b/eval/src/vespa/eval/instruction/sparse_no_overlap_join_function.cpp
index c2f89c5558e..e8e0bc212e0 100644
--- a/eval/src/vespa/eval/instruction/sparse_no_overlap_join_function.cpp
+++ b/eval/src/vespa/eval/instruction/sparse_no_overlap_join_function.cpp
@@ -102,7 +102,9 @@ SparseNoOverlapJoinFunction::SparseNoOverlapJoinFunction(const tensor_function::
InterpretedFunction::Instruction
SparseNoOverlapJoinFunction::compile_self(const ValueBuilderFactory &factory, Stash &stash) const
{
- const auto &param = stash.create<JoinParam>(lhs().result_type(), rhs().result_type(), function(), factory);
+ const auto &param = stash.create<JoinParam>(result_type(),
+ lhs().result_type(), rhs().result_type(),
+ function(), factory);
auto op = typify_invoke<2,MyTypify,SelectSparseNoOverlapJoinOp>(result_type().cell_type(), function());
return InterpretedFunction::Instruction(op, wrap_param<JoinParam>(param));
}