DPC++ Runtime
Runtime libraries for oneAPI Data Parallel C++
cl::sycl::kernel Class Reference

Provides an abstraction of a SYCL kernel. More...

#include <CL/sycl/kernel.hpp>

Collaboration diagram for cl::sycl::kernel:

Public Member Functions

 __SYCL2020_DEPRECATED ("OpenCL interop constructors are deprecated, use make_kernel() instead") kernel(cl_kernel ClKernel
 Constructs a SYCL kernel instance from an OpenCL cl_kernel. More...
 
 kernel (const kernel &RHS)=default
 
 kernel (kernel &&RHS)=default
 
kerneloperator= (const kernel &RHS)=default
 
kerneloperator= (kernel &&RHS)=default
 
bool operator== (const kernel &RHS) const
 
bool operator!= (const kernel &RHS) const
 
 __SYCL2020_DEPRECATED ("OpenCL interop get() functions are deprecated, use get_native() instead") cl_kernel get() const
 Get a valid OpenCL kernel handle. More...
 
bool is_host () const
 Check if the associated SYCL context is a SYCL host context. More...
 
context get_context () const
 Get the context that this kernel is defined for. More...
 
kernel_bundle< bundle_state::executableget_kernel_bundle () const
 Get the kernel_bundle associated with this kernel. More...
 
program get_program () const
 Get the program that this kernel is defined for. More...
 
template<info::kernel param>
info::param_traits< info::kernel, param >::return_type get_info () const
 Query information from the kernel object using the info::kernel_info descriptor. More...
 
template<info::kernel_device_specific param>
info::param_traits< info::kernel_device_specific, param >::return_type get_info (const device &Device) const
 Query device-specific information from the kernel object using the info::kernel_device_specific descriptor. More...
 
template<info::kernel_device_specific param>
info::param_traits< info::kernel_device_specific, param >::return_type get_info (const device &Device, typename info::param_traits< info::kernel_device_specific, param >::input_type Value) const
 Query device-specific information from a kernel using the info::kernel_device_specific descriptor for a specific device and value. More...
 
template<info::kernel_sub_group param>
__SYCL2020_DEPRECATED("get_work_group_info() is deprecated, use SYCL 2020 " "kernel_device_specific queries instead") typename info info::param_traits< info::kernel_sub_group, param >::return_type get_sub_group_info (const device &Device) const
 Query work-group information from a kernel using the info::kernel_work_group descriptor for a specific device. More...
 
template<info::kernel_sub_group param>
info::param_traits< info::kernel_sub_group, param >::return_type get_sub_group_info (const device &Device, typename info::param_traits< info::kernel_sub_group, param >::input_type Value) const
 Query sub-group information from a kernel using the info::kernel_sub_group descriptor for a specific device and value. More...
 
template<backend Backend>
backend_traits< Backend >::template return_type< kernelget_native () const
 
template<info::kernel_sub_group param>
info::param_traits< info::kernel_sub_group, param >::return_type get_sub_group_info (const device &dev) const
 

Public Attributes

const contextSyclContext
 

Friends

template<class T >
T detail::createSyclObjFromImpl (decltype(T::impl) ImplObj)
 

Detailed Description

Provides an abstraction of a SYCL kernel.

See also
sycl_api_exec
program
queue

Definition at line 65 of file kernel.hpp.

Constructor & Destructor Documentation

◆ kernel() [1/2]

cl::sycl::kernel::kernel ( const kernel RHS)
default

◆ kernel() [2/2]

cl::sycl::kernel::kernel ( kernel &&  RHS)
default

Member Function Documentation

◆ __SYCL2020_DEPRECATED() [1/2]

cl::sycl::kernel::__SYCL2020_DEPRECATED ( "OpenCL interop constructors are  deprecated,
use make_kernel() instead  
)

Constructs a SYCL kernel instance from an OpenCL cl_kernel.

The requirements for this constructor are described in section 4.3.1 of the SYCL specification.

Parameters
ClKernelis a valid OpenCL cl_kernel instance
SyclContextis a valid SYCL context

◆ __SYCL2020_DEPRECATED() [2/2]

cl::sycl::kernel::__SYCL2020_DEPRECATED ( "OpenCL interop get() functions are  deprecated,
use get_native() instead  
) const

Get a valid OpenCL kernel handle.

If this kernel encapsulates an instance of OpenCL kernel, a valid cl_kernel will be returned. If this kernel is a host kernel, an invalid_object_error exception will be thrown.

Returns
a valid cl_kernel instance

◆ get_context()

context cl::sycl::kernel::get_context ( ) const

Get the context that this kernel is defined for.

The value returned must be equal to that returned by get_info<info::kernel::context>().

Returns
a valid SYCL context

Definition at line 28 of file kernel.cpp.

References cl::sycl::info::context.

◆ get_info() [1/3]

template<info::kernel param>
info::param_traits< info::kernel, param >::return_type cl::sycl::kernel::get_info

Query information from the kernel object using the info::kernel_info descriptor.

Returns
depends on information being queried.

Definition at line 44 of file kernel.cpp.

◆ get_info() [2/3]

template<info::kernel_device_specific param>
info::param_traits< info::kernel_device_specific, param >::return_type cl::sycl::kernel::get_info ( const device Device) const

Query device-specific information from the kernel object using the info::kernel_device_specific descriptor.

Parameters
Deviceis a valid SYCL device to query info for.
Returns
depends on information being queried.

Definition at line 58 of file kernel.cpp.

◆ get_info() [3/3]

template<info::kernel_device_specific param>
info::param_traits< info::kernel_device_specific, param >::return_type cl::sycl::kernel::get_info ( const device Device,
typename info::param_traits< info::kernel_device_specific, param >::input_type  Value 
) const

Query device-specific information from a kernel using the info::kernel_device_specific descriptor for a specific device and value.

Parameters
Deviceis a valid SYCL device.
Valuedepends on information being queried.
Returns
depends on information being queried.

Definition at line 64 of file kernel.cpp.

◆ get_kernel_bundle()

kernel_bundle< sycl::bundle_state::executable > cl::sycl::kernel::get_kernel_bundle ( ) const

Get the kernel_bundle associated with this kernel.

Returns
a valid kernel_bundle<bundle_state::executable>

Definition at line 33 of file kernel.cpp.

References cl::sycl::detail::createSyclObjFromImpl().

◆ get_native()

template<backend Backend>
backend_traits<Backend>::template return_type<kernel> cl::sycl::kernel::get_native ( ) const
inline

Definition at line 196 of file kernel.hpp.

References cast().

◆ get_program()

program cl::sycl::kernel::get_program ( ) const

Get the program that this kernel is defined for.

The value returned must be equal to that returned by get_info<info::kernel::program>().

Returns
a valid SYCL program

Definition at line 38 of file kernel.cpp.

References cl::sycl::info::program.

◆ get_sub_group_info() [1/3]

template<info::kernel_sub_group param>
info::param_traits<info::kernel_sub_group, param>::return_type cl::sycl::kernel::get_sub_group_info ( const device dev) const

Definition at line 99 of file kernel.cpp.

◆ get_sub_group_info() [2/3]

template<info::kernel_sub_group param>
__SYCL2020_DEPRECATED ("get_work_group_info() is deprecated, use SYCL 2020 " "kernel_device_specific queries instead") typename info info::param_traits<info::kernel_sub_group, param>::return_type cl::sycl::kernel::get_sub_group_info ( const device Device) const

Query work-group information from a kernel using the info::kernel_work_group descriptor for a specific device.

Parameters
Deviceis a valid SYCL device.
Returns
depends on information being queried. Query sub-group information from a kernel using the info::kernel_sub_group descriptor for a specific device.
Parameters
Deviceis a valid SYCL device.
Returns
depends on information being queried.

◆ get_sub_group_info() [3/3]

template<info::kernel_sub_group param>
info::param_traits< info::kernel_sub_group, param >::return_type cl::sycl::kernel::get_sub_group_info ( const device Device,
typename info::param_traits< info::kernel_sub_group, param >::input_type  Value 
) const

Query sub-group information from a kernel using the info::kernel_sub_group descriptor for a specific device and value.

Parameters
Deviceis a valid SYCL device.
Valuedepends on information being queried.
Returns
depends on information being queried.

Definition at line 105 of file kernel.cpp.

◆ is_host()

bool cl::sycl::kernel::is_host ( ) const

Check if the associated SYCL context is a SYCL host context.

Returns
true if this SYCL kernel is a host kernel.

Definition at line 26 of file kernel.cpp.

◆ operator!=()

bool cl::sycl::kernel::operator!= ( const kernel RHS) const
inline

Definition at line 88 of file kernel.hpp.

References operator==().

◆ operator=() [1/2]

kernel& cl::sycl::kernel::operator= ( const kernel RHS)
default

◆ operator=() [2/2]

kernel& cl::sycl::kernel::operator= ( kernel &&  RHS)
default

◆ operator==()

bool cl::sycl::kernel::operator== ( const kernel RHS) const
inline

Definition at line 86 of file kernel.hpp.

Friends And Related Function Documentation

◆ detail::createSyclObjFromImpl

template<class T >
T detail::createSyclObjFromImpl ( decltype(T::impl)  ImplObj)
friend

Member Data Documentation

◆ SyclContext

const context& cl::sycl::kernel::SyclContext

Definition at line 76 of file kernel.hpp.


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