The context class represents a SYCL context on which kernel functions may be executed. More...
#include <sycl/context.hpp>
Public Member Functions | |
context (const property_list &PropList={}) | |
Constructs a SYCL context instance using an instance of default_selector. More... | |
context (const async_handler &AsyncHandler, const property_list &PropList={}) | |
Constructs a SYCL context instance using an instance of default_selector. More... | |
context (const device &Device, const property_list &PropList={}) | |
Constructs a SYCL context instance using the provided device. More... | |
context (const device &Device, async_handler AsyncHandler, const property_list &PropList={}) | |
Constructs a SYCL context instance using the provided device. More... | |
context (const platform &Platform, const property_list &PropList={}) | |
Constructs a SYCL context instance using the provided platform. More... | |
context (const platform &Platform, async_handler AsyncHandler, const property_list &PropList={}) | |
Constructs a SYCL context instance using the provided platform. More... | |
context (const std::vector< device > &DeviceList, const property_list &PropList={}) | |
Constructs a SYCL context instance using list of devices. More... | |
context (const std::vector< device > &DeviceList, async_handler AsyncHandler, const property_list &PropList={}) | |
Constructs a SYCL context instance using list of devices. More... | |
template<typename Param > | |
detail::is_context_info_desc< Param >::return_type | get_info () const |
Constructs a SYCL context instance from OpenCL cl_context. More... | |
context (const context &rhs)=default | |
context (context &&rhs)=default | |
context & | operator= (const context &rhs)=default |
context & | operator= (context &&rhs)=default |
bool | operator== (const context &rhs) const |
bool | operator!= (const context &rhs) const |
template<typename propertyT > | |
bool | has_property () const noexcept |
Checks if this context has a property of type propertyT. More... | |
template<typename propertyT > | |
propertyT | get_property () const |
Gets the specified property of this context. More... | |
__SYCL2020_DEPRECATED ("is_host() is deprecated as the host device is no longer supported.") bool is_host() const | |
Gets OpenCL interoperability context. More... | |
backend | get_backend () const noexcept |
Returns the backend associated with this context. More... | |
platform | get_platform () const |
Gets platform associated with this SYCL context. More... | |
std::vector< device > | get_devices () const |
Gets devices associated with this SYCL context. More... | |
![]() | |
bool | ext_oneapi_owner_before (const ext::oneapi::detail::weak_object_base< context > &Other) const noexcept |
Compares the object against a weak object using an owner-based implementation-defined ordering. More... | |
bool | ext_oneapi_owner_before (const context &Other) const noexcept |
Compares the object against another object using an owner-based implementation-defined ordering. More... | |
Friends | |
template<backend Backend, class SyclT > | |
auto | get_native (const SyclT &Obj) -> backend_return_t< Backend, SyclT > |
template<class T > | |
std::add_pointer_t< typename decltype(T::impl)::element_type > | detail::getRawSyclObjImpl (const T &SyclObject) |
template<class T > | |
T | detail::createSyclObjFromImpl (decltype(T::impl) ImplObj) |
The context class represents a SYCL context on which kernel functions may be executed.
Definition at line 51 of file context.hpp.
|
explicit |
Constructs a SYCL context instance using an instance of default_selector.
The instance of default_selector is used to select the associated platform and device(s). SYCL properties are passed to the constructed SYCL context through PropList.
PropList | is an instance of property_list. |
Definition at line 30 of file context.cpp.
|
explicit |
Constructs a SYCL context instance using an instance of default_selector.
The instance of default_selector is used to select the associated platform and device(s). The constructed SYCL context will use the AsyncHandler parameter to handle exceptions. SYCL properties are passed to the constructed SYCL context through PropList.
AsyncHandler | is an instance of async_handler. |
PropList | is an instance of property_list. |
Definition at line 32 of file context.cpp.
|
explicit |
Constructs a SYCL context instance using the provided device.
Newly created context is associated with the Device and the SYCL platform that is associated with the Device. SYCL properties are passed to the constructed SYCL context through PropList.
Device | is an instance of SYCL device. |
PropList | is an instance of property_list. |
Definition at line 36 of file context.cpp.
|
explicit |
Constructs a SYCL context instance using the provided device.
Newly created context is associated with the Device and the SYCL platform that is associated with the Device. The constructed SYCL context will use the AsyncHandler parameter to handle exceptions. SYCL properties are passed to the constructed SYCL context through PropList.
Device | is an instance of SYCL device. |
AsyncHandler | is an instance of async_handler. |
PropList | is an instance of property_list. |
Definition at line 39 of file context.cpp.
|
explicit |
Constructs a SYCL context instance using the provided platform.
Newly created context is associated with the Platform and with each SYCL device that is associated with the Platform. SYCL properties are passed to the constructed SYCL context through PropList.
Platform | is an instance of SYCL platform. |
PropList | is an instance of property_list. |
Definition at line 43 of file context.cpp.
|
explicit |
Constructs a SYCL context instance using the provided platform.
Newly created context is associated with the Platform and with each SYCL device that is associated with the Platform. The constructed SYCL context will use the AsyncHandler parameter to handle exceptions. SYCL properties are passed to the constructed SYCL context through PropList.
Platform | is an instance of SYCL platform. |
AsyncHandler | is an instance of async_handler. |
PropList | is an instance of property_list. |
Definition at line 46 of file context.cpp.
|
explicit |
Constructs a SYCL context instance using list of devices.
Newly created context will be associated with each SYCL device in the DeviceList. This requires that all SYCL devices in the list have the same associated SYCL platform. SYCL properties are passed to the constructed SYCL context through PropList.
DeviceList | is a list of SYCL device instances. |
PropList | is an instance of property_list. |
Definition at line 50 of file context.cpp.
|
explicit |
Constructs a SYCL context instance using list of devices.
Newly created context will be associated with each SYCL device in the DeviceList. This requires that all SYCL devices in the list have the same associated SYCL platform. The constructed SYCL context will use the AsyncHandler parameter to handle exceptions. SYCL properties are passed to the constructed SYCL context through PropList.
DeviceList | is a list of SYCL device instances. |
AsyncHandler | is an instance of async_handler. |
PropList | is an instance of property_list. |
Definition at line 54 of file context.cpp.
References any_of(), sycl::_V1::device::get_platform(), and sycl::_V1::detail::getSyclObjImpl().
|
default |
|
default |
sycl::_V1::context::__SYCL2020_DEPRECATED | ( | "is_host() is deprecated as the host device is no longer supported." | ) | const |
Gets OpenCL interoperability context.
The OpenCL cl_context handle is retained on return.
|
noexcept |
Returns the backend associated with this context.
Definition at line 133 of file context.cpp.
Referenced by sycl::_V1::detail::device_image_impl::all_specialization_constant_native(), sycl::_V1::ext::oneapi::experimental::create_kernel_bundle_from_source(), and sycl::_V1::detail::SetArgBasedOnType().
std::vector< device > sycl::_V1::context::get_devices | ( | ) | const |
Gets devices associated with this SYCL context.
Definition at line 139 of file context.cpp.
Referenced by sycl::_V1::detail::get_empty_interop_kernel_bundle(), sycl::_V1::get_kernel_bundle(), sycl::_V1::get_pointer_device(), sycl::_V1::has_kernel_bundle(), sycl::_V1::detail::isDeviceBinaryTypeSupported(), and sycl::_V1::detail::select_device().
detail::is_context_info_desc< Param >::return_type sycl::_V1::context::get_info |
Constructs a SYCL context instance from OpenCL cl_context.
ClContext is retained on SYCL context instantiation. The constructed SYCL context will use the AsyncHandler parameter to handle exceptions.
ClContext | is an instance of OpenCL cl_context. |
AsyncHandler | is an instance of async_handler. Queries this SYCL context for information. |
The return type depends on information being queried.
Definition at line 95 of file context.cpp.
platform sycl::_V1::context::get_platform | ( | ) | const |
Gets platform associated with this SYCL context.
Definition at line 135 of file context.cpp.
Referenced by sycl::_V1::detail::usm::alignedAllocHost(), and sycl::_V1::detail::isDeviceBinaryTypeSupported().
propertyT sycl::_V1::context::get_property | ( | ) | const |
Gets the specified property of this context.
Throws invalid_object_error if this context does not have a property of type propertyT.
|
noexcept |
Checks if this context has a property of type propertyT.
Definition at line 188 of file context.hpp.
Definition at line 186 of file context.hpp.
|
friend |
|
friend |
|
friend |