diff options
author | Arne Juul <arnej@verizonmedia.com> | 2021-03-08 11:27:23 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2021-03-08 11:28:07 +0000 |
commit | 9b81685d5e711628e392454b2bc65e391f15f067 (patch) | |
tree | 61f03332bf2ac703b876f95da829aa28ac04a34f /eval | |
parent | a324acb8c5d40c76819da2e0145bac8940e9f749 (diff) |
wire result type into Param structs
* Param structs now have result type as first member
* and constructors take result type as first argument
Diffstat (limited to 'eval')
9 files changed, 25 insertions, 19 deletions
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 ¶m = stash.create<ConcatParam>(lhs_type, rhs_type, dimension, factory); - assert(result_type == param.res_type); + auto ¶m = 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 ¶m = stash.create<JoinParam>(lhs_type, rhs_type, function, factory); - assert(result_type == param.res_type); + auto ¶m = 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_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 ¶m = stash.create<MergeParam>(lhs_type, rhs_type, function, factory); - assert(result_type == param.res_type); + const auto ¶m = 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 ¶m = stash.create<PeekParam>(input_type, result_type, spec, factory); + const auto ¶m = 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 ¶m = stash.create<JoinParam>(lhs().result_type(), rhs().result_type(), function(), factory); - assert(param.res_type == result_type()); + const auto ¶m = 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 ¶m = stash.create<MergeParam>(lhs().result_type(), rhs().result_type(), + const auto ¶m = 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 ¶m = stash.create<JoinParam>(lhs().result_type(), rhs().result_type(), function(), factory); + const auto ¶m = 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)); } |