The context class represents a SYCL context on which kernel functions may be executed. More...
#include <CL/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<info::context param> | |
info::param_traits< info::context, 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 |
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... | |
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... | |
template<backend Backend> | |
backend_return_t< Backend, context > | get_native () const |
Gets the native handle of the SYCL context. More... | |
Friends | |
template<backend Backend, class SyclT > | |
auto | get_native (const SyclT &Obj) -> backend_return_t< Backend, SyclT > |
template<class T > | |
detail::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 38 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 29 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(), cl::sycl::device::get_platform(), and cl::sycl::detail::getSyclObjImpl().
|
default |
|
default |
|
noexcept |
Returns the backend associated with this context.
Definition at line 122 of file context.cpp.
References cl::sycl::detail::getImplBackend().
std::vector< device > cl::sycl::context::get_devices | ( | ) | const |
Gets devices associated with this SYCL context.
Definition at line 128 of file context.cpp.
References cl::sycl::info::devices.
Referenced by cl::sycl::detail::checkAllDevicesAreInContext(), cl::sycl::detail::kernel_bundle_plain::get_devices(), cl::sycl::detail::get_empty_interop_kernel_bundle(), cl::sycl::get_kernel_bundle(), cl::sycl::get_pointer_device(), cl::sycl::has_kernel_bundle(), cl::sycl::detail::isDeviceBinaryTypeSupported(), cl::sycl::make_queue< backend::ext_oneapi_level_zero >(), and cl::sycl::queue::queue().
info::param_traits<info::context, param>::return_type cl::sycl::context::get_info | ( | ) | const |
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.
|
inline |
Gets the native handle of the SYCL context.
Definition at line 225 of file context.hpp.
platform cl::sycl::context::get_platform | ( | ) | const |
Gets platform associated with this SYCL context.
Definition at line 124 of file context.cpp.
References cl::sycl::info::platform.
Referenced by cl::sycl::detail::isDeviceBinaryTypeSupported().
propertyT cl::sycl::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.
bool cl::sycl::context::has_property | ( | ) | const |
Checks if this context has a property of type propertyT.
bool cl::sycl::context::is_host | ( | ) | const |
Gets OpenCL interoperability context.
The OpenCL cl_context handle is retained on return.
Definition at line 120 of file context.cpp.
Referenced by cl::sycl::detail::MemoryManager::advise_usm(), cl::sycl::detail::MemoryManager::copy_usm(), cl::sycl::detail::MemoryManager::fill_usm(), cl::sycl::detail::usm::free(), cl::sycl::get_pointer_device(), cl::sycl::get_pointer_type(), and cl::sycl::detail::MemoryManager::prefetch_usm().
|
inline |
Definition at line 176 of file context.hpp.
|
inline |
Definition at line 174 of file context.hpp.
|
friend |
|
friend |
|
friend |