Intel clGPU
|
Binds host data and memory buffers per engine describing data direction (in/out) for kernel. More...
#include <engine.hpp>
Public Member Functions | |
buffer_binding (void *ptr, size_t size=0, direction dir=inout) | |
Constructs binding from host-allocated buffer. More... | |
buffer_binding (const std::shared_ptr< buffer > &buffer, direction dir=inout, size_t size=0) | |
Constructs binding from engine-allocated memory buffer. More... | |
direction | get_direction () const |
Get direction of the binding. | |
direction | set_direction (direction dir) |
Set direction of the binding. More... | |
const std::shared_ptr< engine > & | get_owning_engine () const |
Returns engine of the buffer passed to constructor or NULL if consrtucted from host-allocated data. | |
void * | get_host_ptr () const |
Raw pointer to data. More... | |
void | reset_host_ptr () const |
Reset internal host pointer to NULL if constructed from buffer. | |
size_t | size () const |
Returns size of data. | |
size_t | capacity () const |
Returns maximum possible size value. | |
void | size (size_t size) |
Set new size. More... | |
std::shared_ptr< buffer > | get_buffer (const std::shared_ptr< engine > &engine) const |
Returns binded buffer for the specified engine. More... | |
bool | is_output () const |
bool | is_input () const |
bool | is_defined () const |
Check if binding is fully defined: size is set and constructed from correct host-allocated pointer of buffer. | |
Protected Attributes | |
direction | _direction |
void * | _host_ptr |
size_t | _capacity |
size_t | _size |
std::shared_ptr< engine > | _owning_engine |
std::map< std::shared_ptr< engine >, std::shared_ptr< buffer > > | _buffers |
Binds host data and memory buffers per engine describing data direction (in/out) for kernel.
Definition at line 126 of file engine.hpp.
|
inline |
Constructs binding from host-allocated buffer.
ptr | Raw pointer to host allocated data |
size | Size of host allocated data |
dir | Data direction: host->kernel or host<-kernel or both |
Definition at line 134 of file engine.hpp.
|
inline |
Constructs binding from engine-allocated memory buffer.
buffer | Pre-allocated memory buffer |
dir | Data direction: host->kernel or host<-kernel or both |
size | Size of data to be used - should be less or equal to buffer size, if set to 0 then buffer size will be used. |
Definition at line 149 of file engine.hpp.
Returns binded buffer for the specified engine.
If there is no buffer binded - create and register new binded buffer
void* get_host_ptr | ( | ) | const |
Raw pointer to data.
void size | ( | size_t | size | ) |
Set new size.
New size should be less or equal to capacity