24 #ifndef VISIONCPP_INCLUDE_FRAMEWORK_EXECUTOR_EXECUTOR_SUBEXPR_IF_NEEDED_HPP_
25 #define VISIONCPP_INCLUDE_FRAMEWORK_EXECUTOR_EXECUTOR_SUBEXPR_IF_NEEDED_HPP_
35 template <
size_t LC,
size_t LR,
size_t LCT,
size_t LRT,
size_t LVL,
36 typename Expr,
typename DeviceT>
45 static Type get(Expr &eval_sub,
const DeviceT &dev) {
47 auto intermediate_output = Intermediate_Output();
48 internal::fuse<LC, LR, LCT, LRT>(
50 Intermediate_Output::Type::Cols,
51 Intermediate_Output::Type::Rows,
52 Intermediate_Output::Type::LeafType,
54 (Intermediate_Output::Level > Expr::Level),
56 intermediate_output, eval_sub),
58 return intermediate_output;
66 template <
size_t LC,
size_t LR,
size_t LCT,
size_t LRT,
typename RHS,
67 size_t LVL1,
size_t LVL2,
typename DeviceT>
82 template <
size_t LC,
size_t LR,
size_t LCT,
size_t LRT,
size_t LVL,
83 typename Expr,
typename DeviceT>
91 template <
size_t LC,
size_t LR,
size_t LCT,
size_t LRT,
typename Expr,
95 Expr, DeviceT>::Type {
108 template <
bool ParentConds,
typename Expr,
typename DeviceT>
112 template <
typename Expr,
typename DeviceT>
126 template <
size_t LC,
size_t LR,
size_t LCT,
size_t LRT>
129 internal::fuse<LC, LR, LCT, LRT>(
131 Type, Expr, Type::Type::Cols, Type::Type::Rows,
132 Type::Type::LeafType,
134 Expr>::Type::Level>(lhs, expr),
140 template <
typename Expr,
typename DeviceT>
154 template <
size_t LC,
size_t LR,
size_t LCT,
size_t LRT>
163 template <
bool ParentConds,
typename Expr,
typename DeviceT>
166 template <
size_t LC,
size_t LR,
size_t LCT,
size_t LRT,
typename NestedExpr>
167 static inline auto execute_expr(NestedExpr &nestedExpr,
const DeviceT &dev) ->
169 ParentConds,
typename Expr::template ExprExchange<NestedExpr>, DeviceT>::Type {
170 using NestedType =
typename Expr::template ExprExchange<NestedExpr>;
171 auto res = NestedType(nestedExpr);
174 LC, LR, LCT, LRT>(res, dev);
181 template <
bool ParentConds,
typename Expr,
typename DeviceT>
184 template <
size_t LC,
size_t LR,
size_t LCT,
size_t LRT,
typename NestedExpr>
185 static inline auto execute_expr(NestedExpr &sub_expr,
const DeviceT &dev) ->
188 typename Expr::template ExprExchange<decltype(
189 get_subexpr_executor<LC, LR, LCT, LRT>(sub_expr, dev))>, DeviceT>::Type {
190 auto nested_output = get_subexpr_executor<LC, LR, LCT, LRT>(sub_expr, dev);
192 typename Expr::template ExprExchange<decltype(nested_output)>;
193 auto res = NestedType(nested_output);
195 LC, LR, LCT, LRT>(res, dev);
202 template <
bool ParentConds,
typename Expr,
typename DeviceT>
205 template <
size_t LC,
size_t LR,
size_t LCT,
size_t LRT,
typename LHSExpr,
208 const DeviceT &dev) ->
211 typename Expr::template ExprExchange<LHSExpr, RHSExpr>, DeviceT>::Type {
212 using SubExprType =
typename Expr::template ExprExchange<LHSExpr, RHSExpr>;
213 auto res = SubExprType(lhsExpr, rhsExpr);
215 LC, LR, LCT, LRT>(res, dev);
222 template <
bool ParentConds,
typename Expr,
typename DeviceT>
225 template <
size_t LC,
size_t LR,
size_t LCT,
size_t LRT,
typename LHSExpr,
228 const DeviceT &dev) ->
232 typename Expr::template ExprExchange<
233 decltype(get_subexpr_executor<LC, LR, LCT, LRT>(lhsExpr, dev)),
234 decltype(get_subexpr_executor<LC, LR, LCT, LRT>(rhsExpr,
235 dev))>, DeviceT>::Type {
236 auto lhs_output = get_subexpr_executor<LC, LR, LCT, LRT>(lhsExpr, dev);
237 auto rhs_output = get_subexpr_executor<LC, LR, LCT, LRT>(rhsExpr, dev);
239 typename Expr::template ExprExchange<decltype(lhs_output),
240 decltype(rhs_output)>;
241 auto res = SubExprType(lhs_output, rhs_output);
243 LC, LR, LCT, LRT>(res, dev);
249 template <
bool Conds,
bool ParentConds,
typename Expr,
size_t LC,
size_t LR,
250 size_t LCT,
size_t LRT,
typename NestedExpr,
typename DeviceT>
254 Expr, DeviceT>::
template execute_expr<LC, LR, LCT, LRT>(nestedExpr, dev)) {
257 Expr, DeviceT>::template execute_expr<LC, LR, LCT, LRT>(nestedExpr, dev);
262 template <
bool Conds,
bool ParentConds,
typename Expr,
size_t LC,
size_t LR,
263 size_t LCT,
size_t LRT,
typename LHSExpr,
typename RHSExpr,
265 inline auto execute_expr(LHSExpr lhsExpr, RHSExpr rhsExpr,
const DeviceT &dev)
268 Expr, DeviceT>::
template execute_expr<LC, LR, LCT, LRT>(lhsExpr, rhsExpr, dev)) {
271 Expr, DeviceT>::template execute_expr<LC, LR, LCT, LRT>(lhsExpr, rhsExpr, dev);
static constexpr size_t Unary
static constexpr size_t Binary
auto get_subexpr_executor(Expr &expr, const DeviceT &dev) -> typename internal::SubExprRes< LC, LR, LCT, LRT, LVL, Expr, DeviceT >::Type
template deduction for SubExprRes.
auto execute_expr(NestedExpr nestedExpr, const DeviceT &dev) -> decltype(internal::IfExprExecNeeded< Conds, ParentConds, internal::expr_category::Unary, Expr, DeviceT >::template execute_expr< LC, LR, LCT, LRT >(nestedExpr, dev))
template deduction for IfExprExecNeeded when the expression category is unary
The definition is in Assign file.
static auto execute_expr(NestedExpr &nestedExpr, const DeviceT &dev) -> typename ParentForcedExecute< ParentConds, typename Expr::template ExprExchange< NestedExpr >, DeviceT >::Type
static auto execute_expr(LHSExpr &lhsExpr, RHSExpr &rhsExpr, const DeviceT &dev) -> typename ParentForcedExecute< ParentConds, typename Expr::template ExprExchange< LHSExpr, RHSExpr >, DeviceT >::Type
static auto execute_expr(NestedExpr &sub_expr, const DeviceT &dev) -> typename ParentForcedExecute< ParentConds, typename Expr::template ExprExchange< decltype(get_subexpr_executor< LC, LR, LCT, LRT >(sub_expr, dev))>, DeviceT >::Type
static auto execute_expr(LHSExpr &lhsExpr, RHSExpr &rhsExpr, const DeviceT &dev) -> typename ParentForcedExecute< ParentConds, typename Expr::template ExprExchange< decltype(get_subexpr_executor< LC, LR, LCT, LRT >(lhsExpr, dev)), decltype(get_subexpr_executor< LC, LR, LCT, LRT >(rhsExpr, dev))>, DeviceT >::Type
IfExprExecNeeded is used to decide: 1) the expression should force its children to launch a separate ...
the definition is in LeafNode.
static constexpr size_t Level
static Type forced_exec(Expr &expr, const DeviceT &)
forced_exec here does nothing but return the expression as the parent
static Type forced_exec(Expr &expr, const DeviceT &dev)
forced_exec here executes the expr and return the leafNode template parameters
to check whether or not the parent of the Expr requires that the expr to be executed and the LeafNode...
static Type get(Type &eval_sub, const DeviceT &)
The get function in SubExprRes do nothing but return the leaf node when the input expression type is ...
The definition is in SubExprRes file.
static Type get(Expr &eval_sub, const DeviceT &dev)
The get function in SubExprRes executes the expression and returns a leaf node representing the outpu...