DPC++ Runtime
Runtime libraries for oneAPI DPC++
cl::sycl::detail::device_impl Class Reference

#include <detail/device_impl.hpp>

Public Member Functions

 device_impl ()
 Constructs a SYCL device instance as a host device. More...
 
 device_impl (pi_native_handle, const plugin &Plugin)
 Constructs a SYCL device instance using the provided raw device handle. More...
 
 device_impl (RT::PiDevice Device, PlatformImplPtr Platform)
 Constructs a SYCL device instance using the provided PI device instance. More...
 
 device_impl (RT::PiDevice Device, const plugin &Plugin)
 Constructs a SYCL device instance using the provided PI device instance. More...
 
 ~device_impl ()
 
cl_device_id get () const
 Get instance of OpenCL device. More...
 
RT::PiDevicegetHandleRef ()
 Get reference to PI device. More...
 
const RT::PiDevicegetHandleRef () const
 Get constant reference to PI device. More...
 
bool is_host () const
 Check if SYCL device is a host device. More...
 
bool is_cpu () const
 Check if device is a CPU 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...
 
RT::PiDeviceType get_device_type () const
 Return device type. More...
 
platform get_platform () const
 Get associated SYCL platform. More...
 
const plugingetPlugin () const
 
bool has_extension (const std::string &ExtensionName) const
 Check SYCL extension support by device. More...
 
std::vector< devicecreate_sub_devices (const cl_device_partition_property *Properties, size_t SubDevicesCount) const
 
std::vector< devicecreate_sub_devices (size_t ComputeUnits) const
 Partition device into sub devices. More...
 
std::vector< devicecreate_sub_devices (const std::vector< size_t > &Counts) const
 Partition device into sub devices. More...
 
std::vector< devicecreate_sub_devices (info::partition_affinity_domain AffinityDomain) const
 Partition device into sub devices. More...
 
bool is_partition_supported (info::partition_property Prop) const
 Check if desired partition property supported by device. More...
 
template<info::device param>
info::param_traits< info::device, param >::return_type get_info () const
 Queries this SYCL device for information requested by the template parameter param. More...
 
bool is_affinity_supported (info::partition_affinity_domain AffinityDomain) const
 Check if affinity partitioning by specified domain is supported by device. More...
 
pi_native_handle getNative () const
 Gets the native handle of the SYCL device. More...
 
bool has (aspect Aspect) const
 Indicates if the SYCL device has the given feature. More...
 
bool isAssertFailSupported () const
 
bool isRootDevice () const
 
std::string getDeviceName () const
 

Static Public Member Functions

static std::shared_ptr< device_implgetHostDeviceImpl ()
 Gets the single instance of the Host Device. More...
 

Detailed Description

Definition at line 35 of file device_impl.hpp.

Constructor & Destructor Documentation

◆ device_impl() [1/4]

cl::sycl::detail::device_impl::device_impl ( )

Constructs a SYCL device instance as a host device.

Definition at line 19 of file device_impl.cpp.

◆ device_impl() [2/4]

cl::sycl::detail::device_impl::device_impl ( pi_native_handle  InteropDeviceHandle,
const plugin Plugin 
)
explicit

Constructs a SYCL device instance using the provided raw device handle.

Definition at line 24 of file device_impl.cpp.

◆ device_impl() [3/4]

cl::sycl::detail::device_impl::device_impl ( RT::PiDevice  Device,
PlatformImplPtr  Platform 
)
explicit

Constructs a SYCL device instance using the provided PI device instance.

Definition at line 28 of file device_impl.cpp.

◆ device_impl() [4/4]

cl::sycl::detail::device_impl::device_impl ( RT::PiDevice  Device,
const plugin Plugin 
)
explicit

Constructs a SYCL device instance using the provided PI device instance.

Definition at line 32 of file device_impl.cpp.

◆ ~device_impl()

cl::sycl::detail::device_impl::~device_impl ( )

Member Function Documentation

◆ create_sub_devices() [1/4]

std::vector< device > cl::sycl::detail::device_impl::create_sub_devices ( const cl_device_partition_property *  Properties,
size_t  SubDevicesCount 
) const

◆ create_sub_devices() [2/4]

std::vector< device > cl::sycl::detail::device_impl::create_sub_devices ( const std::vector< size_t > &  Counts) const

Partition device into sub devices.

If this SYCL device does not support info::partition_property::partition_by_counts a feature_not_supported exception must be thrown.

Parameters
Countsis a std::vector of desired compute units in sub devices.
Returns
a std::vector of sub devices partitioned from this SYCL device by count sizes based on the Counts parameter.

Definition at line 181 of file device_impl.cpp.

References create_sub_devices(), cl::sycl::invalid, is_partition_supported(), cl::sycl::info::partition_by_counts, PI_DEVICE_PARTITION_BY_COUNTS, and PI_DEVICE_PARTITION_BY_COUNTS_LIST_END.

