Clover Git
OpenCL 1.1 software implementation
|
Abstraction layer between core Clover objects and the devices. More...
#include <deviceinterface.h>
Public Member Functions | |
DeviceInterface () | |
virtual | ~DeviceInterface () |
virtual cl_int | info (cl_device_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret) const =0 |
Retrieve information about the device. | |
virtual DeviceBuffer * | createDeviceBuffer (MemObject *buffer, cl_int *rs)=0 |
Create a Coal::DeviceBuffer object for this device. | |
virtual DeviceProgram * | createDeviceProgram (Program *program)=0 |
Create a Coal::DeviceProgram object for this device. | |
virtual DeviceKernel * | createDeviceKernel (Kernel *kernel, llvm::Function *function)=0 |
Create a Coal::DeviceKernel object for this device. | |
virtual void | pushEvent (Event *event)=0 |
Push an event on the device. | |
virtual cl_int | initEventDeviceData (Event *event)=0 |
Initialize device-specific event data. | |
virtual void | freeEventDeviceData (Event *event)=0 |
Free device-specific event data. |
Abstraction layer between core Clover objects and the devices.
This interface is used by the core Clover classes to communicate with the devices, that must reimplement all the functions described here.
Definition at line 64 of file deviceinterface.h.
Coal::DeviceInterface::DeviceInterface | ( | ) | [inline] |
Definition at line 67 of file deviceinterface.h.
virtual Coal::DeviceInterface::~DeviceInterface | ( | ) | [inline, virtual] |
Definition at line 68 of file deviceinterface.h.
virtual DeviceBuffer* Coal::DeviceInterface::createDeviceBuffer | ( | MemObject * | buffer, |
cl_int * | rs | ||
) | [pure virtual] |
Create a Coal::DeviceBuffer
object for this device.
buffer | Memory object for which the buffer has to be created |
rs | Error code (CL_SUCCESS if no error) |
Coal::DeviceBuffer
object, undefined if there is an error Implemented in Coal::CPUDevice.
Referenced by Coal::MemObject::init().
virtual DeviceKernel* Coal::DeviceInterface::createDeviceKernel | ( | Kernel * | kernel, |
llvm::Function * | function | ||
) | [pure virtual] |
Create a Coal::DeviceKernel
object for this device.
kernel | Coal::Kernel containing the device-independent kernel data |
function | device-specific llvm::Function to be used |
Coal::DeviceKernel
object Implemented in Coal::CPUDevice.
Referenced by Coal::Kernel::addFunction().
virtual DeviceProgram* Coal::DeviceInterface::createDeviceProgram | ( | Program * | program | ) | [pure virtual] |
Create a Coal::DeviceProgram
object for this device.
program | Coal::Program containing the device-independent program data |
Coal::DeviceProgram
object Implemented in Coal::CPUDevice.
Referenced by Coal::Program::setDevices().
virtual void Coal::DeviceInterface::freeEventDeviceData | ( | Event * | event | ) | [pure virtual] |
Free device-specific event data.
This function is called just before event
gets deleted. It allows a device to free device-specific data of this event, if any.
event | the event that will be destroyed |
Implemented in Coal::CPUDevice.
Referenced by Coal::Event::freeDeviceData().
virtual cl_int Coal::DeviceInterface::info | ( | cl_device_info | param_name, |
size_t | param_value_size, | ||
void * | param_value, | ||
size_t * | param_value_size_ret | ||
) | const [pure virtual] |
Retrieve information about the device.
This function is used to retrieve information about an object. Sometimes, the size of the data retrieved is unknown (for example, a string). The application can call this function twice, the first time to get the size, then it allocates a buffer, and finally get the data.
const char *string = 0; size_t len; object->info(FOO_PROPERTY_STRING, 0, 0, &len); string = std::malloc(len); object->info(FOO_PROPERTY_STRING, len, string, 0);
param_name | Name of the property to retrieve |
param_value_size | Size of the application-allocated buffer in which to put the value. |
param_value | Pointer to an application-allocated buffer where the property data will be stored. Ignored if NULL. |
param_value_size_ret | Size of the value retrieved, ignored if NULL. |
Implemented in Coal::CPUDevice.
Referenced by Coal::Sampler::checkImageAvailability(), Coal::CommandQueue::checkProperties(), clGetDeviceInfo(), Coal::BufferEvent::isSubBufferAligned(), Coal::KernelEvent::KernelEvent(), and Coal::NativeKernelEvent::NativeKernelEvent().
virtual cl_int Coal::DeviceInterface::initEventDeviceData | ( | Event * | event | ) | [pure virtual] |
Initialize device-specific event data.
This call allows a device to initialize device-specific event data, by using Coal::Event::setDeviceData()
. For instance, an hardware-accelerated device can associate a device command to an event, and use it to manage the event when it gets pushed.
Coal::MapBufferEvent::setPtr()
and Coal::MapImageEvent::setPtr()
(and other function described in its documentation)event | the event for which data can be set |
Implemented in Coal::CPUDevice.
Referenced by Coal::CommandQueue::queueEvent().
virtual void Coal::DeviceInterface::pushEvent | ( | Event * | event | ) | [pure virtual] |
Push an event on the device.
event | the event to be pushed |
Implemented in Coal::CPUDevice.
Referenced by Coal::CommandQueue::pushEventsOnDevice().