#include <detail/platform_impl.hpp>
Public Member Functions | |
platform_impl () | |
Constructs platform_impl for a SYCL host platform. More... | |
platform_impl (sycl::detail::pi::PiPlatform APlatform, const std::shared_ptr< plugin > &APlugin) | |
Constructs platform_impl from a plug-in interoperability platform handle. More... | |
~platform_impl ()=default | |
bool | has_extension (const std::string &ExtensionName) const |
Checks if this platform supports extension. More... | |
bool | supports_usm () const |
Checks if this platform supports usm. More... | |
std::vector< device > | get_devices (info::device_type DeviceType=info::device_type::all) const |
Returns all SYCL devices associated with this platform. More... | |
template<typename Param > | |
Param::return_type | get_info () const |
Queries this SYCL platform for info. More... | |
template<typename Param > | |
Param::return_type | get_backend_info () const |
Queries this SYCL platform for SYCL backend-specific information. More... | |
bool | is_host () const |
backend | getBackend (void) const |
Returns the backend of this platform. More... | |
void | getBackendOption (const char *frontend_option, const char **backend_option) const |
Get backend option. More... | |
cl_platform_id | get () const |
const sycl::detail::pi::PiPlatform & | getHandleRef () const |
Returns raw underlying plug-in platform handle. More... | |
const PluginPtr & | getPlugin () const |
void | setPlugin (PluginPtr &PluginPtr, backend Backend) |
Sets the platform implementation to use another plugin. More... | |
pi_native_handle | getNative () const |
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... | |
std::shared_ptr< device_impl > | getDeviceImpl (sycl::detail::pi::PiDevice PiDevice) |
Queries the device_impl cache to return a shared_ptr for the device_impl corresponding to the PiDevice. More... | |
std::shared_ptr< device_impl > | getOrMakeDeviceImpl (sycl::detail::pi::PiDevice PiDevice, const std::shared_ptr< platform_impl > &PlatformImpl) |
Queries the device_impl cache to either return a shared_ptr for the device_impl corresponding to the PiDevice or add a new entry to the cache. More... | |
Static Public Member Functions | |
static std::vector< platform > | get_platforms () |
Returns all available SYCL platforms in the system. More... | |
static std::shared_ptr< platform_impl > | getHostPlatformImpl () |
Static functions that help maintain platform uniquess and equality of comparison. More... | |
static std::shared_ptr< platform_impl > | getOrMakePlatformImpl (sycl::detail::pi::PiPlatform PiPlatform, const PluginPtr &Plugin) |
Queries the cache to see if the specified PiPlatform has been seen before. More... | |
static std::shared_ptr< platform_impl > | getPlatformFromPiDevice (sycl::detail::pi::PiDevice PiDevice, const PluginPtr &Plugin) |
Queries the cache for the specified platform based on an input device. More... | |
Public Attributes | |
bool | MAlwaysRootDevice = false |
Definition at line 33 of file platform_impl.hpp.
|
inline |
Constructs platform_impl for a SYCL host platform.
Definition at line 36 of file platform_impl.hpp.
|
inlineexplicit |
Constructs platform_impl from a plug-in interoperability platform handle.
APlatform | is a raw plug-in platform handle. |
APlugin | is a plug-in handle. |
Definition at line 43 of file platform_impl.hpp.
References sycl::_V1::detail::convertBackend(), PI_EXT_PLATFORM_INFO_BACKEND, and piPlatformGetInfo().
|
default |
|
inline |
Definition at line 109 of file platform_impl.hpp.
References is_host().
Param::return_type sycl::_V1::detail::platform_impl::get_backend_info | ( | ) | const |
Queries this SYCL platform for SYCL backend-specific information.
The return type depends on information being queried.
std::vector< device > sycl::_V1::detail::platform_impl::get_devices | ( | info::device_type | DeviceType = info::device_type::all | ) | const |
Returns all SYCL devices associated with this platform.
If this platform is a host platform and device type requested is either info::device_type::all or info::device_type::host, resulting vector contains only a single SYCL host device. If there are no devices that match given device type, resulting vector is empty.
DeviceType | is a SYCL device type. |
Definition at line 470 of file platform_impl.cpp.
References sycl::_V1::info::all, sycl::_V1::detail::amendDeviceAndSubDevices(), sycl::_V1::detail::applyAllowList(), sycl::_V1::detail::SYCLConfig< Config >::get(), getBackend(), sycl::_V1::detail::device_impl::getHostDeviceImpl(), getOrMakePlatformImpl(), sycl::_V1::info::host, sycl::_V1::detail::pi::initialize(), is_host(), piDeviceRelease(), and piDevicesGet().
Referenced by has().
Param::return_type sycl::_V1::detail::platform_impl::get_info |
Queries this SYCL platform for info.
The return type depends on information being queried.
Definition at line 588 of file platform_impl.cpp.
References getHandleRef(), getPlugin(), and is_host().
|
static |
Returns all available SYCL platforms in the system.
By default the resulting vector always contains a single SYCL host platform instance. There are means to override this behavior for testing purposes. See environment variables guide for up-to-date instructions.
Definition at line 108 of file platform_impl.cpp.
References sycl::_V1::all, sycl::_V1::info::all, sycl::_V1::platform::get_devices(), getBackend(), getOrMakePlatformImpl(), sycl::_V1::detail::getSyclObjImpl(), sycl::_V1::detail::pi::initialize(), sycl::_V1::detail::IsBannedPlatform(), piPlatformsGet(), and sycl::_V1::detail::GlobalHandler::registerDefaultContextReleaseHandler().
Referenced by sycl::_V1::platform::get_platforms().
|
inline |
Returns the backend of this platform.
Definition at line 96 of file platform_impl.hpp.
Referenced by get_devices(), get_platforms(), and supports_usm().
|
inline |
Get backend option.
Definition at line 99 of file platform_impl.hpp.
References getPlugin(), and piPluginGetBackendOption().
std::shared_ptr< device_impl > sycl::_V1::detail::platform_impl::getDeviceImpl | ( | sycl::detail::pi::PiDevice | PiDevice | ) |
Queries the device_impl cache to return a shared_ptr for the device_impl corresponding to the PiDevice.
PiDevice | is the PiDevice whose impl is requested |
Definition at line 310 of file platform_impl.cpp.
|
inline |
Returns raw underlying plug-in platform handle.
Unlike get() method, this method does not retain handler. It is caller responsibility to make sure that platform stays alive while raw handle is in use.
Definition at line 125 of file platform_impl.hpp.
References is_host().
Referenced by get_info(), and getNative().
|
static |
Static functions that help maintain platform uniquess and equality of comparison.
Returns the host platform impl
Definition at line 33 of file platform_impl.cpp.
Referenced by sycl::_V1::detail::context_impl::get_info< info::context::atomic_fence_order_capabilities >(), and sycl::_V1::detail::get_device_info_host< info::device::platform >().
pi_native_handle sycl::_V1::detail::platform_impl::getNative | ( | ) | const |
Gets the native handle of the SYCL platform.
Definition at line 579 of file platform_impl.cpp.
References getHandleRef(), getPlugin(), and piextPlatformGetNativeHandle().
std::shared_ptr< device_impl > sycl::_V1::detail::platform_impl::getOrMakeDeviceImpl | ( | sycl::detail::pi::PiDevice | PiDevice, |
const std::shared_ptr< platform_impl > & | PlatformImpl | ||
) |
Queries the device_impl cache to either return a shared_ptr for the device_impl corresponding to the PiDevice or add a new entry to the cache.
PiDevice | is the PiDevice whose impl is requested |
PlatormImpl | is the Platform for that Device |
Definition at line 315 of file platform_impl.cpp.
|
static |
Queries the cache to see if the specified PiPlatform has been seen before.
If so, return the cached platform_impl, otherwise create a new one and cache it.
PiPlatform | is the PI Platform handle representing the platform |
Plugin | is the PI plugin providing the backend for the platform |
Definition at line 40 of file platform_impl.cpp.
References sycl::_V1::detail::GlobalHandler::getPlatformCache(), and sycl::_V1::detail::GlobalHandler::instance().
Referenced by sycl::_V1::detail::applyAllowList(), sycl::_V1::detail::get_device_info_impl< platform, Param >::get(), get_devices(), get_platforms(), getPlatformFromPiDevice(), and sycl::_V1::detail::make_platform().
|
static |
Queries the cache for the specified platform based on an input device.
If found, returns the the cached platform_impl, otherwise creates a new one and caches it.
PiDevice | is the PI device handle for the device whose platform is desired |
Plugin | is the PI plugin providing the backend for the device and platform |
Definition at line 65 of file platform_impl.cpp.
References getOrMakePlatformImpl(), PI_DEVICE_INFO_PLATFORM, and piDeviceGetInfo().
Referenced by sycl::_V1::detail::context_impl::context_impl().
|
inline |
Definition at line 143 of file platform_impl.hpp.
Referenced by get_info(), getBackendOption(), getNative(), and has_extension().
bool sycl::_V1::detail::platform_impl::has | ( | aspect | Aspect | ) | const |
Indicates if all of the SYCL devices on this platform have the given feature.
Aspect | is one of the values in Table 4.20 of the SYCL 2020 Provisional Spec. |
Definition at line 641 of file platform_impl.cpp.
References get_devices().
bool sycl::_V1::detail::platform_impl::has_extension | ( | const std::string & | ExtensionName | ) | const |
Checks if this platform supports extension.
ExtensionName | is a string containing extension name. |
Definition at line 564 of file platform_impl.cpp.
References sycl::_V1::detail::get_platform_info_string_impl(), getPlugin(), and is_host().
Referenced by supports_usm().
|
inline |
Definition at line 93 of file platform_impl.hpp.
Referenced by get(), get_devices(), get_info(), getHandleRef(), and has_extension().
Sets the platform implementation to use another plugin.
PluginPtr | is a pointer to a plugin instance |
Backend | is the backend that we want this platform to use |
Definition at line 152 of file platform_impl.hpp.
bool sycl::_V1::detail::platform_impl::supports_usm | ( | ) | const |
Checks if this platform supports usm.
Non opencl backends are assumed to support it.
Definition at line 574 of file platform_impl.cpp.
References getBackend(), has_extension(), and sycl::_V1::opencl.
bool sycl::_V1::detail::platform_impl::MAlwaysRootDevice = false |
Definition at line 229 of file platform_impl.hpp.