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

Wrapper class for global data structures with non-trivial destructors. More...

#include <detail/global_handler.hpp>

Public Member Functions

 GlobalHandler (const GlobalHandler &)=delete
 
 GlobalHandler (GlobalHandler &&)=delete
 
GlobalHandleroperator= (const GlobalHandler &)=delete
 
void registerSchedulerUsage (bool ModifyCounter=true)
 
SchedulergetScheduler ()
 
bool isSchedulerAlive () const
 
ProgramManagergetProgramManager ()
 
SyncgetSync ()
 
std::vector< PlatformImplPtr > & getPlatformCache ()
 
std::unordered_map< PlatformImplPtr, ContextImplPtr > & getPlatformToDefaultContextCache ()
 
std::mutex & getPlatformToDefaultContextCacheMutex ()
 
std::mutex & getPlatformMapMutex ()
 
std::mutex & getFilterMutex ()
 
std::vector< PluginPtr > & getPlugins ()
 
ods_target_listgetOneapiDeviceSelectorTargets (const std::string &InitValue)
 
XPTIRegistrygetXPTIRegistry ()
 
ThreadPoolgetHostTaskThreadPool ()
 
void unloadPlugins ()
 
void releaseDefaultContexts ()
 
void drainThreadPool ()
 
void prepareSchedulerToRelease (bool Blocking)
 
void InitXPTI ()
 
void TraceEventXPTI (const char *Message)
 
void attachScheduler (Scheduler *Scheduler)
 

Static Public Member Functions

static GlobalHandlerinstance ()
 
static void registerDefaultContextReleaseHandler ()
 

Friends

class ObjectUsageCounter
 
void shutdown ()
 

Detailed Description

Wrapper class for global data structures with non-trivial destructors.

As user code can call SYCL Runtime functions from destructor of global objects, it is not safe for the runtime library to have global objects with non-trivial destructors. Such destructors can be called any time after exiting main, which may result in user application crashes. Instead, complex global objects must be wrapped into GlobalHandler. Its instance is stored on heap, and deallocated when the runtime library is being unloaded.

There's no need to store trivial globals here, as no code for their construction or destruction is generated anyway.

Definition at line 46 of file global_handler.hpp.

Constructor & Destructor Documentation

◆ GlobalHandler() [1/2]

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

◆ GlobalHandler() [2/2]

sycl::_V1::detail::GlobalHandler::GlobalHandler ( GlobalHandler &&  )
delete

Member Function Documentation

◆ attachScheduler()

void sycl::_V1::detail::GlobalHandler::attachScheduler ( Scheduler Scheduler)

Definition at line 139 of file global_handler.cpp.

References prepareSchedulerToRelease().

◆ drainThreadPool()

void sycl::_V1::detail::GlobalHandler::drainThreadPool ( )

Definition at line 270 of file global_handler.cpp.

Referenced by prepareSchedulerToRelease().

◆ getFilterMutex()

std::mutex & sycl::_V1::detail::GlobalHandler::getFilterMutex ( )

Definition at line 198 of file global_handler.cpp.

◆ getHostTaskThreadPool()

ThreadPool & sycl::_V1::detail::GlobalHandler::getHostTaskThreadPool ( )

◆ getOneapiDeviceSelectorTargets()

ods_target_list & sycl::_V1::detail::GlobalHandler::getOneapiDeviceSelectorTargets ( const std::string &  InitValue)

◆ getPlatformCache()

std::vector< PlatformImplPtr > & sycl::_V1::detail::GlobalHandler::getPlatformCache ( )

◆ getPlatformMapMutex()

std::mutex & sycl::_V1::detail::GlobalHandler::getPlatformMapMutex ( )

Definition at line 194 of file global_handler.cpp.

◆ getPlatformToDefaultContextCache()

std::unordered_map< PlatformImplPtr, ContextImplPtr > & sycl::_V1::detail::GlobalHandler::getPlatformToDefaultContextCache ( )

◆ getPlatformToDefaultContextCacheMutex()

std::mutex & sycl::_V1::detail::GlobalHandler::getPlatformToDefaultContextCacheMutex ( )

◆ getPlugins()

std::vector< PluginPtr > & sycl::_V1::detail::GlobalHandler::getPlugins ( )

◆ getProgramManager()

ProgramManager & sycl::_V1::detail::GlobalHandler::getProgramManager ( )

Definition at line 175 of file global_handler.cpp.

Referenced by sycl::_V1::detail::ProgramManager::getInstance().

◆ getScheduler()

Scheduler & sycl::_V1::detail::GlobalHandler::getScheduler ( )

◆ getSync()

Sync & sycl::_V1::detail::GlobalHandler::getSync ( )

Definition at line 188 of file global_handler.cpp.

◆ getXPTIRegistry()

◆ InitXPTI()

void sycl::_V1::detail::GlobalHandler::InitXPTI ( )

◆ instance()

◆ isSchedulerAlive()

bool sycl::_V1::detail::GlobalHandler::isSchedulerAlive ( ) const

Definition at line 169 of file global_handler.cpp.

Referenced by sycl::_V1::detail::Scheduler::isInstanceAlive().

◆ operator=()

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

◆ prepareSchedulerToRelease()

void sycl::_V1::detail::GlobalHandler::prepareSchedulerToRelease ( bool  Blocking)

◆ registerDefaultContextReleaseHandler()

void sycl::_V1::detail::GlobalHandler::registerDefaultContextReleaseHandler ( )
static

Definition at line 236 of file global_handler.cpp.

Referenced by sycl::_V1::detail::platform_impl::get_platforms().

◆ registerSchedulerUsage()

void sycl::_V1::detail::GlobalHandler::registerSchedulerUsage ( bool  ModifyCounter = true)

Definition at line 171 of file global_handler.cpp.

Referenced by getScheduler().

◆ releaseDefaultContexts()

void sycl::_V1::detail::GlobalHandler::releaseDefaultContexts ( )

◆ TraceEventXPTI()

void sycl::_V1::detail::GlobalHandler::TraceEventXPTI ( const char *  Message)

◆ unloadPlugins()

void sycl::_V1::detail::GlobalHandler::unloadPlugins ( )

Definition at line 242 of file global_handler.cpp.

References getPlugins(), and piTearDown().

Friends And Related Function Documentation

◆ ObjectUsageCounter

friend class ObjectUsageCounter
friend

Definition at line 95 of file global_handler.hpp.

◆ shutdown

void shutdown ( )
friend

Definition at line 287 of file global_handler.cpp.


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