VisionCpp  0.0.1
forward_declarations.hpp
Go to the documentation of this file.
1 // This file is part of VisionCpp, a lightweight C++ template library
2 // for computer vision and image processing.
3 //
4 // Copyright (C) 2016 Codeplay Software Limited. All Rights Reserved.
5 //
6 // Contact: visioncpp@codeplay.com
7 //
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 //
12 // http://www.apache.org/licenses/LICENSE-2.0
13 //
14 // Unless required by applicable law or agreed to in writing, software
15 // distributed under the License is distributed on an "AS IS" BASIS,
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 // See the License for the specific language governing permissions and
18 // limitations under the License.
19 
20 /// \file forward_declarations.hpp
21 /// \brief forward declarations for the library
22 
23 #ifndef VISIONCPP_INCLUDE_FRAMEWORK_FORWARD_DECLARATIONS_HPP_
24 #define VISIONCPP_INCLUDE_FRAMEWORK_FORWARD_DECLARATIONS_HPP_
25 
26 /// \brief VisionCpp namespace
27 namespace visioncpp {
28 /// \brief Scope is used to define the scope of the memory on the device
29 namespace scope {
30 using ScopeType = size_t;
31 static constexpr ScopeType Global = 0;
32 static constexpr ScopeType Local = 1;
33 static constexpr ScopeType Constant = 2;
34 static constexpr ScopeType Host_Buffer = 3;
35 }
36 
37 /// \brief defines terminal nodes that can be used
38 namespace memory_type {
39 static constexpr size_t Host = 0;
40 static constexpr size_t Buffer1D = 1;
41 static constexpr size_t Buffer2D = 2;
42 static constexpr size_t Image = 3;
43 static constexpr size_t Const = 4;
44 }
45 
46 /// \brief defines Executor policies available
47 namespace policy {
48 constexpr static bool Fuse = true;
49 constexpr static bool NoFuse = false;
50 }
51 
52 /// \class backend
53 /// \brief enum class that defines supported backends.
54 enum class backend {
55  /// represents sycl backend.
56  sycl,
57  /// number of backends.
58  size
59 };
60 
61 /// \class device
62 /// \brief enum class that defines supported devices types.
63 enum class device {
64  /// represents the cpu device.
65  cpu,
66  /// represents the gpu device.
67  gpu,
68  /// represents the host device.
69  host,
70  /// number of devices
71  size
72 };
73 
74 /// \brief Internal implementations. Items from this scope should not be exposed
75 /// to the end user.
76 namespace internal {
77 /// \class Device_
78 /// class used to implement the execution of the expression tree.
79 /// \tparam BK is used to determine the backend
80 /// \tparam DV is used to determine the selected device for that backend
81 template <backend BK, device DV>
82 class Device_;
83 }
84 
85 /// \brief template deduction function for Device_ class
86 /// \tparam BK is used to determine the backend
87 /// \tparam DV is used to determine the selected device for that backend
88 /// \return Device_
89 template <backend BK, device DV>
92 }
93 
94 template <bool ExecPolicy, typename Expr, typename DeviceT>
95 void execute(Expr &, DeviceT &);
96 
97 template <bool ExecPolicy, size_t LC, size_t LR, size_t LCT, size_t LRT,
98  typename Expr, typename DeviceT>
99 void execute(Expr &, const DeviceT &);
100 
101 namespace internal {
102 /// \brief this is used to define the type of nodes in an expression tree
103 namespace expr_category {
104 static constexpr size_t Nullary = 0;
105 static constexpr size_t Unary = 1;
106 static constexpr size_t Binary = 2;
107 };
108 
109 /// \brief list of supported types of operations
110 /// the operation type can be Point operation, neighbour operation
111 namespace ops_category {
112 constexpr static size_t PointOP = 0;
113 constexpr static size_t NeighbourOP = 1;
114 constexpr static size_t GlobalNeighbourOP = 2;
115 };
116 
117 /// \brief the definition is in \ref VirtualMemory
118 template <bool PlcType, typename Node, size_t LC = 8, size_t LR = 8,
119  size_t LCT = 8, size_t LRT = 8>
120 struct VirtualMemory;
121 
122 /// \brief the definition is in \ref LeafNode.
123 template <typename RHS, size_t LVL>
124 struct LeafNode;
125 
126 /// \brief The definition is in \ref RUnOP file.
127 template <typename UN_OP, typename RHS, size_t Cols, size_t Rows, size_t LfType,
128  size_t LVL>
129 struct RUnOP;
130 
131 /// \brief The definition is in \ref RBiOP file.
132 template <typename BI_OP, typename LHS, typename RHS, size_t Cols, size_t Rows,
133  size_t LfType, size_t LVL>
134 struct RBiOP;
135 
136 /// \brief The definition is in \ref StnFilt file.
137 template <typename FilterOP, size_t Halo_T, size_t Halo_L, size_t Halo_B,
138  size_t Halo_R, typename LHS, typename RHS, size_t Cols, size_t Rows,
139  size_t LfType, size_t LVL>
140 struct StnFilt;
141 
142 /// \brief The definition is in \ref StnNoFilt file.
143 template <typename FilterOP, size_t Halo_T, size_t Halo_L, size_t Halo_B,
144  size_t Halo_R, typename RHS, size_t Cols, size_t Rows, size_t LfType,
145  size_t LVL>
146 struct StnNoFilt;
147 
148 /// \brief The definition is in \ref RDCN file.
149 template <typename DownSmplOP, typename RHS, size_t Cols, size_t Rows,
150  size_t LfType, size_t LVL>
151 struct RDCN;
152 /// \brief The definition is in \ref ParallelCopy file.
153 template <typename LHS, typename RHS, size_t Cols, size_t Rows,
154  size_t OffsetColIn, size_t OffsetRowIn, size_t OffsetColOut,
155  size_t OffsetRowOut, size_t LfType, size_t LVL>
156 struct ParallelCopy;
157 
158 /// \brief The definition is in \ref Assign file.
159 template <typename LHS, typename RHS, size_t Cols, size_t Rows, size_t LfType,
160  size_t LVL>
161 struct Assign;
162 
163 /// \brief The definition is in \ref SubExprRes file.
164 template <size_t LC, size_t LR, size_t LCT, size_t LRT, size_t LVL,
165  typename Expr,typename DeviceT>
166 struct SubExprRes;
167 
168 template <size_t LC, size_t LR, size_t LCT, size_t LRT, typename Expr,
169  typename DeviceT>
170 void fuse(Expr, const DeviceT &);
171 
172 template <size_t LC, size_t LR, size_t LCT, size_t LRT, typename Expr,
173  typename DeviceT>
174 void no_fuse(Expr, const DeviceT &);
175 
176 template <bool Conds, typename Expr, size_t LC, size_t LR, size_t LRT,
177  size_t LCT, typename NestedExpr, typename DeviceT>
178 inline typename Expr::Sub_expression_Type execute_expr(NestedExpr,
179  const DeviceT &);
180 
181 template <bool Conds, typename Expr, size_t LC, size_t LR, size_t LRT,
182  size_t LCT, typename LHSExpr, typename RHSExpr, typename DeviceT>
183 inline typename Expr::Sub_expression_Type execute_expr(LHSExpr, RHSExpr,
184  const DeviceT &);
185 } // internal
186 } // visioncpp
187 #endif // VISIONCPP_INCLUDE_FRAMEWORK_FORWARD_DECLARATIONS_HPP_
enum class that defines supported backends.
enum class that defines supported devices types.
class used to implement the execution of the expression tree.
void fuse(Expr expr, const DeviceT &dev)
function fuse
Definition: fuse.hpp:89
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
void no_fuse(Expr expr, const DeviceT &dev)
template deduction function for no_fuse expression
Definition: nofuse.hpp:142
static constexpr size_t Image
static constexpr size_t Buffer2D
static constexpr size_t Buffer1D
static constexpr size_t Const
static constexpr size_t Host
constexpr static bool NoFuse
constexpr static bool Fuse
static constexpr ScopeType Host_Buffer
static constexpr ScopeType Local
static constexpr ScopeType Constant
static constexpr ScopeType Global
VisionCpp namespace.
Definition: sycl/device.hpp:24
void execute(Expr &expr, const DeviceT &dev)
execute function is called by user in order to execute an expression template parameters:
Definition: executor.hpp:155
@ sycl
represents sycl backend.
@ size
number of backends.
internal::Device_< BK, DV > make_device()
template deduction function for Device_ class
@ gpu
represents the gpu device.
@ host
represents the host device.
@ cpu
represents the cpu device.
@ size
number of devices
The definition is in Assign file.
Definition: assign.hpp:44
the definition is in LeafNode.
Definition: leaf_node.hpp:38
The definition is in ParallelCopy file.
The definition is in RBiOP file.
The definition is in RDCN file.
Definition: reduction.hpp:42
The definition is in RUnOP file.
The definition is in StnFilt file.
The definition is in StnNoFilt file.
The definition is in SubExprRes file.
the definition is in VirtualMemory
Definition: mem_virtual.hpp:48