VisionCpp  0.0.1
memory.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 memory.hpp
21 /// this file contains a set of forward declarations and include headers
22 /// required for constructing and accessing memory on both host and device.
23 
24 #ifndef VISIONCPP_INCLUDE_FRAMEWORK_MEMORY_MEMORY_HPP_
25 #define VISIONCPP_INCLUDE_FRAMEWORK_MEMORY_MEMORY_HPP_
26 
27 namespace visioncpp {
28 namespace internal {
29 /// \struct MemoryProperties
30 /// \brief this is used to detect the Properties of a memory such as element
31 /// category, channel type, and channel size for different types of input raw
32 /// data
33 template <typename T>
34 struct MemoryProperties;
35 /// Definition of \ref VisionMemory
36 template <bool MapAlloc, size_t ScalarType, size_t MemoryType, typename Sclr,
37  size_t Width, size_t Height, typename ElementTp, size_t elements,
38  size_t Sc, size_t Level>
39 struct VisionMemory;
40 
41 /// \struct OutputMemory:
42 /// \brief OutputMemory is used to deduce the output type of each node in the
43 /// expression tree by using certain parameters from its child(ren).
44 /// template parameters:
45 /// \tparam ElementType: the Pixel type of each element of the output memory.
46 /// \tparam LeafType: the memory_type of the output memory { e.g.Buffer1D,
47 /// Buffer2D, Image, Host}
48 /// \tparam Cols: the column size of the memory
49 /// \tparam Rows: the row size of the memory
50 /// \tparam LVL : the level of the output memory in the expression tree.
51 template <typename ElementType, size_t LeafType, size_t Cols, size_t Rows,
52  size_t LVL>
53 struct OutputMemory {
54  using Type = VisionMemory<
56  typename MemoryProperties<ElementType>::ChannelType, Cols, Rows,
58  LVL>;
59 };
60 
61 /// The definition can be found in \ref ConstMemory
62 template <typename T>
63 struct ConstMemory;
64 
65 /// \struct ImageProperties
66 /// \brief this file is used to create the image properties required to create
67 /// opencl image for different types of pixel
68 template <typename T, typename Scalar>
69 struct ImageProperties;
70 
71 /// \brief two category of element exist : basic which is the primary types and
72 /// struct which is user define types like F32C3, U8C3, ...
73 namespace element_category {
74 constexpr size_t Basic = 0;
75 constexpr size_t Struct = 1;
76 }; // namespace element_category
77 
78 /// \struct SyclRange
79 /// \brief This is used to determine the range for creating a syclbuffer based
80 /// on the memory dimension template parameters: \tparam Dim : the memory
81 /// dimension
82 template <size_t Dim>
83 struct SyclRange;
84 
85 /// \brief specialisation of the SyclRange when the dimension is 2
86 template <>
87 struct SyclRange<2> {
88  /// function get_range
89  /// \brief return the sycl range<2>
90  /// \param r: row size
91  /// \param c: column size
92  /// \return cl::sycl::range<2>
93  static inline cl::sycl::range<2> get_range(size_t r, size_t c) {
94  return cl::sycl::range<2>(r, c);
95  }
96 };
97 
98 /// \brief specialisation of the SyclRange when the dimension is 1
99 template <>
100 struct SyclRange<1> {
101  /// function get_range
102  /// \brief return the sycl range<1>
103  /// \param r: row size
104  /// \param c: column size
105  /// \return cl::sycl::range<1>
106  static inline cl::sycl::range<1> get_range(size_t r, size_t c) {
107  return cl::sycl::range<1>(r * c);
108  }
109 };
110 
111 /// function get_range
112 /// \brief template deduction for SyclRange
113 /// template parameters:
114 /// \tparam Dim : the memory dimension
115 /// function parameters:
116 /// \param r: row size
117 /// \param c: column size
118 /// \return cl::sycl::range<Dim>
119 template <size_t Dim>
120 inline cl::sycl::range<Dim> get_range(size_t r, size_t c) {
121  /// column major
122  return SyclRange<Dim>::get_range(c, r);
123  /// row major /// \brief this will apply when sycl changes
124  // return SyclRange<Dim>::get_range(r, c);
125 }
126 
127 /// \struct SyclScope
128 /// \brief determines the memory target on the device based on the
129 /// memory type and suggested target.
130 /// template parameters
131 /// \tparam LeafType determines the memory type
132 /// \tparam Sc: determines the suggested target
133 template <size_t LeafType, size_t Sc>
134 struct SyclScope;
135 
136 template <size_t LeafType>
137 struct SyclScope<LeafType, scope::Global> {
138  static constexpr cl::sycl::access::target scope =
139  cl::sycl::access::target::global_buffer;
140 };
141 
142 template <size_t LeafType>
143 struct SyclScope<LeafType, scope::Host_Buffer> {
144  static constexpr cl::sycl::access::target scope =
145  cl::sycl::access::target::host_buffer;
146 };
147 
148 template <size_t LeafType>
149 struct SyclScope<LeafType, scope::Local> {
150  static constexpr cl::sycl::access::target scope =
151  cl::sycl::access::target::local;
152 };
153 
154 template <size_t LeafType>
155 struct SyclScope<LeafType, scope::Constant> {
156  static constexpr cl::sycl::access::target scope =
157  cl::sycl::access::target::constant_buffer;
158 };
159 
160 /// \brief specialisation of the SyclScope when the memory type is Image
161 template <>
162 struct SyclScope<memory_type::Image, scope::Global> {
163  static constexpr cl::sycl::access::target scope =
164  cl::sycl::access::target::image;
165 };
166 
167 /// \struct ConvertToVisionScope
168 /// this struct is used to convert the sycl target to visioncpp target
169 /// \tparam Sc represent the sycl target
170 template <cl::sycl::access::target Sc>
172 
173 /// \brief specialisation of \ref ConvertToVisionScope where the target is
174 /// global_buffer
175 template <>
176 struct ConvertToVisionScope<cl::sycl::access::target::global_buffer> {
177  static constexpr size_t scope = scope::Global;
178 };
179 
180 /// \brief specialisation of \ref ConvertToVisionScope where the target is
181 /// host_buffer
182 template <>
183 struct ConvertToVisionScope<cl::sycl::access::target::host_buffer> {
184  static constexpr size_t scope = scope::Host_Buffer;
185 };
186 
187 /// \brief specialisation of \ref ConvertToVisionScope where the target is
188 /// local
189 template <>
190 struct ConvertToVisionScope<cl::sycl::access::target::local> {
191  static constexpr size_t scope = scope::Local;
192 };
193 
194 /// \brief specialisation of \ref ConvertToVisionScope where the target is
195 /// constant_buffer
196 template <>
197 struct ConvertToVisionScope<cl::sycl::access::target::constant_buffer> {
198  static constexpr size_t scope = scope::Constant;
199 };
200 
201 /// \brief specialisation of \ref ConvertToVisionScope where the target is image
202 template <>
203 struct ConvertToVisionScope<cl::sycl::access::target::image> {
204  static constexpr size_t scope = scope::Global;
205 };
206 
207 /// \struct SyclAccessor
208 /// \brief This struct is used to create a sycl accessor type based on access
209 /// mode; dimension and memory type.
210 /// template parameters:
211 /// \tparam LeafType: determines memory type
212 /// \tparam Dim :determine buffer dimension
213 /// \tparam AccMd: determines access mode
214 template <size_t LeafType, size_t Dim, cl::sycl::access::mode AccMd,
215  typename ElementType, typename Scalar, size_t scope>
216 struct SyclAccessor {
217  using Accessor = cl::sycl::accessor<ElementType, Dim, AccMd,
219  using access_type = ElementType;
220 };
221 
222 /// \brief specialisation of the \ref SyclAccessor when the memory_type is Image
223 template <size_t Dim, cl::sycl::access::mode AccMd, typename ElementType,
224  typename Scalar, size_t scope>
225 struct SyclAccessor<memory_type::Image, Dim, AccMd, ElementType, Scalar,
226  scope> {
228  using Accessor =
229  cl::sycl::accessor<typename Properties::access_type, Dim, AccMd,
231  using access_type = typename Properties::access_type;
232 };
233 
234 /// \brief specialisation of the \ref SyclAccessor when the memory_type is
235 /// constant variable
236 template <size_t Dim, cl::sycl::access::mode AccMd, typename ElementType,
237  typename Scalar, size_t scope>
238 struct SyclAccessor<memory_type::Const, Dim, AccMd, ElementType, Scalar,
239  scope> {
240  using access_type = ElementType;
242 };
243 
244 /// \struct SyclMem
245 /// \brief SyclMem is used to create VisionMemory data storage. It has been
246 /// specialised based on the memory type and input data
247 /// template parameters:
248 /// \tparam MapAlloc: determines whether or not a host pointer has been
249 /// allocated for this memory
250 /// \tparam LeafType: determines the memory type
251 /// \tparam Dim : determines the memory dimension
252 /// \tparam ElementType: determines the type of each element in the storage
253 template <bool MapAlloc, size_t LeafType, size_t Dim, typename ElementType>
254 struct SyclMem;
255 /// \brief specialisation of SyclMem when there is host memory allocated.
256 template <size_t LeafType, size_t Dim, typename ElementType>
257 struct SyclMem<true, LeafType, Dim, ElementType> {
258  using Type = cl::sycl::buffer<ElementType, Dim>;
259 };
260 
261 /// \brief specialisation of SyclMem when there is no host memory allocated.
262 /// This is used to construct a device only buffer type.
263 template <size_t LeafType, size_t Dim, typename ElementType>
264 struct SyclMem<false, LeafType, Dim, ElementType> {
265  using Type = cl::sycl::buffer<ElementType, Dim>;
266 };
267 
268 /// \brief specialisation of SyclMem when the memory_type is Image
269 template <size_t Dim, typename ElementType>
270 struct SyclMem<true, memory_type::Image, Dim, ElementType> {
271  using Type = cl::sycl::image<Dim>;
272 };
273 
274 /// \brief specialisation of SyclMem when the memory_type is Constant
275 /// variable
276 template <size_t Dim, typename ElementType>
277 struct SyclMem<true, memory_type::Const, Dim, ElementType> {
278  using Type = ElementType;
279 };
280 
281 /// \brief specialisation of the SyclMem when the memory_type is Image and no
282 /// device pointer is allocated to the memory.
283 template <size_t Dim, typename ElementType>
284 struct SyclMem<false, memory_type::Image, Dim, ElementType> {
285  using Type = cl::sycl::image<Dim>;
286 };
287 
288 /// \struct MemDimension
289 /// \brief this is used to determine the dimension of the memory based on the
290 /// memory type
291 /// template parameters:
292 /// \tparam LeafType : the type of the memory
293 template <size_t LeafType>
294 struct MemDimension {
295  static constexpr size_t Dim = 2;
296 };
297 
298 /// \brief specialisation of the MemDimension when the memory type is Buffer1D
299 template <>
300 struct MemDimension<memory_type::Buffer1D> {
301  static constexpr size_t Dim = 1;
302 };
303 
304 /// \brief specialisation of the MemDimension when the memory type is Host
305 template <>
306 struct MemDimension<memory_type::Host> {
307  static constexpr size_t Dim = 1;
308 };
309 
310 /// \brief specialisation of the MemDimension when the memory type is constant
311 /// variable
312 template <>
313 struct MemDimension<memory_type::Const> {
314  static constexpr size_t Dim = 1;
315 };
316 
317 /// \struct CreateSyclBuffer
318 /// \brief This class is used to instantiate the sycl memory based on the memory
319 /// types.
320 /// template parameters:
321 /// \tparam LeafType: determines the memory type
322 /// \tparam ElemType : determines the type of the element in each memory
323 /// \tparam Scalar : determines the type of each channel of each element
324 /// \tparam VisionMem: represent the type of the memory created by using SyclMem
325 /// \tparam RNG : the sycl range type for creating memory
326 template <size_t LeafType, typename ElemType, typename Scalar,
327  typename VisionMem, typename RNG>
329  /// function create_buffer
330  /// \brief This function is used to create a sycl buffer when the host memory
331  /// allocated for synchronization.
332  /// parameters:
333  /// \param ptr : shared_ptr containing the VisionMem
334  /// \param dt : the input pointer for creating buffer
335  /// \param rng : the sycl range for creating buffer
336  /// \return void
337  static inline void create_buffer(std::shared_ptr<VisionMem> &ptr, Scalar *dt,
338  RNG rng) {
339  ptr = std::make_shared<VisionMem>(
340  VisionMem((static_cast<ElemType *>(static_cast<void *>(dt))), rng));
341  }
342 
343  /// function create_buffer
344  /// \brief This function is used to create a device only buffer when there is
345  /// no host pointer allocated for synchronization.
346  /// parameters:
347  /// \param ptr : shared_ptr containing the VisionMem
348  /// \param rng : the sycl range for creating buffer
349  /// \return void
350  static inline void create_buffer(std::shared_ptr<VisionMem> &ptr, RNG rng) {
351  ptr = std::make_shared<VisionMem>(VisionMem(rng));
352  ptr.get()->set_final_data(nullptr);
353  }
354 };
355 
356 /// \brief specialisation of create CreateSyclBuffer when the memory type is
357 /// image
358 template <typename ElemType, typename Scalar, typename VisionMem, typename RNG>
359 struct CreateSyclBuffer<memory_type::Image, ElemType, Scalar, VisionMem, RNG> {
361  /// function create_buffer
362  /// \brief This function is used to create a sycl buffer when the host memory
363  /// is allocated for synchronization. parameters: \param ptr : shared_ptr
364  /// containing the VisionMem \param dt : the input pointer for creating image
365  /// \param rng : the sycl range for creating image
366  /// \return void
367  static inline void create_buffer(std::shared_ptr<VisionMem> &ptr, Scalar *dt,
368  RNG rng) {
369  ptr = std::make_shared<VisionMem>(VisionMem(dt, Properties::channel_order,
370  Properties::channel_type, rng));
371  }
372 
373  /// function create_buffer
374  /// \brief This function is used to create a device only buffer when there is
375  /// no host pointer allocated for synchronization.
376  /// parameters:
377  /// \param ptr : shared_ptr containing the VisionMem
378  /// \param rng : the sycl range for creating image
379  /// \return void
380  static inline void create_buffer(std::shared_ptr<VisionMem> &ptr, RNG rng) {
381  ptr = std::make_shared<VisionMem>(
382  VisionMem(Properties::channel_order, Properties::channel_type, rng));
383  ptr.get()->set_final_data(nullptr);
384  }
385 };
386 
387 /// \brief specialisation of create CreateSyclBuffer when the memory type is
388 /// constant variable
389 template <typename ElemType, typename Scalar, typename VisionMem, typename RNG>
390 struct CreateSyclBuffer<memory_type::Const, ElemType, Scalar, VisionMem, RNG> {
391  /// function create_buffer
392  /// \brief This function is used to create a sycl buffer when the host memory
393  /// allocated for synchronization.
394  /// parameters:
395  /// \param ptr : shared_ptr containing the VisionMem
396  /// \param dt : the input pointer for creating const memory
397  /// \param rng : the sycl range for creating const memory
398  /// \return void
399  static inline void create_buffer(std::shared_ptr<VisionMem> &ptr,
400  VisionMem dt, RNG rng) {
401  ptr = std::make_shared<VisionMem>(VisionMem(dt));
402  }
403 };
404 
405 /// function create_sycl_buffer
406 /// \brief template deduction for CreateSyclBuffer struct when there is host
407 /// pointer
408 /// template parameters:
409 /// \tparam LeafType: determines the memory type
410 /// \tparam ElemType : determines the type of the element in each memory
411 /// \tparam Scalar : determines the type of each channel of each element
412 /// \tparam VisionMem: represent the type of the memory created by using SyclMem
413 /// \tparam RNG : the sycl range type for creating memory
414 /// function parameters
415 /// parameters:
416 /// \param ptr : shared_ptr containing the VisionMem
417 /// \param dt : the input pointer for creating buffer
418 /// \param rng : the sycl range for creating buffer
419 /// \return void
420 template <size_t LeafType, typename ElemType, typename Scalar,
421  typename VisionMem, typename RNG>
422 inline void create_sycl_buffer(std::shared_ptr<VisionMem> &ptr, Scalar *dt,
423  RNG rng) {
425  ptr, dt, rng);
426 }
427 
428 /// function create_sycl_buffer
429 /// \brief template deduction for CreateSyclBuffer struct. this one create
430 /// another buffer from accepting an input buffer. It is used for creating
431 /// sub-buffer
432 /// template parameters:
433 /// \tparam LeafType: determines the memory type
434 /// \tparam ElemType : determines the type of the element in each memory
435 /// \tparam Scalar : determines the type of each channel of each element
436 /// \tparam VisionMem: represent the type of the memory created by using SyclMem
437 /// \tparam RNG : the sycl range type for creating memory
438 /// function parameters
439 /// parameters:
440 /// \param ptr : shared_ptr containing the VisionMem
441 /// \param rng : the sycl range for creating buffer
442 /// \param dt : the input buffer for creating new sub-buffer from it
443 /// \return void
444 template <size_t LeafType, typename ElemType, typename Scalar,
445  typename VisionMem, typename RNG>
446 inline void create_sycl_buffer(std::shared_ptr<VisionMem> &ptr, VisionMem dt,
447  RNG rng) {
448  CreateSyclBuffer<memory_type::Const, ElemType, Scalar, VisionMem,
449  RNG>::create_buffer(ptr, dt, rng);
450 }
451 
452 /// function create_sycl_buffer
453 /// \brief template deduction for CreateSyclBuffer struct when there is host
454 /// pointer
455 /// template parameters:
456 /// \tparam LeafType: determines the memory type
457 /// \tparam ElemType : determines the type of the element in each memory
458 /// \tparam Scalar : determines the type of each channel of each element
459 /// \tparam VisionMem: represent the type of the memory created by using SyclMem
460 /// \tparam RNG : the sycl range type for creating memory
461 /// function parameters
462 /// parameters:
463 /// \param ptr : shared_ptr containing the VisionMem
464 /// \param rng : the sycl range for creating buffer
465 /// \return void
466 template <size_t LeafType, typename ElemType, typename Scalar,
467  typename VisionMem, typename RNG>
468 inline void create_sycl_buffer(std::shared_ptr<VisionMem> &ptr, RNG rng) {
470  ptr, rng);
471 }
472 
473 /// \struct BufferUpdate
474 /// \brief This is used to update the Vision Memory with new value
475 /// update sycl buffer at the moment we use ptr.reset() because it was faster
476 /// than getting the host pointer and updating it in the host side.
477 /// template parameters:
478 /// \tparam LeafType : is the memory type
479 /// \tparam Rows: is the row size of the buffer
480 /// \tparam Cols: is the column size of the buffer
481 /// \tparam ElemType: is the type of element in the buffer
482 /// \tparam Scalar is the type of each channel of the element
483 /// \tparam VisionMem is the created SyclMem
484 template <size_t LeafType, size_t Rows, size_t Cols, typename ElemType,
485  typename Scalar, typename VisionMem>
486 struct BufferUpdate {
487  /// function buffer_update
488  /// \brief this function is used to update the sycl buffer with a new value
489  /// parameters:
490  /// \param ptr : is the shared_ptr containing the SyclMem
491  /// \param dt: is the pointer containing the new value for the buffer
492  /// \return void
493  static inline void buffer_update(std::shared_ptr<VisionMem> &ptr,
494  Scalar *dt) {
495  auto host_ptr =
496  (*ptr)
497  .template get_access<cl::sycl::access::mode::discard_write,
498  cl::sycl::access::target::host_buffer>()
499  .get_pointer();
500 
501  memcpy(host_ptr, dt, sizeof(Scalar) * ElemType::elements * Rows * Cols);
502  }
503 };
504 
505 /// \brief specialisation of the BufferUpdate when the memory_type is Image
506 template <size_t Rows, size_t Cols, typename ElemType, typename Scalar,
507  typename VisionMem>
508 struct BufferUpdate<memory_type::Image, Rows, Cols, ElemType, Scalar,
509  VisionMem> {
510  /// function buffer_update
511  /// \brief this function is used to update the sycl buffer with a new value
512  /// parameters:
513  /// \param ptr : is the shared_ptr containing the SyclMem
514  /// \param dt: is the pointer containing the new value for the buffer
515  /// \return void
517  static inline void buffer_update(std::shared_ptr<VisionMem> &ptr,
518  Scalar *dt) {
519  static_assert(true, "image is not supported in this version");
520  }
521 };
522 
523 /// \brief specialisation of the BufferUpdate when the memory_type is Constant
524 /// variable
525 template <size_t Rows, size_t Cols, typename ElemType, typename Scalar,
526  typename VisionMem>
527 struct BufferUpdate<memory_type::Const, Rows, Cols, ElemType, Scalar,
528  VisionMem> {
529  /// function buffer_update
530  /// \brief this function is used to update the sycl buffer with a new value
531  /// parameters:
532  /// \param ptr : is the shared_ptr containing the SyclMem
533  /// \param dt: is the pointer containing the new value for the buffer
534  /// \return void
535  static inline void buffer_update(std::shared_ptr<VisionMem> &ptr,
536  VisionMem dt) {
537  *ptr = dt;
538  }
539 };
540 
541 /// function buffer_update
542 /// \brief template deduction function for BufferUpdate
543 /// template parameters:
544 /// \tparam LeafType : is the memory type
545 /// \tparam Rows: is the row size of the buffer
546 /// \tparam Cols: is the column size of the buffer
547 /// \tparam ElemType: is the type of element in the buffer
548 /// \tparam Scalar is the type of each channel of the element
549 /// \tparam VisionMem is the created SyclMem
550 /// function parameters:
551 /// \param ptr : is the shared_ptr containing the SyclMem
552 /// \param dt: is the pointer containing the new value for the buffer
553 /// \return void
554 template <size_t LeafType, size_t Rows, size_t Cols, typename ElemType,
555  typename Scalar, typename VisionMem>
556 inline void buffer_update(std::shared_ptr<VisionMem> &ptr, Scalar *dt) {
557  BufferUpdate<LeafType, Rows, Cols, ElemType, Scalar,
558  VisionMem>::buffer_update(ptr, dt);
559 }
560 } // namespace internal
561 } // namespace visioncpp
562 
563 // Vision Memories Headers
564 #include "mem_const.hpp"
565 #include "mem_prop.hpp"
566 #include "mem_virtual.hpp"
567 #include "mem_vision.hpp"
568 // memory_access in sycl
570 #endif // VISIONCPP_INCLUDE_FRAMEWORK_MEMORY_MEMORY_HPP_
specialisations of SyclMem type when we are passing constant variable to the device.
Series of pixel convert functions.
This file contains the VirtualMemory struct.
this file contains the memory struct used to store {Sycl buffer , Host pointer or Sycl image}.
this file contains a set of forward declarations and include headers required for constructing and ac...
void create_sycl_buffer(std::shared_ptr< VisionMem > &ptr, Scalar *dt, RNG rng)
function create_sycl_buffer
Definition: memory.hpp:422
cl::sycl::range< Dim > get_range(size_t r, size_t c)
function get_range
Definition: memory.hpp:120
void buffer_update(std::shared_ptr< VisionMem > &ptr, Scalar *dt)
function buffer_update
Definition: memory.hpp:556
static constexpr size_t Image
static constexpr size_t Buffer1D
static constexpr size_t Const
static constexpr size_t Host
static constexpr ScopeType Host_Buffer
static constexpr ScopeType Local
static constexpr ScopeType Constant
static constexpr ScopeType Global
VisionCpp namespace.
Definition: sycl/device.hpp:24
static void buffer_update(std::shared_ptr< VisionMem > &ptr, VisionMem dt)
function buffer_update
Definition: memory.hpp:535
static void buffer_update(std::shared_ptr< VisionMem > &ptr, Scalar *dt)
Definition: memory.hpp:517
This is used to update the Vision Memory with new value update sycl buffer at the moment we use ptr....
Definition: memory.hpp:486
static void buffer_update(std::shared_ptr< VisionMem > &ptr, Scalar *dt)
function buffer_update
Definition: memory.hpp:493
The definition can be found in ConstMemory.
Definition: mem_const.hpp:38
this struct is used to convert the sycl target to visioncpp target
Definition: memory.hpp:171
static void create_buffer(std::shared_ptr< VisionMem > &ptr, VisionMem dt, RNG rng)
function create_buffer
Definition: memory.hpp:399
static void create_buffer(std::shared_ptr< VisionMem > &ptr, RNG rng)
function create_buffer
Definition: memory.hpp:380
static void create_buffer(std::shared_ptr< VisionMem > &ptr, Scalar *dt, RNG rng)
function create_buffer
Definition: memory.hpp:367
This class is used to instantiate the sycl memory based on the memory types.
Definition: memory.hpp:328
static void create_buffer(std::shared_ptr< VisionMem > &ptr, Scalar *dt, RNG rng)
function create_buffer
Definition: memory.hpp:337
static void create_buffer(std::shared_ptr< VisionMem > &ptr, RNG rng)
function create_buffer
Definition: memory.hpp:350
this file is used to create the image properties required to create opencl image for different types ...
Definition: memory.hpp:63
this is used to determine the dimension of the memory based on the memory type template parameters:
Definition: memory.hpp:294
static constexpr size_t Dim
Definition: memory.hpp:295
This file is used to detect the ChannelType ElementCategory {basic or struct}, and the channel size o...
Definition: mem_prop.hpp:32
typename ElementTp::data_type ChannelType
Definition: mem_prop.hpp:34
OutputMemory is used to deduce the output type of each node in the expression tree by using certain p...
Definition: memory.hpp:53
cl::sycl::accessor< typename Properties::access_type, Dim, AccMd, SyclScope< memory_type::Image, scope >::scope > Accessor
Definition: memory.hpp:230
This struct is used to create a sycl accessor type based on access mode; dimension and memory type.
Definition: memory.hpp:216
cl::sycl::accessor< ElementType, Dim, AccMd, SyclScope< LeafType, scope >::scope > Accessor
Definition: memory.hpp:218
SyclMem is used to create VisionMemory data storage.
Definition: memory.hpp:254
static cl::sycl::range< 1 > get_range(size_t r, size_t c)
function get_range
Definition: memory.hpp:106
static cl::sycl::range< 2 > get_range(size_t r, size_t c)
function get_range
Definition: memory.hpp:93
This is used to determine the range for creating a syclbuffer based on the memory dimension template ...
Definition: memory.hpp:76
determines the memory target on the device based on the memory type and suggested target.
Definition: memory.hpp:134
Definition of VisionMemory.
Definition: mem_vision.hpp:53