Clover Git
OpenCL 1.1 software implementation
|
#include <kernel.h>
Public Types | |
enum | File { Private = 0, Global = 1, Local = 2, Constant = 3 } |
Memory address space qualifier. More... | |
enum | Kind { Invalid, Int8, Int16, Int32, Int64, Float, Double, Buffer, Image2D, Image3D, Sampler } |
Kind of argument (its datatype) More... | |
Public Member Functions | |
Arg (unsigned short vec_dim, File file, Kind kind) | |
Constructor. | |
~Arg () | |
void | alloc () |
Allocate the argument. | |
void | loadData (const void *data) |
Load a value into the argument. | |
void | setAllocAtKernelRuntime (size_t size) |
Set the number of bytes that must be allocated at run-time. | |
void | refineKind (Kind kind) |
Changes the Kind of this argument. | |
bool | operator!= (const Arg &b) |
Compares this argument with another. | |
size_t | valueSize () const |
Size of a field of this arg. | |
unsigned short | vecDim () const |
Vector dimension. | |
File | file () const |
File. | |
Kind | kind () const |
Kind. | |
bool | defined () const |
Has the value of this argument already beed loaded by the host application ? | |
size_t | allocAtKernelRuntime () const |
Size of the __local buffer to allocate at kernel runtime. | |
const void * | value (unsigned short index) const |
Pointer to the value of this argument, for the index vector element. | |
const void * | data () const |
Pointer to the data of this arg, equivalent to value(0) | |
Private Attributes | |
unsigned short | p_vec_dim |
File | p_file |
Kind | p_kind |
void * | p_data |
bool | p_defined |
size_t | p_runtime_alloc |
Kernel argument.
This class holds OpenCL-related information about the arguments of a kernel. It is also used to check that a kernel takes the same arguments on every device on which it has been built.
Kind of argument (its datatype)
Invalid |
Invalid argument. |
Int8 |
|
Int16 |
|
Int32 |
|
Int64 |
|
Float |
|
Double |
|
Buffer |
|
Image2D |
|
Image3D |
|
Sampler |
|
Constructor.
vec_dim | vector dimension of the argument, 1 if not a vector |
file | File of the argument |
kind | Kind of the argument |
Definition at line 446 of file kernel.cpp.
Kernel::Arg::~Arg | ( | ) |
Definition at line 453 of file kernel.cpp.
void Kernel::Arg::alloc | ( | ) |
Allocate the argument.
This function must be called before loadData()
. It allocates a buffer in which the argument value can be stored.
Definition at line 459 of file kernel.cpp.
Referenced by Coal::Kernel::setArg().
size_t Kernel::Arg::allocAtKernelRuntime | ( | ) | const |
Size of the __local
buffer to allocate at kernel runtime.
Definition at line 539 of file kernel.cpp.
Referenced by Coal::CPUKernelWorkGroup::callArgs().
const void * Kernel::Arg::data | ( | ) | const |
Pointer to the data of this arg, equivalent to value(0)
Definition at line 554 of file kernel.cpp.
Referenced by Coal::CPUKernelWorkGroup::callArgs().
bool Kernel::Arg::defined | ( | ) | const |
Has the value of this argument already beed loaded by the host application ?
Definition at line 534 of file kernel.cpp.
Kernel::Arg::File Kernel::Arg::file | ( | ) | const |
File.
Definition at line 524 of file kernel.cpp.
Referenced by Coal::CPUKernelWorkGroup::callArgs(), and Coal::Kernel::setArg().
Kernel::Arg::Kind Kernel::Arg::kind | ( | ) | const |
Kind.
Definition at line 529 of file kernel.cpp.
Referenced by Coal::CPUKernelWorkGroup::callArgs(), Coal::KernelEvent::KernelEvent(), and Coal::Kernel::setArg().
void Kernel::Arg::loadData | ( | const void * | data | ) |
Load a value into the argument.
alloc()
must have been called before this function. Definition at line 465 of file kernel.cpp.
Referenced by Coal::Kernel::setArg().
bool Kernel::Arg::operator!= | ( | const Arg & | b | ) |
Compares this argument with another.
They are different if they vec_dim
, file
or kind
are not the same.
b | other argument to compare |
b
Definition at line 482 of file kernel.cpp.
void Kernel::Arg::refineKind | ( | Kind | kind | ) |
Changes the Kind
of this argument.
kind | new Kind |
Definition at line 477 of file kernel.cpp.
Referenced by Coal::Kernel::setArg().
void Kernel::Arg::setAllocAtKernelRuntime | ( | size_t | size | ) |
Set the number of bytes that must be allocated at run-time.
__local
arguments don't take a value given by the host application, but take pointers allocated on the device for each work-group.
This function allows to set the size of the device-allocated memory buffer used by this argument.
size | size in byte of the buffer the device has to allocate for each work-group of this kernel |
Definition at line 471 of file kernel.cpp.
Referenced by Coal::Kernel::setArg().
const void * Kernel::Arg::value | ( | unsigned short | index | ) | const |
Pointer to the value of this argument, for the index
vector element.
Definition at line 544 of file kernel.cpp.
Referenced by Coal::KernelEvent::KernelEvent().
size_t Kernel::Arg::valueSize | ( | ) | const |
Size of a field of this arg.
This function returns the size of this argument based on its Kind
vecDim()
, you must do this by yourself to find the total space taken by this arg. Definition at line 491 of file kernel.cpp.
Referenced by Coal::CPUKernelWorkGroup::callArgs(), Coal::CPUKernel::callFunction(), and Coal::Kernel::setArg().
unsigned short Kernel::Arg::vecDim | ( | ) | const |
Vector dimension.
Definition at line 519 of file kernel.cpp.
Referenced by Coal::CPUKernelWorkGroup::callArgs(), and Coal::CPUKernel::callFunction().
void* Coal::Kernel::Arg::p_data [private] |
bool Coal::Kernel::Arg::p_defined [private] |
File Coal::Kernel::Arg::p_file [private] |
Definition at line 194 of file kernel.h.
Referenced by operator!=().
Kind Coal::Kernel::Arg::p_kind [private] |
Definition at line 195 of file kernel.h.
Referenced by operator!=().
size_t Coal::Kernel::Arg::p_runtime_alloc [private] |
unsigned short Coal::Kernel::Arg::p_vec_dim [private] |
Definition at line 193 of file kernel.h.
Referenced by operator!=().