OpenCL C++ Bindings
cl::Kernel Class Reference

Class interface for cl_kernel. More...

#include <opencl.hpp>

Inheritance diagram for cl::Kernel:
cl::detail::Wrapper< cl_kernel >

Public Member Functions

 Kernel (const Program &program, const char *name, cl_int *err=NULL)
 
 Kernel ()
 Default constructor - initializes to NULL. More...
 
 Kernel (const cl_kernel &kernel, bool retainObject=false)
 Constructor from cl_kernel - takes ownership. More...
 
Kerneloperator= (const cl_kernel &rhs)
 Assignment operator from cl_kernel - takes ownership. More...
 
 Kernel (const Kernel &kernel)
 Copy constructor to forward copy to the superclass correctly. Required for MSVC. More...
 
Kerneloperator= (const Kernel &kernel)
 Copy assignment to forward copy to the superclass correctly. Required for MSVC. More...
 
 Kernel (Kernel &&kernel) CL_HPP_NOEXCEPT_
 Move constructor to forward move to the superclass correctly. Required for MSVC. More...
 
Kerneloperator= (Kernel &&kernel)
 Move assignment to forward move to the superclass correctly. Required for MSVC. More...
 
template<typename T >
cl_int getInfo (cl_kernel_info name, T *param) const
 
template<cl_kernel_info name>
detail::param_traits< detail::cl_kernel_info, name >::param_type getInfo (cl_int *err=NULL) const
 
template<typename T >
cl_int getArgInfo (cl_uint argIndex, cl_kernel_arg_info name, T *param) const
 
template<cl_kernel_arg_info name>
detail::param_traits< detail::cl_kernel_arg_info, name >::param_type getArgInfo (cl_uint argIndex, cl_int *err=NULL) const
 
template<typename T >
cl_int getWorkGroupInfo (const Device &device, cl_kernel_work_group_info name, T *param) const
 
template<cl_kernel_work_group_info name>
detail::param_traits< detail::cl_kernel_work_group_info, name >::param_type getWorkGroupInfo (const Device &device, cl_int *err=NULL) const
 
cl_int getSubGroupInfo (const cl::Device &dev, cl_kernel_sub_group_info name, const cl::NDRange &range, size_type *param) const
 
template<cl_kernel_sub_group_info name>
size_type getSubGroupInfo (const cl::Device &dev, const cl::NDRange &range, cl_int *err=NULL) const
 
template<typename T , class D >
cl_int setArg (cl_uint index, const cl::pointer< T, D > &argPtr)
 setArg overload taking a shared_ptr type More...
 
template<typename T , class Alloc >
cl_int setArg (cl_uint index, const cl::vector< T, Alloc > &argPtr)
 setArg overload taking a vector type. More...
 
template<typename T >
std::enable_if< std::is_pointer< T >::value, cl_int >::type setArg (cl_uint index, const T argPtr)
 setArg overload taking a pointer type More...
 
template<typename T >
std::enable_if<!std::is_pointer< T >::value, cl_int >::type setArg (cl_uint index, const T &value)
 setArg overload taking a POD type More...
 
cl_int setArg (cl_uint index, size_type size, const void *argPtr)
 
cl_int setSVMPointers (const vector< void * > &pointerList)
 
template<int ArrayLength>
cl_int setSVMPointers (const std::array< void *, ArrayLength > &pointerList)
 
cl_int enableFineGrainedSystemSVM (bool svmEnabled)
 Enable fine-grained system SVM. More...
 
template<int index, int ArrayLength, class D , typename T0 , typename T1 , typename... Ts>
void setSVMPointersHelper (std::array< void *, ArrayLength > &pointerList, const pointer< T0, D > &t0, const pointer< T1, D > &t1, Ts &... ts)
 
template<int index, int ArrayLength, typename T0 , typename T1 , typename... Ts>
std::enable_if< std::is_pointer< T0 >::value, void >::type setSVMPointersHelper (std::array< void *, ArrayLength > &pointerList, T0 t0, T1 t1, Ts... ts)
 
