![]() |
Clover Git
OpenCL 1.1 software implementation
|
CPU built-in functions. More...
#include <string>
Include dependency graph for builtins.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Namespaces | |
| namespace | Coal |
Functions | |
| void | setThreadLocalWorkGroup (Coal::CPUKernelWorkGroup *current) |
| Set the current kernel work-group of this thread. | |
| void * | getBuiltin (const std::string &name) |
| Return the address of a built-in function given its name. | |
| void * | getWorkItemsData (size_t &size) |
| Work-item stacks. | |
| void | setWorkItemsData (void *ptr, size_t size) |
| Set work-item stacks. | |
| template<typename T > | |
| bool | incVec (unsigned long dims, T *vec, T *maxs) |
| Increment a n-component vector given a maximum value. | |
| unsigned char * | imageData (unsigned char *base, size_t x, size_t y, size_t z, size_t row_pitch, size_t slice_pitch, unsigned int bytes_per_pixel) |
| Address of a pixel in an image. | |
CPU built-in functions.
Definition in file builtins.h.
| void* getBuiltin | ( | const std::string & | name | ) |
Return the address of a built-in function given its name.
| name | name of the built-in whose address is requested |
Definition at line 405 of file builtins.cpp.
References barrier(), Coal::CPUKernelWorkGroup::builtinNotFound(), g_work_group, get_global_id(), get_global_offset(), get_global_size(), get_group_id(), get_image_channel_data_type(), get_image_channel_order(), get_image_depth(), get_image_height(), get_image_width(), get_local_id(), get_local_size(), get_num_groups(), get_work_dim(), image_data(), is_image_3d(), read_imageff(), read_imagefi(), read_imageif(), read_imageii(), read_imageuif(), read_imageuii(), unimplemented_stub(), write_imagef(), write_imagei(), and write_imageui().
Referenced by Coal::CPUProgram::initJIT().
| void* getWorkItemsData | ( | size_t & | size | ) |
Work-item stacks.
| size | size of the allocated space for stacks |
Definition at line 82 of file builtins.cpp.
References work_items_data, and work_items_size.
Referenced by Coal::CPUKernelWorkGroup::barrier(), and worker().
| unsigned char* imageData | ( | unsigned char * | base, |
| size_t | x, | ||
| size_t | y, | ||
| size_t | z, | ||
| size_t | row_pitch, | ||
| size_t | slice_pitch, | ||
| unsigned int | bytes_per_pixel | ||
| ) |
Address of a pixel in an image.
This function is heavily used when Clover needs to address a pixel or a byte in a rectangular or three-dimensional image or buffer.
| base | address of the first pixel in the image (address of the image itself) |
| x | X coordinate, cannot be bigger or equal to width |
| y | Y coordinate, cannot be bigger or equal to height |
| z | Z coordinate, cannot be bigger or equal to depth (1 for 2D arrays) |
| row_pitch | size in bytes of a row of pixels in the image |
| slice_pitch | size in bytes of a slice in a 3D array |
| bytes_per_pixel | bytes per pixel (1 for simple buffers), used when coordinates are in pixels and not in bytes. |
Definition at line 57 of file builtins.cpp.
Referenced by Coal::CPUKernelWorkGroup::getImageData(), Coal::CPUDevice::initEventDeviceData(), and worker().
| bool incVec | ( | unsigned long | dims, |
| T * | vec, | ||
| T * | maxs | ||
| ) |
Increment a n-component vector given a maximum value.
This function is used to increment a vector for which a set of maximum values each of its element can reach before the next is incremented.
For example, if dims is 3, vec starts at {0, 0, 0} and maxs if {2, 3, 1}, repeatedly calling this function with the same vector will produce the following results :
{0, 0, 1}
{0, 1, 0}
{0, 1, 1}
{0, 2, 0}
{0, 2, 1}
{0, 3, 0}
{0, 3, 1}
{1, 0, 0}
...
Until vec reaches {2, 3, 1}.
| dims | number of elements in the vectors |
| vec | vector whose elements will be incremented |
| maxs | vector containing a maximum value above which each corresponding element of vec cannot go. |
vec was already at it's maximum value and couldn't be further incremented. Definition at line 101 of file builtins.h.
Referenced by Coal::CPUKernelWorkGroup::barrier(), Coal::CPUKernelWorkGroup::run(), and Coal::CPUKernelEvent::takeInstance().
| void setThreadLocalWorkGroup | ( | Coal::CPUKernelWorkGroup * | current | ) |
Set the current kernel work-group of this thread.
| current | Coal::CPUKernelWorkGroup to be set in g_work_group. |
Definition at line 77 of file builtins.cpp.
References g_work_group.
Referenced by Coal::CPUKernelWorkGroup::run().
| void setWorkItemsData | ( | void * | ptr, |
| size_t | size | ||
| ) |
Set work-item stacks.
| ptr | address of allocated space for stacks |
| size | size of the allocated space for stacks |
Definition at line 88 of file builtins.cpp.
References work_items_data, and work_items_size.
Referenced by Coal::CPUKernelWorkGroup::barrier(), and worker().
1.7.3