DPC++ Runtime
Runtime libraries for oneAPI DPC++
sycl::_V1::detail::plugin Class Reference

The plugin class provides a unified interface to the underlying low-level runtimes for the device-agnostic SYCL runtime. More...

#include <detail/plugin.hpp>

Collaboration diagram for sycl::_V1::detail::plugin:

Public Member Functions

 plugin ()=delete
 
 plugin (ur_adapter_handle_t adapter, backend UseBackend)
 
pluginoperator= (const plugin &)=delete
 
 plugin (const plugin &)=delete
 
pluginoperator= (plugin &&other) noexcept=delete
 
 plugin (plugin &&other) noexcept=delete
 
 ~plugin ()=default
 
template<sycl::errc errc = sycl::errc::runtime>
void checkUrResult (ur_result_t ur_result) const
 
std::vector< ur_platform_handle_t > & getUrPlatforms ()
 
ur_adapter_handle_t getUrAdapter ()
 
template<class UrFunc , typename... ArgsT>
ur_result_t call_nocheck (UrFunc F, ArgsT... Args) const
 Calls the UR Api, traces the call, and returns the result. More...
 
template<class UrFunc , typename... ArgsT>
void call (UrFunc F, ArgsT... Args) const
 Calls the API, traces the call, checks the result. More...
 
template<sycl::errc errc, class UrFunc , typename... ArgsT>
void call (UrFunc F, ArgsT... Args) const
 
bool hasBackend (backend Backend) const
 Tells if this plugin can serve specified backend. More...
 
void release ()
 
int getPlatformId (ur_platform_handle_t Platform)
 
int getStartingDeviceId (ur_platform_handle_t Platform)
 
void setLastDeviceId (ur_platform_handle_t Platform, int Id)
 
void adjustLastDeviceId (ur_platform_handle_t Platform)
 
bool containsUrPlatform (ur_platform_handle_t Platform)
 
std::shared_ptr< std::mutex > getPluginMutex ()
 

Public Attributes

bool adapterReleased = false
 

Detailed Description

The plugin class provides a unified interface to the underlying low-level runtimes for the device-agnostic SYCL runtime.

Definition at line 46 of file plugin.hpp.

Constructor & Destructor Documentation

◆ plugin() [1/4]

sycl::_V1::detail::plugin::plugin ( )
delete

◆ plugin() [2/4]

sycl::_V1::detail::plugin::plugin ( ur_adapter_handle_t  adapter,
backend  UseBackend 
)
inline

Definition at line 50 of file plugin.hpp.

◆ plugin() [3/4]

sycl::_V1::detail::plugin::plugin ( const plugin )
delete

◆ plugin() [4/4]

sycl::_V1::detail::plugin::plugin ( plugin &&  other)
deletenoexcept

◆ ~plugin()

sycl::_V1::detail::plugin::~plugin ( )
default

Member Function Documentation

◆ adjustLastDeviceId()

void sycl::_V1::detail::plugin::adjustLastDeviceId ( ur_platform_handle_t  Platform)
inline

Definition at line 187 of file plugin.hpp.

References getPlatformId().

◆ call() [1/2]

template<class UrFunc , typename... ArgsT>
void sycl::_V1::detail::plugin::call ( UrFunc  F,
ArgsT...  Args 
) const
inline

Calls the API, traces the call, checks the result.

Exceptions
sycl::runtime_exceptionif the call was not successful.

Definition at line 130 of file plugin.hpp.

References call_nocheck(), and checkUrResult().

Referenced by getUrPlatforms(), and release().

◆ call() [2/2]

template<sycl::errc errc, class UrFunc , typename... ArgsT>
void sycl::_V1::detail::plugin::call ( UrFunc  F,
ArgsT...  Args 
) const
inline
Exceptions
sycl::exceptions(errc)if the call was not successful.

Definition at line 137 of file plugin.hpp.

References call_nocheck().

◆ call_nocheck()

template<class UrFunc , typename... ArgsT>
ur_result_t sycl::_V1::detail::plugin::call_nocheck ( UrFunc  F,
ArgsT...  Args 
) const
inline

Calls the UR Api, traces the call, and returns the result.

Usage:

ur_result_t Err = Plugin->call(urEntryPoint, Args);
Plugin->checkUrResult(Err); // Checks Result and throws a runtime_error
// exception.
See also
plugin::checkUrResult

Definition at line 118 of file plugin.hpp.

References adapterReleased.

Referenced by call(), and checkUrResult().

◆ checkUrResult()

template<sycl::errc errc = sycl::errc::runtime>
void sycl::_V1::detail::plugin::checkUrResult ( ur_result_t  ur_result) const
inline
Exceptions
SYCL2020 exception(errc) if ur_result is not UR_RESULT_SUCCESS

Definition at line 65 of file plugin.hpp.

References __SYCL_UR_ERROR_REPORT, call_nocheck(), std::clog, sycl::_V1::detail::codeToString(), and sycl::_V1::detail::set_ur_error().

Referenced by call().

◆ containsUrPlatform()

bool sycl::_V1::detail::plugin::containsUrPlatform ( ur_platform_handle_t  Platform)
inline

Definition at line 194 of file plugin.hpp.

◆ getPlatformId()

int sycl::_V1::detail::plugin::getPlatformId ( ur_platform_handle_t  Platform)
inline

Definition at line 155 of file plugin.hpp.

Referenced by adjustLastDeviceId(), getStartingDeviceId(), and setLastDeviceId().

◆ getPluginMutex()

std::shared_ptr<std::mutex> sycl::_V1::detail::plugin::getPluginMutex ( )
inline

Definition at line 199 of file plugin.hpp.

◆ getStartingDeviceId()

int sycl::_V1::detail::plugin::getStartingDeviceId ( ur_platform_handle_t  Platform)
inline

Definition at line 170 of file plugin.hpp.

References getPlatformId().

◆ getUrAdapter()

ur_adapter_handle_t sycl::_V1::detail::plugin::getUrAdapter ( )
inline

Definition at line 105 of file plugin.hpp.

◆ getUrPlatforms()

std::vector<ur_platform_handle_t>& sycl::_V1::detail::plugin::getUrPlatforms ( )
inline

Definition at line 92 of file plugin.hpp.

References call().

◆ hasBackend()

bool sycl::_V1::detail::plugin::hasBackend ( backend  Backend) const
inline

Tells if this plugin can serve specified backend.

For example, Unified Runtime plugin will be able to serve multiple backends as determined by the platforms reported by the plugin.

Definition at line 145 of file plugin.hpp.

◆ operator=() [1/2]

plugin& sycl::_V1::detail::plugin::operator= ( const plugin )
delete

◆ operator=() [2/2]

plugin& sycl::_V1::detail::plugin::operator= ( plugin &&  other)
deletenoexcept

◆ release()

void sycl::_V1::detail::plugin::release ( )
inline

Definition at line 147 of file plugin.hpp.

References adapterReleased, and call().

◆ setLastDeviceId()

void sycl::_V1::detail::plugin::setLastDeviceId ( ur_platform_handle_t  Platform,
int  Id 
)
inline

Definition at line 179 of file plugin.hpp.

References getPlatformId().

Member Data Documentation

◆ adapterReleased

bool sycl::_V1::detail::plugin::adapterReleased = false

Definition at line 200 of file plugin.hpp.

Referenced by call_nocheck(), and release().


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