Wrapper class for global data structures with non-trivial destructors. More...
#include <detail/global_handler.hpp>
Static Public Member Functions | |
static GlobalHandler & | instance () |
static void | registerDefaultContextReleaseHandler () |
Friends | |
class | ObjectUsageCounter |
void | shutdown () |
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.
|
delete |
|
delete |
void sycl::_V1::detail::GlobalHandler::attachScheduler | ( | Scheduler * | Scheduler | ) |
Definition at line 139 of file global_handler.cpp.
References prepareSchedulerToRelease().
void sycl::_V1::detail::GlobalHandler::drainThreadPool | ( | ) |
Definition at line 270 of file global_handler.cpp.
Referenced by prepareSchedulerToRelease().
std::mutex & sycl::_V1::detail::GlobalHandler::getFilterMutex | ( | ) |
Definition at line 198 of file global_handler.cpp.
ThreadPool & sycl::_V1::detail::GlobalHandler::getHostTaskThreadPool | ( | ) |
Definition at line 215 of file global_handler.cpp.
References sycl::_V1::detail::SYCLConfig< Config >::get().
Referenced by sycl::_V1::detail::queue_impl::getThreadPool().
ods_target_list & sycl::_V1::detail::GlobalHandler::getOneapiDeviceSelectorTargets | ( | const std::string & | InitValue | ) |
Definition at line 207 of file global_handler.cpp.
Referenced by sycl::_V1::detail::SYCLConfig< ONEAPI_DEVICE_SELECTOR >::get().
std::vector< PlatformImplPtr > & sycl::_V1::detail::GlobalHandler::getPlatformCache | ( | ) |
Definition at line 190 of file global_handler.cpp.
Referenced by sycl::_V1::detail::platform_impl::getOrMakePlatformImpl().
std::mutex & sycl::_V1::detail::GlobalHandler::getPlatformMapMutex | ( | ) |
Definition at line 194 of file global_handler.cpp.
std::unordered_map< PlatformImplPtr, ContextImplPtr > & sycl::_V1::detail::GlobalHandler::getPlatformToDefaultContextCache | ( | ) |
Definition at line 180 of file global_handler.cpp.
Referenced by sycl::_V1::platform::ext_oneapi_get_default_context().
std::mutex & sycl::_V1::detail::GlobalHandler::getPlatformToDefaultContextCacheMutex | ( | ) |
Definition at line 184 of file global_handler.cpp.
Referenced by sycl::_V1::platform::ext_oneapi_get_default_context().
std::vector< PluginPtr > & sycl::_V1::detail::GlobalHandler::getPlugins | ( | ) |
Definition at line 201 of file global_handler.cpp.
References sycl::_V1::detail::enableOnCrashStackPrinting().
Referenced by sycl::_V1::detail::pi::initialize(), and unloadPlugins().
ProgramManager & sycl::_V1::detail::GlobalHandler::getProgramManager | ( | ) |
Definition at line 175 of file global_handler.cpp.
Referenced by sycl::_V1::detail::ProgramManager::getInstance().
Scheduler & sycl::_V1::detail::GlobalHandler::getScheduler | ( | ) |
Definition at line 156 of file global_handler.cpp.
References sycl::_V1::detail::enableOnCrashStackPrinting(), and registerSchedulerUsage().
Referenced by sycl::_V1::detail::Scheduler::getInstance().
Sync & sycl::_V1::detail::GlobalHandler::getSync | ( | ) |
Definition at line 188 of file global_handler.cpp.
XPTIRegistry & sycl::_V1::detail::GlobalHandler::getXPTIRegistry | ( | ) |
Definition at line 211 of file global_handler.cpp.
Referenced by sycl::_V1::detail::XPTIRegistry::bufferConstructorNotification(), sycl::_V1::detail::pi::initializePlugins(), InitXPTI(), sycl::_V1::detail::XPTIRegistry::sampledImageConstructorNotification(), and sycl::_V1::detail::XPTIRegistry::unsampledImageConstructorNotification().
void sycl::_V1::detail::GlobalHandler::InitXPTI | ( | ) |
Definition at line 72 of file global_handler.cpp.
References getXPTIRegistry(), GMajVer, GMinVer, GVerStr, sycl::_V1::detail::XPTIRegistry::initializeStream(), and sycl::_V1::detail::SYCL_STREAM_NAME.
Referenced by TraceEventXPTI().
|
static |
DllMain
or __attribute__((destructor))
is called). Definition at line 123 of file global_handler.cpp.
Referenced by sycl::_V1::detail::XPTIRegistry::bufferConstructorNotification(), sycl::_V1::exception::exception(), sycl::_V1::platform::ext_oneapi_get_default_context(), sycl::_V1::detail::SYCLConfig< ONEAPI_DEVICE_SELECTOR >::get(), sycl::_V1::detail::ProgramManager::getInstance(), sycl::_V1::detail::Scheduler::getInstance(), sycl::_V1::detail::platform_impl::getOrMakePlatformImpl(), sycl::_V1::detail::queue_impl::getThreadPool(), sycl::_V1::detail::pi::initialize(), sycl::_V1::detail::pi::initializePlugins(), sycl::_V1::detail::Scheduler::isInstanceAlive(), sycl::_V1::detail::DispatchHostTask::operator()(), sycl::_V1::detail::XPTIRegistry::sampledImageConstructorNotification(), sycl::_V1::detail::XPTIRegistry::unsampledImageConstructorNotification(), and sycl::_V1::detail::DefaultContextReleaseHandler::~DefaultContextReleaseHandler().
bool sycl::_V1::detail::GlobalHandler::isSchedulerAlive | ( | ) | const |
Definition at line 169 of file global_handler.cpp.
Referenced by sycl::_V1::detail::Scheduler::isInstanceAlive().
|
delete |
void sycl::_V1::detail::GlobalHandler::prepareSchedulerToRelease | ( | bool | Blocking | ) |
Definition at line 260 of file global_handler.cpp.
References sycl::_V1::detail::BLOCKING, drainThreadPool(), and sycl::_V1::detail::NON_BLOCKING.
Referenced by attachScheduler(), and sycl::_V1::detail::ObjectUsageCounter::~ObjectUsageCounter().
|
static |
Definition at line 236 of file global_handler.cpp.
Referenced by sycl::_V1::detail::platform_impl::get_platforms().
void sycl::_V1::detail::GlobalHandler::registerSchedulerUsage | ( | bool | ModifyCounter = true | ) |
Definition at line 171 of file global_handler.cpp.
Referenced by getScheduler().
void sycl::_V1::detail::GlobalHandler::releaseDefaultContexts | ( | ) |
Definition at line 222 of file global_handler.cpp.
Referenced by sycl::_V1::detail::DefaultContextReleaseHandler::~DefaultContextReleaseHandler().
void sycl::_V1::detail::GlobalHandler::TraceEventXPTI | ( | const char * | Message | ) |
Definition at line 85 of file global_handler.cpp.
References InitXPTI(), sycl::_V1::detail::tls_code_loc_t::query(), and sycl::_V1::detail::SYCL_STREAM_NAME.
Referenced by sycl::_V1::exception::exception(), and sycl::_V1::detail::DispatchHostTask::operator()().
void sycl::_V1::detail::GlobalHandler::unloadPlugins | ( | ) |
Definition at line 242 of file global_handler.cpp.
References getPlugins(), and piTearDown().
|
friend |
Definition at line 95 of file global_handler.hpp.
|
friend |
Definition at line 287 of file global_handler.cpp.