DPC++ Runtime
Runtime libraries for oneAPI DPC++
sycl::_V1::kernel Class Reference

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

#include <sycl/kernel.hpp>

Inheritance diagram for sycl::_V1::kernel:
Collaboration diagram for sycl::_V1::kernel:

Public Member Functions

 kernel (const kernel &RHS)=default
 Constructs a SYCL kernel instance from an OpenCL cl_kernel. More...
 
 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 ("is_host() is deprecated as the host device is no longer supported.") bool is_host() const
 Get a valid OpenCL kernel handle. More...
 
context get_context () const
 Get the context that this kernel is defined for. More...
 
backend get_backend () const noexcept
 Returns the backend associated with this kernel. More...
 
kernel_bundle< bundle_state::executableget_kernel_bundle () const
 Get the kernel_bundle associated with this kernel. More...
 
template<typename Param >
detail::is_kernel_info_desc< Param >::return_type get_info () const
 Query information from the kernel object using the info::kernel_info descriptor. More...
 
template<typename Param >
detail::is_kernel_device_specific_info_desc< 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<typename Param >
detail::is_kernel_device_specific_info_desc< Param >::return_type get_info (const device &Device, const range< 3 > &WGSize) const
 Query device-specific information from a kernel using the info::kernel_device_specific descriptor for a specific device and value. More...
 
- Public Member Functions inherited from sycl::_V1::detail::OwnerLessBase< kernel >
bool ext_oneapi_owner_before (const ext::oneapi::detail::weak_object_base< kernel > &Other) const noexcept
 Compares the object against a weak object using an owner-based implementation-defined ordering. More...
 
bool ext_oneapi_owner_before (const kernel &Other) const noexcept
 Compares the object against another object using an owner-based implementation-defined ordering. More...
 

Friends

template<class T >
detail::createSyclObjFromImpl (decltype(T::impl) ImplObj)
 
template<backend BackendName, class SyclObjectT >
auto get_native (const SyclObjectT &Obj) -> backend_return_t< BackendName, SyclObjectT >
 

Detailed Description

Provides an abstraction of a SYCL kernel.

See also
sycl_api_exec
program
queue

Definition at line 71 of file kernel.hpp.

Constructor & Destructor Documentation

◆ kernel() [1/2]

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

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

◆ kernel() [2/2]

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

Member Function Documentation

◆ __SYCL2020_DEPRECATED()

sycl::_V1::kernel::__SYCL2020_DEPRECATED ( "is_host() is deprecated as the host device is no longer supported."  ) 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 Check if the associated SYCL context is a SYCL host context.
true if this SYCL kernel is a host kernel.

◆ get_backend()

backend sycl::_V1::kernel::get_backend ( ) const
noexcept

Returns the backend associated with this kernel.

Returns
the backend associated with this kernel.

Definition at line 41 of file kernel.cpp.

References sycl::_V1::detail::getImplBackend().

◆ get_context()

context sycl::_V1::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 37 of file kernel.cpp.

References sycl::_V1::context::get_info().

◆ get_info() [1/3]

template<typename Param >
detail::is_kernel_info_desc< Param >::return_type sycl::_V1::kernel::get_info

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

Returns
depends on information being queried.

Definition at line 51 of file kernel.cpp.

◆ get_info() [2/3]

template<typename Param >
detail::is_kernel_device_specific_info_desc< Param >::return_type sycl::_V1::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 64 of file kernel.cpp.

◆ get_info() [3/3]

template<typename Param >
detail::is_kernel_device_specific_info_desc< Param >::return_type sycl::_V1::kernel::get_info ( const device Device,
const range< 3 > &  WGSize 
) const

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

max_sub_group_size is the only valid descriptor for this function.

Parameters
Deviceis a valid SYCL device.
WGSizeis the work-group size the sub-group size is requested for.
Returns
depends on information being queried.

Definition at line 72 of file kernel.cpp.

References Device.

◆ get_kernel_bundle()

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

Get the kernel_bundle associated with this kernel.

Returns
a valid kernel_bundle<bundle_state::executable>

Definition at line 44 of file kernel.cpp.

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

◆ operator!=()

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

Definition at line 94 of file kernel.hpp.

References operator==().

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ operator==()

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

Definition at line 92 of file kernel.hpp.

Friends And Related Function Documentation

◆ detail::createSyclObjFromImpl

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

◆ get_native

template<backend BackendName, class SyclObjectT >
auto get_native ( const SyclObjectT &  Obj) -> backend_return_t< BackendName, SyclObjectT >
friend

Definition at line 123 of file backend.hpp.


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