DPC++ Runtime
Runtime libraries for oneAPI Data Parallel C++
cl::sycl::platform Class Reference

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

#include <CL/sycl/platform.hpp>

Public Member Functions

 platform ()
 Constructs a SYCL platform as a host platform. More...
 
 platform (cl_platform_id PlatformId)
 Constructs a SYCL platform instance from an OpenCL cl_platform_id. More...
 
 platform (const device_selector &DeviceSelector)
 Constructs a SYCL platform instance using device selector. 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
 
cl_platform_id get () const
 Returns an OpenCL interoperability platform. More...
 
std::vector< deviceget_devices (info::device_type DeviceType=info::device_type::all) const
 Returns all SYCL devices associated with this platform. More...
 
template<info::platform param>
info::param_traits< info::platform, param >::return_type get_info () const
 Queries this SYCL platform for info. More...
 
backend get_backend () const noexcept
 Returns the backend associated with this platform. More...
 
template<backend BackendName>
auto get_native () const -> typename interop< BackendName, platform >::type
 Gets the native handle of the SYCL platform. More...
 
bool has (aspect Aspect) const
 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...
 

Static Public Member Functions

static std::vector< platformget_platforms ()
 Returns all available SYCL platforms in the system. More...
 

Friends

template<class T >
T detail::createSyclObjFromImpl (decltype(T::impl) ImplObj)
 

Detailed Description

Encapsulates a SYCL platform on which kernels may be executed.

Definition at line 36 of file platform.hpp.

Constructor & Destructor Documentation

◆ platform() [1/5]

cl::sycl::platform::platform ( )

Constructs a SYCL platform as a host platform.

Definition at line 22 of file platform.cpp.

◆ platform() [2/5]

cl::sycl::platform::platform ( cl_platform_id  PlatformId)
explicit

Constructs a SYCL platform instance from an OpenCL cl_platform_id.

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

Parameters
PlatformIdis an OpenCL cl_platform_id instance.

Definition at line 24 of file platform.cpp.

References cl::sycl::detail::platform_impl::getOrMakePlatformImpl().

◆ platform() [3/5]

cl::sycl::platform::platform ( const device_selector DeviceSelector)
explicit

Constructs a SYCL platform instance using 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 SYCL device_selector.

Definition at line 30 of file platform.cpp.

References cl::sycl::device::get_platform(), and cl::sycl::device_selector::select_device().

◆ platform() [4/5]

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

◆ platform() [5/5]

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

Member Function Documentation

◆ ext_oneapi_get_default_context()

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

◆ get()

cl_platform_id cl::sycl::platform::get ( ) const

Returns an OpenCL interoperability platform.

Returns
an instance of OpenCL cl_platform_id.

Definition at line 34 of file platform.cpp.

◆ get_backend()

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

Returns the backend associated with this platform.

Returns
the backend associated with this platform

Definition at line 50 of file platform.cpp.

References cl::sycl::detail::getImplBackend().

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

◆ get_devices()

std::vector< device > cl::sycl::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 42 of file platform.cpp.

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

◆ get_info()

template<info::platform param>
info::param_traits< info::platform, param >::return_type cl::sycl::platform::get_info

◆ get_native()

template<backend BackendName>
auto cl::sycl::platform::get_native ( ) const -> typename interop<BackendName, platform>::type
inline

Gets the native handle of the SYCL platform.

Returns
a native handle, the type of which defined by the backend.

Definition at line 125 of file platform.hpp.

◆ get_platforms()

std::vector< platform > cl::sycl::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 46 of file platform.cpp.

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

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

◆ has()

bool cl::sycl::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 60 of file platform.cpp.

◆ operator!=()

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

Definition at line 69 of file platform.hpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ operator==()

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

Definition at line 67 of file platform.hpp.

Friends And Related Function Documentation

◆ detail::createSyclObjFromImpl

template<class T >
T detail::createSyclObjFromImpl ( decltype(T::impl)  ImplObj)
friend

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