◆ create_sub_devices() [3/4]

std::vector< device > cl::sycl::detail::device_impl::create_sub_devices ( info::partition_affinity_domain  AffinityDomain) const

Partition device into sub devices.

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.

Parameters
AffinityDomainis one of the values described in Table 4.20 of SYCL Spec
Returns
a vector class of sub devices partitioned from this SYCL device by affinity domain based on the AffinityDomain parameter

Definition at line 225 of file device_impl.cpp.

References cl::sycl::detail::plugin::call(), create_sub_devices(), getPlugin(), cl::sycl::invalid, is_affinity_supported(), is_partition_supported(), cl::sycl::info::partition_by_affinity_domain, PI_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, and piDevicePartition().

◆ create_sub_devices() [4/4]

std::vector< device > cl::sycl::detail::device_impl::create_sub_devices ( size_t  ComputeUnits) const

Partition device into sub devices.

If this SYCL device does not support info::partition_property::partition_equally a feature_not_supported exception must be thrown.

Parameters
ComputeUnitsis a desired count of compute units in each sub device.
Returns
A vector class of sub devices partitioned equally from this SYCL device based on the ComputeUnits parameter.

Definition at line 155 of file device_impl.cpp.

References create_sub_devices(), cl::sycl::invalid, is_partition_supported(), cl::sycl::info::partition_equally, and PI_DEVICE_PARTITION_EQUALLY.

◆ get()

cl_device_id cl::sycl::detail::device_impl::get ( ) const

Get instance of OpenCL device.

Returns
a valid cl_device_id instance in accordance with the requirements described in 4.3.1.

Definition at line 94 of file device_impl.cpp.

References cl::sycl::detail::plugin::call(), getNative(), getPlugin(), and piDeviceRetain().

Referenced by has().

◆ get_device_type()

RT::PiDeviceType cl::sycl::detail::device_impl::get_device_type ( ) const
inline

Return device type.

Returns
the type of the device

Definition at line 110 of file device_impl.hpp.

◆ get_info()

template<info::device param>
info::param_traits<info::device, param>::return_type cl::sycl::detail::device_impl::get_info ( ) const
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.

Returns
device info of type described in Table 4.20.

Definition at line 192 of file device_impl.hpp.

References std::get(), and cl::sycl::detail::pi::getPlugin().

Referenced by cl::sycl::detail::enqueue_kernel_launch::handleInvalidWorkGroupSize().

◆ get_platform()

platform cl::sycl::detail::device_impl::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. If this SYCL device is a host device then the SYCL platform must be a host platform. The value returned must be equal to that returned by get_info<info::device::platform>().

Returns
The associated SYCL platform.

Definition at line 105 of file device_impl.cpp.

Referenced by cl::sycl::detail::enqueue_kernel_launch::handleInvalidWorkGroupSize().

◆ getDeviceName()

std::string cl::sycl::detail::device_impl::getDeviceName ( ) const

Definition at line 396 of file device_impl.cpp.

◆ getHandleRef() [1/2]

RT::PiDevice& cl::sycl::detail::device_impl::getHandleRef ( )
inline

◆ getHandleRef() [2/2]

const RT::PiDevice& cl::sycl::detail::device_impl::getHandleRef ( ) const
inline

Get constant reference to PI device.

For host device an exception is thrown

Returns
constant reference to PI device

Definition at line 77 of file device_impl.hpp.

◆ getHostDeviceImpl()

std::shared_ptr< device_impl > cl::sycl::detail::device_impl::getHostDeviceImpl ( )
static

Gets the single instance of the Host Device.

Returns
the host device_impl singleton

Definition at line 385 of file device_impl.cpp.

◆ getNative()

pi_native_handle cl::sycl::detail::device_impl::getNative ( ) const

Gets the native handle of the SYCL device.

Returns
a native handle.

Definition at line 251 of file device_impl.cpp.

References getHandleRef(), getPlugin(), cl::sycl::opencl, piDeviceRetain(), and piextDeviceGetNativeHandle().

Referenced by get().

◆ getPlugin()

◆ has()

bool cl::sycl::detail::device_impl::has ( aspect  Aspect) const

Indicates if the SYCL device has the given feature.

Parameters
Aspectis one of the values in Table 4.20 of the SYCL 2020 Provisional Spec.
Returns
true if the SYCL device has the given feature.

Definition at line 260 of file device_impl.cpp.