template<int index, int ArrayLength, typename T0 , class D >
void setSVMPointersHelper (std::array< void *, ArrayLength > &pointerList, const pointer< T0, D > &t0)
 
template<int index, int ArrayLength, typename T0 >
std::enable_if< std::is_pointer< T0 >::value, void >::type setSVMPointersHelper (std::array< void *, ArrayLength > &pointerList, T0 t0)
 
template<typename T0 , typename... Ts>
cl_int setSVMPointers (const T0 &t0, Ts &... ts)
 
template<typename T >
cl_int setExecInfo (cl_kernel_exec_info param_name, const T &val)
 
template<cl_kernel_exec_info name>
cl_int setExecInfo (typename detail::param_traits< detail::cl_kernel_exec_info, name >::param_type &val)
 
Kernel clone ()
 
- Public Member Functions inherited from cl::detail::Wrapper< cl_kernel >
 Wrapper (const cl_type &obj, bool retainObject)
 
 Wrapper (const Wrapper< cl_type > &rhs)
 
 Wrapper (Wrapper< cl_type > &&rhs) CL_HPP_NOEXCEPT_
 
Wrapper< cl_type > & operator= (const Wrapper< cl_type > &rhs)
 
Wrapper< cl_type > & operator= (Wrapper< cl_type > &&rhs)
 
Wrapper< cl_type > & operator= (const cl_type &rhs)
 
const cl_type & operator() () const
 
cl_type & operator() ()
 
cl_type get () const
 

Additional Inherited Members

- Public Types inherited from cl::detail::Wrapper< cl_kernel >
typedef cl_kernel cl_type
 
- Protected Member Functions inherited from cl::detail::Wrapper< cl_kernel >
cl_int retain () const
 
cl_int release () const
 
- Protected Attributes inherited from cl::detail::Wrapper< cl_kernel >
cl_type object_
 

Detailed Description

Class interface for cl_kernel.

Note
Copies of these objects are shallow, meaning that the copy will refer to the same underlying cl_kernel as the original. For details, see clRetainKernel() and clReleaseKernel().
See also
cl_kernel

Definition at line 5921 of file opencl.hpp.

Constructor & Destructor Documentation

◆ Kernel() [1/5]

cl::Kernel::Kernel ( const Program program,
const char *  name,
cl_int *  err = NULL 
)
inline

Definition at line 7087 of file opencl.hpp.

◆ Kernel() [2/5]

cl::Kernel::Kernel ( )
inline

Default constructor - initializes to NULL.

Definition at line 5927 of file opencl.hpp.

◆ Kernel() [3/5]

cl::Kernel::Kernel ( const cl_kernel &  kernel,
bool  retainObject = false 
)
inlineexplicit

Constructor from cl_kernel - takes ownership.

Parameters
retainObjectwill cause the constructor to retain its cl object. Defaults to false to maintain compatibility with earlier versions. This effectively transfers ownership of a refcount on the cl_kernel into the new Kernel object.

Definition at line 5937 of file opencl.hpp.

◆ Kernel() [4/5]

cl::Kernel::Kernel ( const Kernel kernel)
inline

Copy constructor to forward copy to the superclass correctly. Required for MSVC.

Definition at line 5954 of file opencl.hpp.

◆ Kernel() [5/5]

cl::Kernel::Kernel ( Kernel &&  kernel)
inline

Move constructor to forward move to the superclass correctly. Required for MSVC.

Definition at line 5968 of file opencl.hpp.

Member Function Documentation

◆ clone()

Kernel cl::Kernel::clone ( )
inline

Make a deep copy of the kernel object including its arguments.

Returns
A new kernel object with internal state entirely separate from that of the original but with any arguments set on the original intact.

Definition at line 6256 of file opencl.hpp.

◆ enableFineGrainedSystemSVM()

