30 #ifndef _CCL_KERNEL_WRAPPER_H_
31 #define _CCL_KERNEL_WRAPPER_H_
145 cl_uint work_dim, const
size_t* global_work_offset,
146 const
size_t* global_work_size, const
size_t* local_work_size,
152 CCLQueue* cq, cl_uint work_dim, const
size_t* global_work_offset,
153 const
size_t* global_work_size, const
size_t* local_work_size,
155 G_GNUC_NULL_TERMINATED;
160 CCLQueue* cq, cl_uint work_dim, const
size_t* global_work_offset,
161 const
size_t* global_work_size, const
size_t* local_work_size,
168 void (CL_CALLBACK * user_func)(
void*),
void* args,
size_t cb_args,
169 cl_uint num_mos,
CCLMemObj* const* mo_list,
182 cl_uint dims, const
size_t* real_worksize,
size_t* gws,
size_t* lws,
196 #define ccl_kernel_get_info(krnl, param_name, err) \
197 ccl_wrapper_get_info((CCLWrapper*) (krnl), NULL, (param_name), 0, \
198 CCL_INFO_KERNEL, CL_FALSE, (err))
216 #define ccl_kernel_get_info_scalar(krnl, param_name, param_type, err) \
217 *((param_type*) ccl_wrapper_get_info_value((CCLWrapper*) (krnl), \
218 NULL, (param_name), sizeof(param_type), \
219 CCL_INFO_KERNEL, CL_FALSE, (err)))
237 #define ccl_kernel_get_info_array(krnl, param_name, param_type, err) \
238 (param_type) ccl_wrapper_get_info_value((CCLWrapper*) (krnl), \
239 NULL, (param_name), sizeof(param_type), \
240 CCL_INFO_KERNEL, CL_FALSE, (err))
254 #define ccl_kernel_get_workgroup_info(krnl, dev, param_name, err) \
255 ccl_wrapper_get_info((CCLWrapper*) (krnl), (CCLWrapper*) (dev), \
256 (param_name), 0, CCL_INFO_KERNEL_WORKGROUP, CL_FALSE, (err))
276 #define ccl_kernel_get_workgroup_info_scalar(krnl, dev, param_name, \
278 *((param_type*) ccl_wrapper_get_info_value((CCLWrapper*) (krnl), \
279 (CCLWrapper*) (dev), (param_name), sizeof(param_type), \
280 CCL_INFO_KERNEL_WORKGROUP, CL_FALSE, (err)))
300 #define ccl_kernel_get_workgroup_info_array(krnl, dev, param_name, \
302 (param_type) ccl_wrapper_get_info_value((CCLWrapper*) (krnl), \
303 (CCLWrapper*) (dev), (param_name), sizeof(param_type), \
304 CCL_INFO_KERNEL_WORKGROUP, CL_FALSE, (err))
309 cl_kernel_arg_info param_name,
CCLErr** err);
329 #define ccl_kernel_get_arg_info_scalar(krnl, idx, param_name, \
332 ((ccl_kernel_get_arg_info((krnl), (idx), (param_name), (err)) != NULL) \
333 ? **((param_type**) ccl_kernel_get_arg_info( \
334 (krnl), (idx), (param_name), (err))) \
355 #define ccl_kernel_get_arg_info_array(krnl, idx, param_name, \
357 (ccl_kernel_get_arg_info((krnl), (idx), (param_name), (err)) != NULL) \
358 ? *((param_type*) ccl_kernel_get_arg_info( \
359 (krnl), (idx), (param_name), (err))) \
367 #define ccl_kernel_ref(krnl) \
368 ccl_wrapper_ref((CCLWrapper*) (krnl))
376 #define ccl_kernel_unref(krnl) ccl_kernel_destroy(krnl)
384 #define ccl_kernel_unwrap(krnl) \
385 ((cl_kernel) ccl_wrapper_unwrap((CCLWrapper*) (krnl)))
void ccl_kernel_destroy(CCLKernel *krnl)
Decrements the reference count of the kernel wrapper object.
CCLEvent * ccl_kernel_set_args_and_enqueue_ndrange_v(CCLKernel *krnl, CCLQueue *cq, cl_uint work_dim, const size_t *global_work_offset, const size_t *global_work_size, const size_t *local_work_size, CCLEventWaitList *evt_wait_lst, void **args, CCLErr **err)
Set kernel arguments and enqueue it for execution on a device.
GPtrArray * CCLEventWaitList
A list of event objects on which enqueued commands can wait.
Definition of a wrapper class and its methods for OpenCL event objects.
CCLWrapperInfo * ccl_kernel_get_arg_info(CCLKernel *krnl, cl_uint idx, cl_kernel_arg_info param_name, CCLErr **err)
Get a CCLWrapperInfo kernel argument information object.
cl_uint ccl_kernel_get_opencl_version(CCLKernel *krnl, CCLErr **err)
Get the OpenCL version of the platform associated with this kernel.
Base class for memory object wrappers, i.e., CCLBuffer and CCLImage.
Command queue wrapper class.
void ccl_kernel_set_args(CCLKernel *krnl,...)
Set all kernel arguments.
cl_bool ccl_kernel_suggest_worksizes(CCLKernel *krnl, CCLDevice *dev, cl_uint dims, const size_t *real_worksize, size_t *gws, size_t *lws, CCLErr **err)
Suggest appropriate local (and optionally global) work sizes for the given real work size...
Definition of a wrapper type and related functions for a OpenCL kernel arguments. ...
Definition of an abstract wrapper class and its methods for OpenCL objects.
CCLEvent * ccl_kernel_enqueue_native(CCLQueue *cq, void(*user_func)(void *), void *args, size_t cb_args, cl_uint num_mos, CCLMemObj *const *mo_list, const void **args_mem_loc, CCLEventWaitList *evt_wait_lst, CCLErr **err)
Enqueues a command to execute a native C/C++ function not compiled using the OpenCL compiler...
CCLKernel * ccl_kernel_new_wrap(cl_kernel kernel)
Get the kernel wrapper for the given OpenCL kernel.
Header for normalizing OpenCL versions within cf4ocl.
CCLEvent * ccl_kernel_enqueue_ndrange(CCLKernel *krnl, CCLQueue *cq, cl_uint work_dim, const size_t *global_work_offset, const size_t *global_work_size, const size_t *local_work_size, CCLEventWaitList *evt_wait_lst, CCLErr **err)
Enqueues a kernel for execution on a device.
Class which represents information about a wrapped OpenCL object.
void ccl_kernel_set_arg(CCLKernel *krnl, cl_uint arg_index, void *arg)
Set one kernel argument.
GError CCLErr
Error handling class.
void ccl_kernel_set_args_v(CCLKernel *krnl, void **args)
Set all kernel arguments.
Definition of a wrapper class and its methods for OpenCL memory objects.
Definition of a wrapper class and its methods for OpenCL queue objects.
CCLKernel * ccl_kernel_new(CCLProgram *prg, const char *kernel_name, CCLErr **err)
Create a new kernel wrapper object.
CCLEvent * ccl_kernel_set_args_and_enqueue_ndrange(CCLKernel *krnl, CCLQueue *cq, cl_uint work_dim, const size_t *global_work_offset, const size_t *global_work_size, const size_t *local_work_size, CCLEventWaitList *evt_wait_lst, CCLErr **err,...)
Set kernel arguments and enqueue it for execution on a device.