References cl::sycl::accelerator, cl::sycl::atomic64, cl::sycl::detail::plugin::call_nocheck(), cl::sycl::cpu, cl::sycl::custom, cl::sycl::ext_intel_device_info_uuid, cl::sycl::ext_intel_gpu_eu_count, cl::sycl::ext_intel_gpu_eu_count_per_subslice, cl::sycl::ext_intel_gpu_eu_simd_width, cl::sycl::ext_intel_gpu_hw_threads_per_eu, cl::sycl::ext_intel_gpu_slices, cl::sycl::ext_intel_gpu_subslices_per_slice, cl::sycl::ext_intel_max_mem_bandwidth, cl::sycl::ext_intel_pci_address, cl::sycl::ext_oneapi_bfloat16, cl::sycl::ext_oneapi_cuda_async_barrier, cl::sycl::ext_oneapi_native_assert, cl::sycl::ext_oneapi_srgb, cl::sycl::fp16, cl::sycl::fp64, get(), getPlugin(), cl::sycl::gpu, has_extension(), cl::sycl::host, cl::sycl::image, is_accelerator(), is_cpu(), is_gpu(), is_host(), isAssertFailSupported(), cl::sycl::online_compiler, cl::sycl::online_linker, PI_DEVICE_INFO_GPU_EU_COUNT, PI_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE, PI_DEVICE_INFO_GPU_EU_SIMD_WIDTH, PI_DEVICE_INFO_GPU_HW_THREADS_PER_EU, PI_DEVICE_INFO_GPU_SLICES, PI_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE, PI_DEVICE_INFO_PCI_ADDRESS, PI_DEVICE_INFO_UUID, PI_EXT_ONEAPI_DEVICE_INFO_CUDA_ASYNC_BARRIER, PI_USM_CONCURRENT_ATOMIC_ACCESS, piDeviceGetInfo(), cl::sycl::queue_profiling, cl::sycl::usm_atomic_host_allocations, cl::sycl::usm_atomic_shared_allocations, cl::sycl::usm_device_allocations, cl::sycl::usm_host_allocations, cl::sycl::info::usm_host_allocations, cl::sycl::usm_restricted_shared_allocations, cl::sycl::usm_shared_allocations, cl::sycl::info::usm_shared_allocations, and cl::sycl::usm_system_allocations.

◆ has_extension()

bool cl::sycl::detail::device_impl::has_extension ( const std::string &  ExtensionName) const

Check SYCL extension support by device.

Parameters
ExtensionNameis a name of queried extension.
Returns
true if SYCL device supports the extension.

Definition at line 109 of file device_impl.cpp.

References cl::sycl::detail::get_device_info< T, param >::get(), getHandleRef(), and getPlugin().

Referenced by has().

◆ is_accelerator()

bool cl::sycl::detail::device_impl::is_accelerator ( ) const
inline

Check if device is an accelerator device.

Returns
true if SYCL device is an accelerator device

Definition at line 103 of file device_impl.hpp.

References PI_DEVICE_TYPE_ACC.

Referenced by has().

◆ is_affinity_supported()

bool cl::sycl::detail::device_impl::is_affinity_supported ( info::partition_affinity_domain  AffinityDomain) const

Check if affinity partitioning by specified domain is supported by device.

Parameters
AffinityDomainis one of the values described in Table 4.20 of SYCL Spec
Returns
true if AffinityDomain is supported by device.

Definition at line 87 of file device_impl.cpp.

Referenced by create_sub_devices().

◆ is_cpu()

bool cl::sycl::detail::device_impl::is_cpu ( ) const
inline

Check if device is a CPU device.

Returns
true if SYCL device is a CPU device

Definition at line 93 of file device_impl.hpp.

References PI_DEVICE_TYPE_CPU.

Referenced by has().

◆ is_gpu()

bool cl::sycl::detail::device_impl::is_gpu ( ) const
inline

Check if device is a GPU device.

Returns
true if SYCL device is a GPU device

Definition at line 98 of file device_impl.hpp.

References PI_DEVICE_TYPE_GPU.

Referenced by has().

◆ is_host()

bool cl::sycl::detail::device_impl::is_host ( ) const
inline

Check if SYCL device is a host device.

Returns
true if SYCL device is a host device

Definition at line 88 of file device_impl.hpp.

Referenced by has().

◆ is_partition_supported()

bool cl::sycl::detail::device_impl::is_partition_supported ( info::partition_property  Prop) const

Check if desired partition property supported by device.

Parameters
Propis one of info::partition_property::(partition_equally, partition_by_counts, partition_by_affinity_domain)
Returns
true if Prop is supported by device.

Definition at line 120 of file device_impl.cpp.

Referenced by create_sub_devices().

◆ isAssertFailSupported()

bool cl::sycl::detail::device_impl::isAssertFailSupported ( ) const

Definition at line 392 of file device_impl.cpp.

Referenced by has().

◆ isRootDevice()

bool cl::sycl::detail::device_impl::isRootDevice ( ) const
inline

Definition at line 230 of file device_impl.hpp.


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