cl_int cl::Kernel::enableFineGrainedSystemSVM ( bool  svmEnabled)
inline

Enable fine-grained system SVM.

Note
It is only possible to enable fine-grained system SVM if all devices in the context associated with kernel support it.
Parameters
svmEnabledTrue if fine-grained system SVM is requested. False otherwise.
Returns
CL_SUCCESS if the function was executed succesfully. CL_INVALID_OPERATION if no devices in the context support fine-grained system SVM.
See also
clSetKernelExecInfo

Definition at line 6176 of file opencl.hpp.

◆ getArgInfo() [1/2]

template<cl_kernel_arg_info name>
detail::param_traits< detail::cl_kernel_arg_info, name >::param_type cl::Kernel::getArgInfo ( cl_uint  argIndex,
cl_int *  err = NULL 
) const
inline

Definition at line 6011 of file opencl.hpp.

◆ getArgInfo() [2/2]

template<typename T >
cl_int cl::Kernel::getArgInfo ( cl_uint  argIndex,
cl_kernel_arg_info  name,
T *  param 
) const
inline

Definition at line 6002 of file opencl.hpp.

◆ getInfo() [1/2]

template<cl_kernel_info name>
detail::param_traits< detail::cl_kernel_info, name >::param_type cl::Kernel::getInfo ( cl_int *  err = NULL) const
inline

Definition at line 5989 of file opencl.hpp.

◆ getInfo() [2/2]

template<typename T >
cl_int cl::Kernel::getInfo ( cl_kernel_info  name,
T *  param 
) const
inline

Definition at line 5980 of file opencl.hpp.

◆ getSubGroupInfo() [1/2]

cl_int cl::Kernel::getSubGroupInfo ( const cl::Device dev,
cl_kernel_sub_group_info  name,
const cl::NDRange range,
size_type *  param 
) const
inline

Definition at line 6047 of file opencl.hpp.

◆ getSubGroupInfo() [2/2]

template<cl_kernel_sub_group_info name>
size_type cl::Kernel::getSubGroupInfo ( const cl::Device dev,
const cl::NDRange range,
cl_int *  err = NULL 
) const
inline

Definition at line 6069 of file opencl.hpp.

◆ getWorkGroupInfo() [1/2]

template<cl_kernel_work_group_info name>
detail::param_traits< detail::cl_kernel_work_group_info, name >::param_type cl::Kernel::getWorkGroupInfo ( const Device device,
cl_int *  err = NULL 
) const
inline

Definition at line 6035 of file opencl.hpp.

◆ getWorkGroupInfo() [2/2]

template<typename T >
cl_int cl::Kernel::getWorkGroupInfo ( const Device device,
cl_kernel_work_group_info  name,
T *  param 
) const
inline

Definition at line 6024 of file opencl.hpp.

◆ operator=() [1/3]

Kernel & cl::Kernel::operator= ( const cl_kernel &  rhs)
inline

Assignment operator from cl_kernel - takes ownership.

This effectively transfers ownership of a refcount on the rhs and calls clReleaseKernel() on the value previously held by this instance.

Definition at line 5945 of file opencl.hpp.

◆ operator=() [2/3]

Kernel & cl::Kernel::operator= ( const Kernel kernel)
inline

Copy assignment to forward copy to the superclass correctly. Required for MSVC.

Definition at line 5959 of file opencl.hpp.

◆ operator=() [3/3]

Kernel & cl::Kernel::operator= ( Kernel &&  kernel)
inline

Move assignment to forward move to the superclass correctly. Required for MSVC.

Definition at line 5973 of file opencl.hpp.

◆ setArg() [1/5]

template<typename T , class D >
cl_int cl::Kernel::setArg ( cl_uint  index,
const cl::pointer< T, D > &  argPtr 
)
inline

setArg overload taking a shared_ptr type

Definition at line 6084 of file opencl.hpp.

◆ setArg() [2/5]

