diff options
author | Arne Juul <arnej@verizonmedia.com> | 2021-04-07 10:28:42 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2021-04-07 10:28:42 +0000 |
commit | fa409f3a843f4e5c1c17fbd1bcf5b9e09dfad7f1 (patch) | |
tree | 09fa153ced9fe8760f63e24ca63d33632076710b /eval | |
parent | de080e77a2fd2730e37fcd7c7ae02f9bf36c43c6 (diff) |
inplace -> primary_is_mutable
Diffstat (limited to 'eval')
3 files changed, 13 insertions, 14 deletions
diff --git a/eval/src/tests/instruction/join_with_number/join_with_number_function_test.cpp b/eval/src/tests/instruction/join_with_number/join_with_number_function_test.cpp index 4bdc342b629..4a0eb00e7e7 100644 --- a/eval/src/tests/instruction/join_with_number/join_with_number_function_test.cpp +++ b/eval/src/tests/instruction/join_with_number/join_with_number_function_test.cpp @@ -33,11 +33,12 @@ std::ostream &operator<<(std::ostream &os, Primary primary) struct FunInfo { using LookFor = JoinWithNumberFunction; Primary primary; + bool pri_mut; bool inplace; void verify(const EvalFixture &fixture, const LookFor &fun) const { EXPECT_TRUE(fun.result_is_mutable()); EXPECT_EQUAL(fun.primary(), primary); - EXPECT_EQUAL(fun.inplace(), inplace); + EXPECT_EQUAL(fun.primary_is_mutable(), pri_mut); if (inplace) { size_t idx = (fun.primary() == Primary::LHS) ? 0 : 1; EXPECT_EQUAL(fixture.result_value().cells().data, @@ -46,13 +47,13 @@ struct FunInfo { } }; -void verify_optimized(const vespalib::string &expr, Primary primary, bool inplace) { +void verify_optimized(const vespalib::string &expr, Primary primary, bool pri_mut) { UNWIND_MSG("optimize %s", expr.c_str()); const CellTypeSpace stable_types(CellTypeUtils::list_stable_types(), 2); - FunInfo stable_details{primary, inplace}; + FunInfo stable_details{primary, pri_mut, pri_mut}; TEST_DO(EvalFixture::verify<FunInfo>(expr, {stable_details}, stable_types)); const CellTypeSpace unstable_types(CellTypeUtils::list_unstable_types(), 2); - FunInfo unstable_details{primary, false}; + FunInfo unstable_details{primary, pri_mut, false}; TEST_DO(EvalFixture::verify<FunInfo>(expr, {unstable_details}, unstable_types)); } diff --git a/eval/src/vespa/eval/instruction/join_with_number_function.cpp b/eval/src/vespa/eval/instruction/join_with_number_function.cpp index fbaca49997e..60b3132345d 100644 --- a/eval/src/vespa/eval/instruction/join_with_number_function.cpp +++ b/eval/src/vespa/eval/instruction/join_with_number_function.cpp @@ -54,14 +54,14 @@ void my_number_join_op(State &state, uint64_t param_in) { struct SelectJoinWithNumberOp { template<typename CM, typename Fun, - typename Inplace, typename NumberWasLeft> + typename PrimaryMutable, typename NumberWasLeft> static auto invoke() { constexpr CellMeta icm = CM::value; constexpr CellMeta num(CellType::DOUBLE, true); constexpr CellMeta ocm = CellMeta::join(icm, num); using ICT = CellValueType<icm.cell_type>; using OCT = CellValueType<ocm.cell_type>; - constexpr bool inplace = (Inplace::value && std::is_same_v<ICT,OCT>); + constexpr bool inplace = (PrimaryMutable::value && std::is_same_v<ICT,OCT>); return my_number_join_op<ICT, OCT, Fun, inplace, NumberWasLeft::value>; } }; @@ -78,13 +78,11 @@ JoinWithNumberFunction::JoinWithNumberFunction(const Join &original, bool tensor JoinWithNumberFunction::~JoinWithNumberFunction() = default; bool -JoinWithNumberFunction::inplace() const { +JoinWithNumberFunction::primary_is_mutable() const { if (_primary == Primary::LHS) { - return lhs().result_type() == result_type() - && lhs().result_is_mutable(); + return lhs().result_is_mutable(); } else { - return rhs().result_type() == result_type() - && rhs().result_is_mutable(); + return rhs().result_is_mutable(); } } @@ -98,7 +96,7 @@ JoinWithNumberFunction::compile_self(const ValueBuilderFactory &, Stash &stash) assert(result_type() == input_type.map()); auto op = typify_invoke<4,MyTypify,SelectJoinWithNumberOp>(input_type.cell_meta(), _function, - inplace(), + primary_is_mutable(), (_primary == Primary::RHS)); return Instruction(op, wrap_param<JoinWithNumberParam>(param)); } @@ -108,7 +106,7 @@ JoinWithNumberFunction::visit_self(vespalib::ObjectVisitor &visitor) const { Super::visit_self(visitor); visitor.visitBool("tensor_was_right", (_primary == Primary::RHS)); - visitor.visitBool("is_inplace", inplace()); + visitor.visitBool("primary_is_mutable", primary_is_mutable()); } const TensorFunction & diff --git a/eval/src/vespa/eval/instruction/join_with_number_function.h b/eval/src/vespa/eval/instruction/join_with_number_function.h index 546ff75b175..9d29ad5eb5d 100644 --- a/eval/src/vespa/eval/instruction/join_with_number_function.h +++ b/eval/src/vespa/eval/instruction/join_with_number_function.h @@ -23,7 +23,7 @@ public: JoinWithNumberFunction(const tensor_function::Join &original_join, bool number_on_left); ~JoinWithNumberFunction(); Primary primary() const { return _primary; } - bool inplace() const; + bool primary_is_mutable() const; bool result_is_mutable() const override { return true; } InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override; |