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

Encapsulates a SYCL platform on which kernels may be executed. More...

#include <sycl/platform.hpp>

Inheritance diagram for sycl::_V1::platform:
Collaboration diagram for sycl::_V1::platform:

Public Member Functions

 platform ()
 Constructs a SYCL platform using the default device. More...
 
 __SYCL2020_DEPRECATED ("SYCL 1.2.1 device selectors are deprecated. Please " "use SYCL 2020 device selectors instead.") explicit platform(const device_selector &DeviceSelector)
 Constructs a SYCL platform instance from an OpenCL cl_platform_id. More...
 
template<typename DeviceSelector , typename = detail::EnableIfSYCL2020DeviceSelectorInvocable<DeviceSelector>>
 platform (const DeviceSelector &deviceSelector)
 Constructs a SYCL platform instance using the platform of the device identified by the device selector provided. More...
 
 platform (const platform &rhs)=default
 
 platform (platform &&rhs)=default
 
platformoperator= (const platform &rhs)=default
 
platformoperator= (platform &&rhs)=default
 
bool operator== (const platform &rhs) const
 
bool operator!= (const platform &rhs) const
 
std::vector< deviceget_devices (info::device_type DeviceType=info::device_type::all) const
 Returns all SYCL devices associated with this platform. More...
 
template<typename Param >
detail::is_platform_info_desc< Param >::return_type get_info () const
 Queries this SYCL platform for info. More...
 
template<typename Param >
detail::is_backend_info_desc< Param >::return_type get_backend_info () const
 Queries this SYCL platform for SYCL backend-specific info. More...
 
backend get_backend () const noexcept
 Returns the backend associated with this platform. More...
 
bool has (aspect Aspect) const __SYCL_WARN_IMAGE_ASPECT(Aspect)
 Indicates if all of the SYCL devices on this platform have the given feature. More...
 
context ext_oneapi_get_default_context () const
 Return this platform's default context. More...
 
std::vector< deviceext_oneapi_get_composite_devices () const
 
- Public Member Functions inherited from sycl::_V1::detail::OwnerLessBase< platform >
bool ext_oneapi_owner_before (const ext::oneapi::detail::weak_object_base< platform > &Other) const noexcept
 Compares the object against a weak object using an owner-based implementation-defined ordering. More...
 
bool ext_oneapi_owner_before (const platform &Other) const noexcept
 Compares the object against another object using an owner-based implementation-defined ordering. More...
 

Static Public Member Functions

static std::vector< platformget_platforms ()
 Returns all available SYCL platforms in the system. 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

Encapsulates a SYCL platform on which kernels may be executed.

Definition at line 99 of file platform.hpp.

Constructor & Destructor Documentation

◆ platform() [1/4]

sycl::_V1::platform::platform ( )

Constructs a SYCL platform using the default device.

Definition at line 21 of file platform.cpp.

◆ platform() [2/4]

template<typename DeviceSelector , typename = detail::EnableIfSYCL2020DeviceSelectorInvocable<DeviceSelector>>
sycl::_V1::platform::platform ( const DeviceSelector &  deviceSelector)
inlineexplicit

Constructs a SYCL platform instance using the platform of the device identified by the device selector provided.

Parameters
DeviceSelectoris SYCL 2020 Device Selector, a simple callable that takes a device and returns an int

Definition at line 132 of file platform.hpp.

◆ platform() [3/4]

sycl::_V1::platform::platform ( const platform rhs)
default

◆ platform() [4/4]

sycl::_V1::platform::platform ( platform &&  rhs)
default

Member Function Documentation

◆ __SYCL2020_DEPRECATED()

sycl::_V1::platform::__SYCL2020_DEPRECATED ( "SYCL 1.2.1 device selectors are deprecated. Please " "use SYCL 2020 device selectors instead."  ) const &

Constructs a SYCL platform instance from an OpenCL cl_platform_id.

Returns an OpenCL interoperability platform.

The provided OpenCL platform handle is retained on SYCL platform construction.

Parameters
PlatformIdis an OpenCL cl_platform_id instance. Constructs a SYCL platform instance using a device_selector.

One of the SYCL devices that is associated with the constructed SYCL platform instance must be the SYCL device that is produced from the provided device selector.

Parameters
DeviceSelectoris an instance of a SYCL 1.2.1 device_selector
Returns
an instance of OpenCL cl_platform_id. Checks if platform supports specified extension.
Parameters
ExtensionNameis a string containing extension name.
Returns
true if specified extension is supported by this SYCL platform. Checks if this SYCL platform is a host platform.
true if this SYCL platform is a host platform.

◆ ext_oneapi_get_composite_devices()

std::vector< device > sycl::_V1::platform::ext_oneapi_get_composite_devices ( ) const

Definition at line 113 of file platform.cpp.

References get_devices(), and sycl::_V1::info::gpu.

◆ ext_oneapi_get_default_context()

context sycl::_V1::platform::ext_oneapi_get_default_context ( ) const

◆ get_backend()

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

Returns the backend associated with this platform.

Returns
the backend associated with this platform

Definition at line 57 of file platform.cpp.

Referenced by sycl::_V1::detail::enqueue_kernel_launch::handleInvalidWorkGroupSize(), and sycl::_V1::opencl::has_extension().

◆ get_backend_info()

template<typename Param >
detail::is_backend_info_desc< Param >::return_type sycl::_V1::platform::get_backend_info

Queries this SYCL platform for SYCL backend-specific info.

The return type depends on information being queried.

Definition at line 79 of file platform.cpp.

◆ get_devices()

std::vector< device > sycl::_V1::platform::get_devices ( info::device_type  DeviceType = info::device_type::all) const

Returns all SYCL devices associated with this platform.

If this SYCL platform is a host platform, resulting vector contains only a single SYCL host device. If there are no devices that match given device type, resulting vector is empty.

Parameters
DeviceTypeis a SYCL device type.
Returns
a vector of SYCL devices.

Definition at line 49 of file platform.cpp.

Referenced by ext_oneapi_get_composite_devices(), ext_oneapi_get_default_context(), and sycl::_V1::detail::platform_impl::get_platforms().

◆ get_info()

template<typename Param >
detail::is_platform_info_desc<Param>::return_type sycl::_V1::platform::get_info ( ) const
inline

◆ get_platforms()

std::vector< platform > sycl::_V1::platform::get_platforms ( )
static

Returns all available SYCL platforms in the system.

The resulting vector always contains a single SYCL host platform instance.

Returns
a vector of all available SYCL platforms.

Definition at line 53 of file platform.cpp.

References sycl::_V1::detail::platform_impl::get_platforms().

Referenced by sycl::_V1::device::get_devices().

◆ has()

bool sycl::_V1::platform::has ( aspect  Aspect) const

Indicates if all of the SYCL devices on this platform have the given feature.

Parameters
Aspectis one of the values in Table 4.20 of the SYCL 2020 Provisional Spec.
Returns
true if all of the SYCL devices on this platform have the given feature.

Definition at line 68 of file platform.cpp.

◆ operator!=()

bool sycl::_V1::platform::operator!= ( const platform rhs) const
inline

Definition at line 145 of file platform.hpp.

◆ operator=() [1/2]

platform& sycl::_V1::platform::operator= ( const platform rhs)
default

◆ operator=() [2/2]

platform& sycl::_V1::platform::operator= ( platform &&  rhs)
default

◆ operator==()

bool sycl::_V1::platform::operator== ( const platform rhs) const
inline

Definition at line 143 of file platform.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 136 of file backend.hpp.


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