VisionCpp  0.0.1
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL > Struct Template Reference

Definition of VisionMemory. More...

#include <mem_vision.hpp>

Collaboration diagram for visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >:

Public Types

using ElementType = ElementTp
 
using Scalar = Sclr
 
using AccessType = ElementType
 
template<cl::sycl::access::mode acMd>
using Accessor = typename SyclAccessor< LeafType, Dim, acMd, ElementType, Scalar, scope >::Accessor
 
template<cl::sycl::access::mode acMd>
using HostAccessor = typename SyclAccessor< LeafType, Dim, acMd, ElementType, Scalar, scope::Host_Buffer >::Accessor
 
using Type = VisionMemory< HasMapAllocator, ScalarType, LeafType, Scalar, Cols, Rows, ElementTp, Elements, scope, LVL >
 
using syclBuffer = typename SyclMem< HasMapAllocator, LeafType, Dim, ElementType >::Type
 

Public Member Functions

 VisionMemory (Scalar *dt)
 
 VisionMemory (syclBuffer dt)
 buffer copy is lightweight no need to pass by ref More...
 
 VisionMemory ()
 
template<bool ForcedToExec, size_t LC, size_t LR, size_t LCT, size_t LRT, typename DeviceT >
internal::LeafNode< Type, Levelsub_expression_evaluation (const DeviceT &)
 sub_expression_evaluation More...
 
template<cl::sycl::access::mode accMode>
Accessor< accMode > get_device_accessor (cl::sycl::handler &cgh)
 This function is used to get the device access on the memory. More...
 
void reset_input (Scalar *dt)
 reset_input is used to manually reset the input value of an input sycl buffer. More...
 
void set_output (std::shared_ptr< Scalar > &ptr)
 set_output function is used to destroy the sycl buffer and manually allocated the data to the provided pointer. More...
 
void lock ()
 lock function is used to access the sycl buffer on the host using a host pointer. More...
 
void unlock ()
 The unlock function for destroying the host accessor. More...
 

Static Public Member Functions

static constexpr size_t used_memory ()
 
static constexpr size_t get_size ()
 

Public Attributes

std::shared_ptr< syclBuffersyclData
 
std::shared_ptr< HostAccessor< cl::sycl::access::mode::read > > hostAcc
 

Static Public Attributes

static constexpr size_t Rows = Row
 
static constexpr size_t Cols = Col
 
static constexpr size_t Channels = Elements
 
static constexpr size_t LeafType = MemoryType
 
static constexpr size_t Dim = MemDimension<MemoryType>::Dim
 
static constexpr bool SubExpressionEvaluationNeeded = false
 
static constexpr size_t MemoryCategory = ScalarType
 
static constexpr bool HasMapAllocator = MapAllocator
 
static constexpr size_t scope = Sc
 
static constexpr size_t Level = LVL
 

Detailed Description

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr, size_t Col, size_t Row, typename ElementTp, size_t Elements, size_t Sc, size_t LVL>
struct visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >

Definition of VisionMemory.

VisionMemory is the memory container of visioncpp.

It has been defined general enough that can be used for not only sycl buffer and image, but also for host backend such as openmp. template parameters:

Template Parameters
MapAllocatora boolean value representing whether or not the buffer has map allocator
ScalarTyperepresent whether the element of the memory is Basic or Struct.
MemoryTyperepresent the type of the memory.(e.g. Buffer2D, Buffer1D, Image, Host)
Sclrrepresent the type of each channel of the elements of the memory
Colrepresents the column size of the memory
Rowrepresents the Row size of the memory
ElementTprepresents the types of each element inside the memory
Elementsrepresents the number of channels for each element
Screpresents the memory target on the device (global memory or constant memory)- Default is global

Definition at line 53 of file mem_vision.hpp.

Member Typedef Documentation

◆ Accessor

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
template<cl::sycl::access::mode acMd>
using visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::Accessor = typename SyclAccessor<LeafType, Dim, acMd, ElementType, Scalar, scope>::Accessor

Definition at line 69 of file mem_vision.hpp.

◆ AccessType

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
using visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::AccessType = ElementType

Definition at line 66 of file mem_vision.hpp.

◆ ElementType

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
using visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::ElementType = ElementTp

Definition at line 64 of file mem_vision.hpp.

◆ HostAccessor

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
template<cl::sycl::access::mode acMd>
using visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::HostAccessor = typename SyclAccessor<LeafType, Dim, acMd, ElementType, Scalar, scope::Host_Buffer>::Accessor

Definition at line 74 of file mem_vision.hpp.

◆ Scalar

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
using visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::Scalar = Sclr

Definition at line 65 of file mem_vision.hpp.

◆ syclBuffer

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
using visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::syclBuffer = typename SyclMem<HasMapAllocator, LeafType, Dim, ElementType>::Type

Definition at line 80 of file mem_vision.hpp.

◆ Type

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
using visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::Type = VisionMemory<HasMapAllocator, ScalarType, LeafType, Scalar, Cols, Rows, ElementTp, Elements, scope, LVL>

Definition at line 77 of file mem_vision.hpp.

Constructor & Destructor Documentation

◆ VisionMemory() [1/3]

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::VisionMemory ( Scalar dt)
inline

◆ VisionMemory() [2/3]

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::VisionMemory ( syclBuffer  dt)
inline

◆ VisionMemory() [3/3]

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::VisionMemory ( )
inline

