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 (const std::shared_ptr< sycl::detail::pi::PiPlugin > &Plugin, backend UseBackend, void *LibraryHandle)
 
pluginoperator= (const plugin &)=delete
 
 plugin (const plugin &)=delete
 
pluginoperator= (plugin &&other) noexcept=delete
 
 plugin (plugin &&other) noexcept=delete
 
 ~plugin ()=default
 
const sycl::detail::pi::PiPlugingetPiPlugin () const
 
sycl::detail::pi::PiPlugingetPiPlugin ()
 
const std::shared_ptr< sycl::detail::pi::PiPlugin > & getPiPluginPtr () const
 
template<typename Exception = sycl::runtime_error>
void checkPiResult (sycl::detail::pi::PiResult pi_result) const
 Checks return value from PI calls. More...
 
template<sycl::errc errc>
void checkPiResult (sycl::detail::pi::PiResult pi_result) const
 
void reportPiError (sycl::detail::pi::PiResult pi_result, const char *context) const
 
template<PiApiKind PiApiOffset, typename... ArgsT>
sycl::detail::pi::PiResult call_nocheck (ArgsT... Args) const
 Calls the PiApi, traces the call, and returns the result. More...
 
template<PiApiKind PiApiOffset, typename... ArgsT>
void call (ArgsT... Args) const
 Calls the API, traces the call, checks the result. More...
 
template<sycl::errc errc, PiApiKind PiApiOffset, typename... ArgsT>
void call (ArgsT... Args) const
 
bool hasBackend (backend Backend) const
 Tells if this plugin can serve specified backend. More...
 
void * getLibraryHandle () const
 
void * getLibraryHandle ()
 
int unload ()
 
int getPlatformId (sycl::detail::pi::PiPlatform Platform)
 
int getStartingDeviceId (sycl::detail::pi::PiPlatform Platform)
 
void setLastDeviceId (sycl::detail::pi::PiPlatform Platform, int Id)
 
void adjustLastDeviceId (sycl::detail::pi::PiPlatform Platform)
 
bool containsPiPlatform (sycl::detail::pi::PiPlatform Platform)
 
std::shared_ptr< std::mutex > getPluginMutex ()
 

Public Attributes

bool pluginReleased = 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 91 of file plugin.hpp.

Constructor & Destructor Documentation

◆ plugin() [1/4]

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

◆ plugin() [2/4]

sycl::_V1::detail::plugin::plugin ( const std::shared_ptr< sycl::detail::pi::PiPlugin > &  Plugin,
backend  UseBackend,
void *  LibraryHandle 
)
inline

Definition at line 94 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 ( sycl::detail::pi::PiPlatform  Platform)
inline

Definition at line 314 of file plugin.hpp.

References getPlatformId().

◆ call() [1/2]

template<PiApiKind PiApiOffset, typename... ArgsT>
void sycl::_V1::detail::plugin::call ( 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 255 of file plugin.hpp.

References checkPiResult().

◆ call() [2/2]

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

Definition at line 262 of file plugin.hpp.

◆ call_nocheck()

template<PiApiKind PiApiOffset, typename... ArgsT>
sycl::detail::pi::PiResult sycl::_V1::detail::plugin::call_nocheck ( ArgsT...  Args) const
inline

Calls the PiApi, traces the call, and returns the result.

Usage:

PiResult Err = Plugin->call<PiApiKind::pi>(Args);
Plugin->checkPiResult(Err); // Checks Result and throws a runtime_error
// exception.
::pi_result PiResult
Definition: pi.hpp:128
See also
plugin::checkPiResult

Definition at line 174 of file plugin.hpp.

References std::cout, sycl::_V1::detail::pi::emitFunctionBeginTrace(), sycl::_V1::detail::pi::emitFunctionEndTrace(), sycl::_V1::detail::pi::emitFunctionWithArgsBeginTrace(), sycl::_V1::detail::pi::emitFunctionWithArgsEndTrace(), sycl::_V1::detail::pi::PI_TRACE_CALLS, pluginReleased, sycl::_V1::detail::pi::printArgs(), sycl::_V1::detail::pi::printOuts(), and sycl::_V1::detail::pi::trace().

◆ checkPiResult() [1/2]

template<typename Exception = sycl::runtime_error>
void sycl::_V1::detail::plugin::checkPiResult ( sycl::detail::pi::PiResult  pi_result) const
inline

Checks return value from PI calls.

Exceptions
Exceptionif pi_result is not a PI_SUCCESS.

Definition at line 118 of file plugin.hpp.

References __SYCL_CHECK_OCL_CODE_THROW, and std::clog.

Referenced by call().

◆ checkPiResult() [2/2]

template<sycl::errc errc>
void sycl::_V1::detail::plugin::checkPiResult ( sycl::detail::pi::PiResult  pi_result) const
inline
Exceptions
SYCL2020 exception(errc) if pi_result is not PI_SUCCESS

Definition at line 136 of file plugin.hpp.

References __SYCL_CHECK_CODE_THROW_VIA_ERRC, and std::clog.

◆ containsPiPlatform()

bool sycl::_V1::detail::plugin::containsPiPlatform ( sycl::detail::pi::PiPlatform  Platform)
inline

Definition at line 321 of file plugin.hpp.

◆ getLibraryHandle() [1/2]

void* sycl::_V1::detail::plugin::getLibraryHandle ( )
inline

Definition at line 273 of file plugin.hpp.

◆ getLibraryHandle() [2/2]

void* sycl::_V1::detail::plugin::getLibraryHandle ( ) const
inline

Definition at line 272 of file plugin.hpp.

◆ getPiPlugin() [1/2]

sycl::detail::pi::PiPlugin& sycl::_V1::detail::plugin::getPiPlugin ( )
inline

Definition at line 109 of file plugin.hpp.

◆ getPiPlugin() [2/2]

const sycl::detail::pi::PiPlugin& sycl::_V1::detail::plugin::getPiPlugin ( ) const
inline

Definition at line 108 of file plugin.hpp.

◆ getPiPluginPtr()

const std::shared_ptr<sycl::detail::pi::PiPlugin>& sycl::_V1::detail::plugin::getPiPluginPtr ( ) const
inline

Definition at line 110 of file plugin.hpp.

◆ getPlatformId()

int sycl::_V1::detail::plugin::getPlatformId ( sycl::detail::pi::PiPlatform  Platform)
inline

Definition at line 282 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 326 of file plugin.hpp.

◆ getStartingDeviceId()

int sycl::_V1::detail::plugin::getStartingDeviceId ( sycl::detail::pi::PiPlatform  Platform)
inline

Definition at line 297 of file plugin.hpp.

References getPlatformId().

◆ 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 270 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

◆ reportPiError()

void sycl::_V1::detail::plugin::reportPiError ( sycl::detail::pi::PiResult  pi_result,
const char *  context 
) const
inline

Definition at line 152 of file plugin.hpp.

References sycl::_V1::detail::codeToString().

◆ setLastDeviceId()

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

Definition at line 306 of file plugin.hpp.

References getPlatformId().

◆ unload()

int sycl::_V1::detail::plugin::unload ( )
inline

Definition at line 274 of file plugin.hpp.

References pluginReleased, and sycl::_V1::detail::pi::unloadPlugin().

Member Data Documentation

◆ pluginReleased

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

Definition at line 327 of file plugin.hpp.

Referenced by call_nocheck(), and unload().


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