summaryrefslogtreecommitdiffstats
path: root/eval
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-03-15 10:34:55 +0000
committerArne Juul <arnej@verizonmedia.com>2021-03-15 10:35:59 +0000
commitf4c72e99156382a3a0abb230e846f9b055b7ee2a (patch)
tree9d7150e0b1f00e345a9673c9c535889f2dd0bc82 /eval
parent61338b390a89aa9d7c5f9d7c3767e847c5a8a1c8 (diff)
make reduce() and peek() CellMeta member functions
Diffstat (limited to 'eval')
-rw-r--r--eval/src/vespa/eval/eval/cell_type.h9
-rw-r--r--eval/src/vespa/eval/eval/value_type.cpp4
-rw-r--r--eval/src/vespa/eval/instruction/dense_single_reduce_function.cpp2
-rw-r--r--eval/src/vespa/eval/instruction/generic_peek.cpp2
-rw-r--r--eval/src/vespa/eval/instruction/generic_reduce.cpp4
5 files changed, 9 insertions, 12 deletions
diff --git a/eval/src/vespa/eval/eval/cell_type.h b/eval/src/vespa/eval/eval/cell_type.h
index 4eec639478d..57f707c2aa8 100644
--- a/eval/src/vespa/eval/eval/cell_type.h
+++ b/eval/src/vespa/eval/eval/cell_type.h
@@ -121,17 +121,14 @@ struct CellMeta {
// convenience functions to be used for specific operations
constexpr CellMeta map() const { return decay(); }
- static constexpr CellMeta reduce(CellType input_cell_type, bool output_is_scalar) {
- return normalize(input_cell_type, output_is_scalar).decay();
- }
constexpr CellMeta reduce(bool output_is_scalar) const {
- return CellMeta::reduce(cell_type, output_is_scalar);
+ return normalize(cell_type, output_is_scalar).decay();
}
static constexpr CellMeta join(CellMeta a, CellMeta b) { return unify(a, b).decay(); }
static constexpr CellMeta merge(CellMeta a, CellMeta b) { return unify(a, b).decay(); }
static constexpr CellMeta concat(CellMeta a, CellMeta b) { return unify(a, b); }
- static constexpr CellMeta peek(CellType input_cell_type, bool output_is_scalar) {
- return normalize(input_cell_type, output_is_scalar);
+ constexpr CellMeta peek(bool output_is_scalar) const {
+ return normalize(cell_type, output_is_scalar);
}
constexpr CellMeta rename() const { return self(); }
};
diff --git a/eval/src/vespa/eval/eval/value_type.cpp b/eval/src/vespa/eval/eval/value_type.cpp
index fbd04babc70..440aecce76e 100644
--- a/eval/src/vespa/eval/eval/value_type.cpp
+++ b/eval/src/vespa/eval/eval/value_type.cpp
@@ -275,7 +275,7 @@ ValueType
ValueType::reduce(const std::vector<vespalib::string> &dimensions_in) const
{
MyReduce result(_dimensions, dimensions_in);
- auto meta = CellMeta::reduce(_cell_type, result.dimensions.empty());
+ auto meta = cell_meta().reduce(result.dimensions.empty());
return error_if(_error || result.has_error,
make_type(meta.cell_type, std::move(result.dimensions)));
}
@@ -284,7 +284,7 @@ ValueType
ValueType::peek(const std::vector<vespalib::string> &dimensions_in) const
{
MyReduce result(_dimensions, dimensions_in);
- auto meta = CellMeta::peek(_cell_type, result.dimensions.empty());
+ auto meta = cell_meta().peek(result.dimensions.empty());
return error_if(_error || result.has_error || dimensions_in.empty(),
make_type(meta.cell_type, std::move(result.dimensions)));
}
diff --git a/eval/src/vespa/eval/instruction/dense_single_reduce_function.cpp b/eval/src/vespa/eval/instruction/dense_single_reduce_function.cpp
index 014f36eaa2c..87f02f16345 100644
--- a/eval/src/vespa/eval/instruction/dense_single_reduce_function.cpp
+++ b/eval/src/vespa/eval/instruction/dense_single_reduce_function.cpp
@@ -120,7 +120,7 @@ void my_single_reduce_op(InterpretedFunction::State &state, uint64_t param) {
struct MyGetFun {
template <typename ICM, typename AGGR, typename GE8, typename I1> static auto invoke() {
using ICT = CellValueType<ICM::value.cell_type>;
- using OCT = CellValueType<CellMeta::reduce(ICM::value.cell_type, false).cell_type>;
+ using OCT = CellValueType<ICM::value.reduce(false).cell_type>;
using AggrType = typename AGGR::template templ<OCT>;
return my_single_reduce_op<ICT, OCT, AggrType, GE8::value, I1::value>;
}
diff --git a/eval/src/vespa/eval/instruction/generic_peek.cpp b/eval/src/vespa/eval/instruction/generic_peek.cpp
index ae5897257df..da61de33f3a 100644
--- a/eval/src/vespa/eval/instruction/generic_peek.cpp
+++ b/eval/src/vespa/eval/instruction/generic_peek.cpp
@@ -348,7 +348,7 @@ void my_generic_peek_op(State &state, uint64_t param_in) {
struct SelectGenericPeekOp {
template <typename ICM, typename OutIsScalar> static auto invoke() {
using ICT = CellValueType<ICM::value.cell_type>;
- constexpr CellMeta ocm = CellMeta::peek(ICM::value.cell_type, OutIsScalar::value);
+ constexpr CellMeta ocm = ICM::value.peek(OutIsScalar::value);
using OCT = CellValueType<ocm.cell_type>;
return my_generic_peek_op<ICT,OCT>;
}
diff --git a/eval/src/vespa/eval/instruction/generic_reduce.cpp b/eval/src/vespa/eval/instruction/generic_reduce.cpp
index 23e53e9734b..7f48976048c 100644
--- a/eval/src/vespa/eval/instruction/generic_reduce.cpp
+++ b/eval/src/vespa/eval/instruction/generic_reduce.cpp
@@ -191,7 +191,7 @@ void my_full_reduce_op(State &state, uint64_t) {
struct SelectGenericReduceOp {
template <typename ICM, typename OIS, typename AGGR> static auto invoke(const ReduceParam &param) {
using ICT = CellValueType<ICM::value.cell_type>;
- using OCT = CellValueType<CellMeta::reduce(ICM::value.cell_type, OIS::value).cell_type>;
+ using OCT = CellValueType<ICM::value.reduce(OIS::value).cell_type>;
using AggrType = typename AGGR::template templ<OCT>;
if constexpr (OIS::value) {
return my_full_reduce_op<ICT, AggrType>;
@@ -299,7 +299,7 @@ GenericReduce::make_instruction(const ValueType &result_type,
{
auto &param = stash.create<ReduceParam>(input_type, dimensions, factory);
assert(result_type == param.res_type);
- assert(result_type.cell_meta().eq(CellMeta::reduce(input_type.cell_type(), result_type.is_double())));
+ assert(result_type.cell_meta().eq(input_type.cell_meta().reduce(result_type.is_double())));
auto fun = typify_invoke<3,ReduceTypify,SelectGenericReduceOp>(input_type.cell_meta(), result_type.cell_meta().is_scalar, aggr, param);
return Instruction(fun, wrap_param<ReduceParam>(param));
}