template<typename T , class Alloc >
cl_int cl::Kernel::setArg ( cl_uint  index,
const cl::vector< T, Alloc > &  argPtr 
)
inline

setArg overload taking a vector type.

Definition at line 6094 of file opencl.hpp.

◆ setArg() [3/5]

template<typename T >
std::enable_if<!std::is_pointer< T >::value, cl_int >::type cl::Kernel::setArg ( cl_uint  index,
const T &  value 
)
inline

setArg overload taking a POD type

Definition at line 6117 of file opencl.hpp.

◆ setArg() [4/5]

template<typename T >
std::enable_if< std::is_pointer< T >::value, cl_int >::type cl::Kernel::setArg ( cl_uint  index,
const T  argPtr 
)
inline

setArg overload taking a pointer type

Definition at line 6105 of file opencl.hpp.

◆ setArg() [5/5]

cl_int cl::Kernel::setArg ( cl_uint  index,
size_type  size,
const void *  argPtr 
)
inline

Definition at line 6128 of file opencl.hpp.

◆ setExecInfo() [1/2]

template<typename T >
cl_int cl::Kernel::setExecInfo ( cl_kernel_exec_info  param_name,
const T &  val 
)
inline

Definition at line 6233 of file opencl.hpp.

◆ setExecInfo() [2/2]

template<cl_kernel_exec_info name>
cl_int cl::Kernel::setExecInfo ( typename detail::param_traits< detail::cl_kernel_exec_info, name >::param_type &  val)
inline

Definition at line 6244 of file opencl.hpp.

◆ setSVMPointers() [1/3]

template<int ArrayLength>
cl_int cl::Kernel::setSVMPointers ( const std::array< void *, ArrayLength > &  pointerList)
inline

Specify a std::array of SVM pointers that the kernel may access in addition to its arguments.

Definition at line 6155 of file opencl.hpp.

◆ setSVMPointers() [2/3]

template<typename T0 , typename... Ts>
cl_int cl::Kernel::setSVMPointers ( const T0 &  t0,
Ts &...  ts 
)
inline

Definition at line 6219 of file opencl.hpp.

◆ setSVMPointers() [3/3]

cl_int cl::Kernel::setSVMPointers ( const vector< void * > &  pointerList)
inline

Specify a vector of SVM pointers that the kernel may access in addition to its arguments.

Definition at line 6140 of file opencl.hpp.

◆ setSVMPointersHelper() [1/4]

template<int index, int ArrayLength, typename T0 , class D >
void cl::Kernel::setSVMPointersHelper ( std::array< void *, ArrayLength > &  pointerList,
const pointer< T0, D > &  t0 
)
inline

Definition at line 6205 of file opencl.hpp.

◆ setSVMPointersHelper() [2/4]

template<int index, int ArrayLength, class D , typename T0 , typename T1 , typename... Ts>
void cl::Kernel::setSVMPointersHelper ( std::array< void *, ArrayLength > &  pointerList,
const pointer< T0, D > &  t0,
const pointer< T1, D > &  t1,
Ts &...  ts 
)
inline

Definition at line 6190 of file opencl.hpp.

◆ setSVMPointersHelper() [3/4]

template<int index, int ArrayLength, typename T0 >
std::enable_if< std::is_pointer< T0 >::value, void >::type cl::Kernel::setSVMPointersHelper ( std::array< void *, ArrayLength > &  pointerList,
T0  t0 
)
inline

Definition at line 6213 of file opencl.hpp.

◆ setSVMPointersHelper() [4/4]

template<int index, int ArrayLength, typename T0 , typename T1 , typename... Ts>
std::enable_if< std::is_pointer< T0 >::value, void >::type cl::Kernel::setSVMPointersHelper ( std::array< void *, ArrayLength > &  pointerList,
T0  t0,
T1  t1,
Ts...  ts 
)
inline

Definition at line 6198 of file opencl.hpp.


The documentation for this class was generated from the following file: