The SYCL device class encapsulates a single SYCL device on which kernels may be executed. More...
#include <sycl/device.hpp>
Public Member Functions | |
device () | |
Constructs a SYCL device instance using the default device. More... | |
__SYCL2020_DEPRECATED ("SYCL 1.2.1 device selectors are deprecated. Please " "use SYCL 2020 device selectors instead.") explicit device(const device_selector &DeviceSelector) | |
Constructs a SYCL device instance from an OpenCL cl_device_id in accordance with the requirements described in 4.3.1. More... | |
template<typename DeviceSelector , typename = detail::EnableIfSYCL2020DeviceSelectorInvocable<DeviceSelector>> | |
device (const DeviceSelector &deviceSelector) | |
Constructs a SYCL device instance using the device identified by the device selector provided. More... | |
bool | operator== (const device &rhs) const |
bool | operator!= (const device &rhs) const |
device (const device &rhs)=default | |
device (device &&rhs)=default | |
device & | operator= (const device &rhs)=default |
device & | operator= (device &&rhs)=default |
void | ext_oneapi_enable_peer_access (const device &peer) |
void | ext_oneapi_disable_peer_access (const device &peer) |
bool | ext_oneapi_can_access_peer (const device &peer, ext::oneapi::peer_access value=ext::oneapi::peer_access::access_supported) |
bool | is_cpu () const |
Get instance of device. More... | |
bool | is_gpu () const |
Check if device is a GPU device. More... | |
bool | is_accelerator () const |
Check if device is an accelerator device. More... | |
platform | get_platform () const |
Get associated SYCL platform. More... | |
template<info::partition_property prop> | |
std::vector< device > | create_sub_devices (size_t ComputeUnits) const |
Partition device into sub devices. More... | |
template<info::partition_property prop> | |
std::vector< device > | create_sub_devices (const std::vector< size_t > &Counts) const |
Partition device into sub devices. More... | |
template<info::partition_property prop> | |
std::vector< device > | create_sub_devices (info::partition_affinity_domain AffinityDomain) const |
Partition device into sub devices. More... | |
template<info::partition_property prop> | |
std::vector< device > | create_sub_devices () const |
Partition device into sub devices. More... | |
template<typename Param > | |
detail::is_device_info_desc< Param >::return_type | get_info () const |
Queries this SYCL device for information requested by the template parameter param. More... | |
template<typename Param > | |
detail::is_backend_info_desc< Param >::return_type | get_backend_info () const |
Queries this SYCL device for SYCL backend-specific information. More... | |
bool | has_extension (const std::string &extension_name) const |
Check SYCL extension support by device. More... | |
backend | get_backend () const noexcept |
Returns the backend associated with this device. More... | |
bool | has (aspect Aspect) const __SYCL_WARN_IMAGE_ASPECT(Aspect) |
Indicates if the SYCL device has the given feature. More... | |
bool | ext_oneapi_architecture_is (ext::oneapi::experimental::architecture arch) |
Indicates if the SYCL device architecture equals to the one passed to the function. More... | |
bool | ext_oneapi_architecture_is (ext::oneapi::experimental::arch_category category) |
Indicates if the SYCL device architecture is in the category passed to the function. More... | |
bool | ext_oneapi_can_compile (ext::oneapi::experimental::source_language Language) |
kernel_compiler extension More... | |
bool | ext_oneapi_supports_cl_c_feature (const std::string &Feature) |
Indicates if the device supports a given feature when compiling the OpenCL C language. More... | |
bool | ext_oneapi_supports_cl_c_version (const ext::oneapi::experimental::cl_version &Version) const |
Indicates if the device supports kernel bundles written in a particular OpenCL C version. More... | |
bool | ext_oneapi_supports_cl_extension (const std::string &name, ext::oneapi::experimental::cl_version *version=nullptr) const |
If the device supports kernel bundles using the OpenCL extension identified by name and if version is not a null pointer, the supported version of the extension is written to version . More... | |
std::string | ext_oneapi_cl_profile () const |
Retrieve the OpenCl Device Profile. More... | |
![]() | |
bool | ext_oneapi_owner_before (const ext::oneapi::detail::weak_object_base< device > &Other) const noexcept |
Compares the object against a weak object using an owner-based implementation-defined ordering. More... | |
bool | ext_oneapi_owner_before (const device &Other) const noexcept |
Compares the object against another object using an owner-based implementation-defined ordering. More... | |
Static Public Member Functions | |
static std::vector< device > | get_devices (info::device_type deviceType=info::device_type::all) |
Query available SYCL devices. More... | |
Friends | |
template<class T > | |
T | detail::createSyclObjFromImpl (decltype(T::impl) ImplObj) |
template<backend BackendName, class SyclObjectT > | |
auto | get_native (const SyclObjectT &Obj) -> backend_return_t< BackendName, SyclObjectT > |
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition at line 64 of file device.hpp.
sycl::_V1::device::device | ( | ) |
Constructs a SYCL device instance using the default device.
Definition at line 33 of file device.cpp.
|
inlineexplicit |
Constructs a SYCL device instance using the device identified by the device selector provided.
DeviceSelector | is SYCL 2020 Device Selector, a simple callable that takes a device and returns an int |
Definition at line 92 of file device.hpp.
|
default |
|
default |
sycl::_V1::device::__SYCL2020_DEPRECATED | ( | "SYCL 1.2.1 device selectors are deprecated. Please " "use SYCL 2020 device selectors instead." | ) | const & |
Constructs a SYCL device instance from an OpenCL cl_device_id in accordance with the requirements described in 4.3.1.
DeviceId | is OpenCL device represented with cl_device_id Constructs a SYCL device instance using the device selected by the DeviceSelector provided. |
DeviceSelector | SYCL 1.2.1 device_selector to be used (see 4.6.1.1). |
std::vector< device > sycl::_V1::device::create_sub_devices |
Partition device into sub devices.
Available only when prop is info::partition_property::ext_intel_partition_by_cslice. If this SYCL device does not support info::partition_property::ext_intel_partition_by_cslice a feature_not_supported exception must be thrown.
Definition at line 113 of file device.cpp.
std::vector< device > sycl::_V1::device::create_sub_devices | ( | const std::vector< size_t > & | Counts | ) | const |
Partition device into sub devices.
Available only when prop is info::partition_property::partition_by_counts. If this SYCL device does not support info::partition_property::partition_by_counts a feature_not_supported exception must be thrown.
Counts | is a std::vector of desired compute units in sub devices. |
Definition at line 94 of file device.cpp.
std::vector< device > sycl::_V1::device::create_sub_devices | ( | info::partition_affinity_domain | AffinityDomain | ) | const |
Partition device into sub devices.
Available only when prop is info::partition_property::partition_by_affinity_domain. If this SYCL device does not support info::partition_property::partition_by_affinity_domain or the SYCL device does not support info::affinity_domain provided a feature_not_supported exception must be thrown.
AffinityDomain | is one of the values described in Table 4.20 of SYCL Spec |
Definition at line 103 of file device.cpp.
std::vector< device > sycl::_V1::device::create_sub_devices | ( | size_t | ComputeUnits | ) | const |
Partition device into sub devices.
Available only when prop is info::partition_property::partition_equally. If this SYCL device does not support info::partition_property::partition_equally a feature_not_supported exception must be thrown.
ComputeUnits | is a desired count of compute units in each sub device. |
Definition at line 84 of file device.cpp.
Referenced by sycl::_V1::detail::amendDeviceAndSubDevices(), and sycl::_V1::detail::find_matching_descendent_device().
bool sycl::_V1::device::ext_oneapi_architecture_is | ( | ext::oneapi::experimental::arch_category | category | ) |
Indicates if the SYCL device architecture is in the category passed to the function.
category | is one of the architecture categories from arch_category enum described in sycl_ext_oneapi_device_architecture specification. |
Definition at line 261 of file device.cpp.
bool sycl::_V1::device::ext_oneapi_architecture_is | ( | ext::oneapi::experimental::architecture | arch | ) |
Indicates if the SYCL device architecture equals to the one passed to the function.
arch | is one of the architectures from architecture enum described in sycl_ext_oneapi_device_architecture specification. |
Definition at line 256 of file device.cpp.
bool sycl::_V1::device::ext_oneapi_can_access_peer | ( | const device & | peer, |
ext::oneapi::peer_access | value = ext::oneapi::peer_access::access_supported |
||
) |
Definition at line 227 of file device.cpp.
References sycl::_V1::ext::oneapi::access_supported, sycl::_V1::ext::oneapi::atomics_supported, sycl::_V1::invalid, and sycl::_V1::make_error_code().
bool sycl::_V1::device::ext_oneapi_can_compile | ( | ext::oneapi::experimental::source_language | Language | ) |
kernel_compiler extension
Indicates if the device can compile a kernel for the given language.
Language | is one of the values from the kernel_bundle::source_language enumeration described in the sycl_ext_oneapi_kernel_compiler specification |
lang
. Definition at line 267 of file device.cpp.
std::string sycl::_V1::device::ext_oneapi_cl_profile | ( | ) | const |
Retrieve the OpenCl Device Profile.
source_language::opencl
, returns the name of the OpenCL profile that is supported. The profile name is the same string that is returned by the query CL_DEVICE_PROFILE
, as defined in section 4.2 "Querying Devices" of the OpenCL specification. If the device does not support kernel bundles written in source_language::opencl
, returns the empty string. Definition at line 317 of file device.cpp.
References sycl::_V1::ext::oneapi::experimental::detail::OpenCLC_Profile().
void sycl::_V1::device::ext_oneapi_disable_peer_access | ( | const device & | peer | ) |
Definition at line 218 of file device.cpp.
void sycl::_V1::device::ext_oneapi_enable_peer_access | ( | const device & | peer | ) |
Definition at line 209 of file device.cpp.
|
inline |
Indicates if the device supports a given feature when compiling the OpenCL C language.
Feature |
Definition at line 305 of file device.hpp.
bool sycl::_V1::device::ext_oneapi_supports_cl_c_version | ( | const ext::oneapi::experimental::cl_version & | Version | ) | const |
Indicates if the device supports kernel bundles written in a particular OpenCL C version.
Version |
Version
. Definition at line 286 of file device.cpp.
References sycl::_V1::ext::oneapi::experimental::detail::OpenCLC_Supports_Version().
|
inline |
If the device supports kernel bundles using the OpenCL extension identified by name
and if version
is not a null pointer, the supported version of the extension is written to version
.
name
. Definition at line 325 of file device.hpp.
|
noexcept |
Returns the backend associated with this device.
Definition at line 203 of file device.cpp.
Referenced by sycl::_V1::opencl::has_extension().
detail::is_backend_info_desc< Param >::return_type sycl::_V1::device::get_backend_info |
Queries this SYCL device for SYCL backend-specific information.
The return type depends on information being queried.
Definition at line 191 of file device.cpp.
|
static |
Query available SYCL devices.
deviceType | is one of the values described in A.3 of SYCL Spec |
Definition at line 53 of file device.cpp.
References sycl::_V1::detail::ods_target_list::backendCompatible(), sycl::_V1::detail::SYCLConfig< Config >::get(), and sycl::_V1::platform::get_platforms().
Referenced by sycl::_V1::ext::oneapi::detail::filter_selector_impl::filter_selector_impl(), sycl::_V1::detail::find_device_intersection(), and sycl::_V1::detail::select_device().
|
inline |
Queries this SYCL device for information requested by the template parameter param.
Specializations of info::param_traits must be defined in accordance with the info parameters in Table 4.20 of SYCL Spec to facilitate returning the type associated with the param parameter.
Definition at line 215 of file device.hpp.
References sycl::_V1::detail::convert_from_abi_neutral().
Referenced by sycl::_V1::detail::usm::alignedAlloc(), sycl::_V1::detail::amendDeviceAndSubDevices(), syclcompat::experimental::calculate_max_potential_wg(), sycl::_V1::detail::checkDevSupportDeviceRequirements(), sycl::_V1::detail::context_impl::get_backend_info< info::device::version >(), sycl::_V1::detail::find_matching_descendent_device(), syclcompat::detail::dev_mgr::get_device_id(), sycl::_V1::detail::kernel_impl::get_info(), syclcompat::detail::get_version(), sycl::_V1::detail::GetCapabilitiesIntersectionSet(), sycl::_V1::detail::kernel_impl::get_backend_info< info::device::version >(), sycl::_V1::ext::oneapi::detail::filter_selector_impl::operator()(), sycl::_V1::detail::platform_impl::get_backend_info< info::device::version >(), sycl::_V1::detail::reduGetMaxNumConcurrentWorkGroups(), sycl::_V1::detail::reduGetMaxWGSize(), sycl::_V1::detail::reduGetPreferredWGSize(), sycl::_V1::detail::NDRangeReduction< reduction::strategy::group_reduce_and_last_wg_detection >::run(), sycl::_V1::detail::supportsAffinityDomain(), sycl::_V1::detail::supportsPartitionProperty(), and sycl::_V1::detail::traceDeviceSelection().
platform sycl::_V1::device::get_platform | ( | ) | const |
Get associated SYCL platform.
If this SYCL device is an OpenCL device then the SYCL platform must encapsulate the OpenCL cl_plaform_id associated with the underlying OpenCL cl_device_id of this SYCL device. The value returned must be equal to that returned by get_info<info::device::platform>().
Definition at line 81 of file device.cpp.
Referenced by sycl::_V1::ext::intel::detail::selectDeviceByPlatform().
bool sycl::_V1::device::has | ( | aspect | Aspect | ) | const |
Indicates if the SYCL device has the given feature.
Aspect | is one of the values in Table 4.20 of the SYCL 2020 Provisional Spec. |
Definition at line 207 of file device.cpp.
Referenced by syclcompat::experimental::calculate_max_potential_wg(), sycl::_V1::detail::checkDevSupportDeviceRequirements(), sycl::_V1::ext::oneapi::experimental::get_mem_granularity(), sycl::_V1::ext::oneapi::experimental::physical_mem::physical_mem(), sycl::_V1::detail::NDRangeReduction< reduction::strategy::group_reduce_and_last_wg_detection >::run(), and sycl::_V1::ext::oneapi::experimental::submit_profiling_tag().
|
inline |
Check SYCL extension support by device.
extension_name | is a name of queried extension. |
Definition at line 231 of file device.hpp.
References sycl::_V1::opencl::has_extension().
Referenced by sycl::_V1::ext::intel::experimental::pipe< _name, _dataT, _min_capacity, _propertiesT, class >::read(), and sycl::_V1::ext::intel::experimental::pipe< _name, _dataT, _min_capacity, _propertiesT, class >::write().
bool sycl::_V1::device::is_accelerator | ( | ) | const |
Check if device is an accelerator device.
Definition at line 79 of file device.cpp.
Referenced by sycl::_V1::detail::reduGetPreferredWGSize().
bool sycl::_V1::device::is_cpu | ( | ) | const |
Get instance of device.
Definition at line 75 of file device.cpp.
Referenced by syclcompat::detail::dev_mgr::operator=(), and sycl::_V1::detail::reduGetPreferredWGSize().
bool sycl::_V1::device::is_gpu | ( | ) | const |
Check if device is a GPU device.
Definition at line 77 of file device.cpp.
Referenced by sycl::_V1::detail::reduGetMaxNumConcurrentWorkGroups(), and sycl::_V1::detail::reduGetPreferredWGSize().
|
inline |
Definition at line 97 of file device.hpp.
|
inline |
Definition at line 95 of file device.hpp.
|
friend |
|
friend |
Definition at line 138 of file backend.hpp.