Clover Git
OpenCL 1.1 software implementation
|
CPU implementation of Coal::MemObject
.
More...
#include <buffer.h>
Public Member Functions | |
CPUBuffer (CPUDevice *device, MemObject *buffer, cl_int *rs) | |
Constructor. | |
~CPUBuffer () | |
bool | allocate () |
Allocate the buffer on the device. | |
DeviceInterface * | device () const |
Coal::DeviceInterface of this buffer | |
void * | data () const |
Pointer to the buffer's data. | |
void * | nativeGlobalPointer () const |
Host-accessible memory pointer. | |
bool | allocated () const |
Allocation status. | |
Private Attributes | |
CPUDevice * | p_device |
MemObject * | p_buffer |
void * | p_data |
bool | p_data_malloced |
CPU implementation of Coal::MemObject
.
This class is responsible of the actual allocation of buffer objects, using malloc()
or by reusing a given host_ptr
.
Constructor.
device | Device for which the buffer is allocated |
buffer | Coal::MemObject holding information about the buffer |
rs | return code (CL_SUCCESS if all is good) |
Definition at line 44 of file buffer.cpp.
References data(), Coal::MemObject::deviceBuffer(), Coal::MemObject::flags(), Coal::MemObject::host_ptr(), Coal::SubBuffer::offset(), p_data, Coal::SubBuffer::parent(), Coal::MemObject::SubBuffer, and Coal::MemObject::type().
CPUBuffer::~CPUBuffer | ( | ) |
Definition at line 71 of file buffer.cpp.
References p_data, and p_data_malloced.
bool CPUBuffer::allocate | ( | ) | [virtual] |
Allocate the buffer on the device.
Implements Coal::DeviceBuffer.
Definition at line 89 of file buffer.cpp.
References Coal::MemObject::deviceAllocated(), Coal::MemObject::flags(), Coal::MemObject::host_ptr(), p_buffer, p_data, p_data_malloced, Coal::MemObject::size(), Coal::MemObject::SubBuffer, and Coal::MemObject::type().
bool CPUBuffer::allocated | ( | ) | const [virtual] |
Allocation status.
Implements Coal::DeviceBuffer.
Definition at line 125 of file buffer.cpp.
References p_data.
void * CPUBuffer::data | ( | ) | const |
Pointer to the buffer's data.
Definition at line 79 of file buffer.cpp.
References p_data.
Referenced by Coal::CPUKernelWorkGroup::callArgs(), CPUBuffer(), Coal::CPUKernelWorkGroup::getImageData(), Coal::CPUDevice::initEventDeviceData(), nativeGlobalPointer(), and worker().
DeviceInterface * CPUBuffer::device | ( | ) | const [virtual] |
Coal::DeviceInterface
of this buffer
Coal::DeviceInterface
Implements Coal::DeviceBuffer.
Definition at line 120 of file buffer.cpp.
References p_device.
void * CPUBuffer::nativeGlobalPointer | ( | ) | const [virtual] |
Host-accessible memory pointer.
This function returns what is passed as arguments to native kernels (clEnqueueNativeKernel()
, Coal::NativeKernelEvent
) in place of Coal::MemObject
pointers.
For Coal::CPUDevice
, it's simply a pointer in RAM, but hardware-accelerated devices may need to do some copying or mapping.
Implements Coal::DeviceBuffer.
Definition at line 84 of file buffer.cpp.
References data().
MemObject* Coal::CPUBuffer::p_buffer [private] |
Definition at line 70 of file buffer.h.
Referenced by allocate().
void* Coal::CPUBuffer::p_data [private] |
Definition at line 71 of file buffer.h.
Referenced by allocate(), allocated(), CPUBuffer(), data(), and ~CPUBuffer().
bool Coal::CPUBuffer::p_data_malloced [private] |
Definition at line 72 of file buffer.h.
Referenced by allocate(), and ~CPUBuffer().
CPUDevice* Coal::CPUBuffer::p_device [private] |