clDNN
cldnn::memory Struct Reference

Represents buffer with particular layout. More...

#include <memory.hpp>

Public Member Functions

 memory (const memory &other)
 
memoryoperator= (const memory &other)
 
size_t count () const
 number of elements of _layout.data_type stored in memory
 
size_t size () const
 number of bytes used by memory
 
const layoutget_layout () const
 Associated layout.
 
bool is_allocated_by (const engine &engine) const
 Test if memory is allocated by engine.
 
bool is_the_same_buffer (const memory &other) const
 
template<typename T >
cldnn::pointer< T > pointer () const
 
cldnn_memory get () const
 C API memory handle.
 

Static Public Member Functions

static memory allocate (const engine &engine, const layout &layout)
 Allocate memory on engine using specified layout.
 
template<typename T >
static memory attach (const cldnn::layout &layout, T *ptr, size_t size)
 

Friends

bool operator== (const memory &lhs, const memory &rhs)
 
bool operator!= (const memory &lhs, const memory &rhs)
 

Detailed Description

Represents buffer with particular layout.

Usually allocated by engine except cases when attached to user-allocated buffer.

Definition at line 42 of file memory.hpp.

Member Function Documentation

◆ attach()

template<typename T >
static memory cldnn::memory::attach ( const cldnn::layout layout,
T *  ptr,
size_t  size 
)
inlinestatic

Create memory object attached to the buffer allocated by user.

Parameters
ptrThe pointer to user allocated buffer.
sizeSize (in bytes) of the buffer. Should be equal to layout.data_size()
Note
User is responsible for buffer deallocation. Buffer lifetime should be bigger than lifetime of the memory object.

Definition at line 65 of file memory.hpp.


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