Member Function Documentation

◆ get_device_accessor()

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
template<cl::sycl::access::mode accMode>
Accessor<accMode> visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::get_device_accessor ( cl::sycl::handler &  cgh)
inline

This function is used to get the device access on the memory.

The mode of the accessor represents the type of the access. template parameters:

Template Parameters
accMode: represents the sycl type of access function parameters:
Parameters
cghsycl command group handler
Returns
Accessor

Definition at line 135 of file mem_vision.hpp.

References visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::syclData.

◆ get_size()

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
static constexpr size_t visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::get_size ( )
inlinestaticconstexpr

Definition at line 89 of file mem_vision.hpp.

References visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::used_memory().

Here is the call graph for this function:

◆ lock()

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
void visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::lock ( )
inline

lock function is used to access the sycl buffer on the host using a host pointer.

Because the host accessor is blocking we are creating it dynamically so by calling the lock function. It is the responsibility of a user to call unlock function in order to destroy the accessor once his work is finished. This is useful when we are dealing with video and we want to display each frame of the video at the end of each iteration.

Returns
void

Definition at line 162 of file mem_vision.hpp.

References visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::hostAcc, and visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::syclData.

◆ reset_input()

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
void visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::reset_input ( Scalar dt)
inline

reset_input is used to manually reset the input value of an input sycl buffer.

This can be used when we are dealing with video streaming and we want to pass different input stream to the expression.

Returns
void

Definition at line 142 of file mem_vision.hpp.

References visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::syclData.

◆ set_output()

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
void visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::set_output ( std::shared_ptr< Scalar > &  ptr)
inline

set_output function is used to destroy the sycl buffer and manually allocated the data to the provided pointer.

This is used when we needed to return the value of the device-only buffer.

Parameters
ptrthe pointer for manually allocating the data
Returns
void

Definition at line 151 of file mem_vision.hpp.

References visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::syclData.

◆ sub_expression_evaluation()

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
template<bool ForcedToExec, size_t LC, size_t LR, size_t LCT, size_t LRT, typename DeviceT >
internal::LeafNode<Type, Level> visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::sub_expression_evaluation ( const DeviceT &  )
inline

sub_expression_evaluation

This function is used to break the expression tree whenever necessary. The decision for breaking the tree will be determined based on the static parameter called SubExpressionEvaluationNeeded. When this is set to true, the sub_expression_evaluation is called recursively from the root of the tree. Each node based on their parent decision will decide to launch a kernel for itself. Also, they decide for each of their children whether or not to launch a kernel separately. template parameters:

Template Parameters
ForcedToExec: a boolean value representing the decision made by the parent of this node for launching a kernel.
LCis the column size of local memory required by Filter2D and DownSmplOP
LRis the row size of local memory required by Filter2D and DownSmplOP
LCTis the column size of workgroup
LRTis the row size of workgroup function parameters:
Returns
LeafNode

Definition at line 123 of file mem_vision.hpp.

◆ unlock()

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
void visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::unlock ( )
inline

The unlock function for destroying the host accessor.

It must be called by user if the lock has been called in order to destroy the host accessor and release the execution.

Returns
void

Definition at line 170 of file mem_vision.hpp.

References visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::hostAcc.

◆ used_memory()

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
static constexpr size_t visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::used_memory ( )
inlinestaticconstexpr

Member Data Documentation

◆ Channels

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
constexpr size_t visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::Channels = Elements
staticconstexpr

◆ Cols

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
constexpr size_t visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::Cols = Col
staticconstexpr

◆ Dim

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
constexpr size_t visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::Dim = MemDimension<MemoryType>::Dim
staticconstexpr

Definition at line 59 of file mem_vision.hpp.

◆ HasMapAllocator

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
constexpr bool visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::HasMapAllocator = MapAllocator
staticconstexpr

Definition at line 62 of file mem_vision.hpp.

◆ hostAcc

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
std::shared_ptr<HostAccessor<cl::sycl::access::mode::read> > visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::hostAcc

◆ LeafType

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
constexpr size_t visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::LeafType = MemoryType
staticconstexpr

Definition at line 58 of file mem_vision.hpp.

◆ Level

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
constexpr size_t visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::Level = LVL
staticconstexpr

Definition at line 79 of file mem_vision.hpp.

◆ MemoryCategory

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
constexpr size_t visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::MemoryCategory = ScalarType
staticconstexpr

Definition at line 61 of file mem_vision.hpp.

◆ Rows

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
constexpr size_t visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::Rows = Row
staticconstexpr

◆ scope

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
constexpr size_t visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::scope = Sc
staticconstexpr

Definition at line 63 of file mem_vision.hpp.

◆ SubExpressionEvaluationNeeded

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
constexpr bool visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::SubExpressionEvaluationNeeded = false
staticconstexpr

Definition at line 60 of file mem_vision.hpp.

◆ syclData

template<bool MapAllocator, size_t ScalarType, size_t MemoryType, typename Sclr , size_t Col, size_t Row, typename ElementTp , size_t Elements, size_t Sc, size_t LVL>
std::shared_ptr<syclBuffer> visioncpp::internal::VisionMemory< MapAllocator, ScalarType, MemoryType, Sclr, Col, Row, ElementTp, Elements, Sc, LVL >::syclData

The documentation for this struct was generated from the following file: