Clover Git
OpenCL 1.1 software implementation
Public Member Functions

Coal::DeviceInterface Class Reference

Abstraction layer between core Clover objects and the devices. More...

#include <deviceinterface.h>

Inheritance diagram for Coal::DeviceInterface:
Collaboration diagram for Coal::DeviceInterface:

List of all members.

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 DeviceBuffercreateDeviceBuffer (MemObject *buffer, cl_int *rs)=0
 Create a Coal::DeviceBuffer object for this device.
virtual DeviceProgramcreateDeviceProgram (Program *program)=0
 Create a Coal::DeviceProgram object for this device.
virtual DeviceKernelcreateDeviceKernel (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.

Detailed Description

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

virtual DeviceBuffer* Coal::DeviceInterface::createDeviceBuffer ( MemObject buffer,
cl_int *  rs 
) [pure virtual]

Create a Coal::DeviceBuffer object for this device.

Parameters:
bufferMemory object for which the buffer has to be created
rsError code (CL_SUCCESS if no error)
Returns:
a 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.

Parameters:
kernelCoal::Kernel containing the device-independent kernel data
functiondevice-specific llvm::Function to be used
Returns:
a 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.

Parameters:
programCoal::Program containing the device-independent program data
Returns:
a 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.

Parameters:
eventthe 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);
Parameters:
param_nameName of the property to retrieve
param_value_sizeSize of the application-allocated buffer in which to put the value.
param_valuePointer to an application-allocated buffer where the property data will be stored. Ignored if NULL.
param_value_size_retSize of the value retrieved, ignored if NULL.
Returns:
CL_SUCCESS in case of success, otherwise a CL error code.

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.

Note:
This function has one obligation: it must call Coal::MapBufferEvent::setPtr() and Coal::MapImageEvent::setPtr() (and other function described in its documentation)
Parameters:
eventthe event for which data can be set
Returns:
CL_SUCCESS in case of success

Implemented in Coal::CPUDevice.

Referenced by Coal::CommandQueue::queueEvent().

virtual void Coal::DeviceInterface::pushEvent ( Event event) [pure virtual]

Push an event on the device.

See also:
the end of Command Queues, Events and Worker Threads
Parameters:
eventthe event to be pushed

Implemented in Coal::CPUDevice.

Referenced by Coal::CommandQueue::pushEventsOnDevice().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines