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 | |
Scheduler & | getScheduler () |
ProgramManager & | getProgramManager () |
Sync & | getSync () |
std::vector< PlatformImplPtr > & | getPlatformCache () |
std::unordered_map< PlatformImplPtr, ContextImplPtr > & | getPlatformToDefaultContextCache () |
std::mutex & | getPlatformToDefaultContextCacheMutex () |
std::mutex & | getPlatformMapMutex () |
std::mutex & | getFilterMutex () |
std::vector< plugin > & | getPlugins () |
device_filter_list & | getDeviceFilterList (const std::string &InitValue) |
XPTIRegistry & | getXPTIRegistry () |
std::mutex & | getHandlerExtendedMembersMutex () |
ThreadPool & | getHostTaskThreadPool () |
Static Public Member Functions | |
static GlobalHandler & | instance () |
static void | registerDefaultContextReleaseHandler () |
Friends | |
void | releaseDefaultContexts () |
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 45 of file global_handler.hpp.
|
delete |
|
delete |
device_filter_list & cl::sycl::detail::GlobalHandler::getDeviceFilterList | ( | const std::string & | InitValue | ) |
Definition at line 82 of file global_handler.cpp.
std::mutex & cl::sycl::detail::GlobalHandler::getFilterMutex | ( | ) |
Definition at line 75 of file global_handler.cpp.
std::mutex & cl::sycl::detail::GlobalHandler::getHandlerExtendedMembersMutex | ( | ) |
Definition at line 90 of file global_handler.cpp.
ThreadPool & cl::sycl::detail::GlobalHandler::getHostTaskThreadPool | ( | ) |
Definition at line 94 of file global_handler.cpp.
References std::get().
std::vector< PlatformImplPtr > & cl::sycl::detail::GlobalHandler::getPlatformCache | ( | ) |
Definition at line 67 of file global_handler.cpp.
std::mutex & cl::sycl::detail::GlobalHandler::getPlatformMapMutex | ( | ) |
Definition at line 71 of file global_handler.cpp.
std::unordered_map< PlatformImplPtr, ContextImplPtr > & cl::sycl::detail::GlobalHandler::getPlatformToDefaultContextCache | ( | ) |
Definition at line 57 of file global_handler.cpp.
Referenced by cl::sycl::platform::ext_oneapi_get_default_context().
std::mutex & cl::sycl::detail::GlobalHandler::getPlatformToDefaultContextCacheMutex | ( | ) |
Definition at line 61 of file global_handler.cpp.
Referenced by cl::sycl::platform::ext_oneapi_get_default_context().
std::vector< plugin > & cl::sycl::detail::GlobalHandler::getPlugins | ( | ) |
Definition at line 78 of file global_handler.cpp.
ProgramManager & cl::sycl::detail::GlobalHandler::getProgramManager | ( | ) |
Definition at line 52 of file global_handler.cpp.
Scheduler & cl::sycl::detail::GlobalHandler::getScheduler | ( | ) |
Definition at line 50 of file global_handler.cpp.
Sync & cl::sycl::detail::GlobalHandler::getSync | ( | ) |
Definition at line 65 of file global_handler.cpp.
XPTIRegistry & cl::sycl::detail::GlobalHandler::getXPTIRegistry | ( | ) |
Definition at line 86 of file global_handler.cpp.
|
static |
DllMain
or __attribute__((destructor))
is called). Definition at line 35 of file global_handler.cpp.
Referenced by cl::sycl::platform::ext_oneapi_get_default_context(), cl::sycl::handler::mem_advise(), and cl::sycl::ext::oneapi::filter_selector::select_device().
|
static |
Definition at line 119 of file global_handler.cpp.
|
friend |
Definition at line 101 of file global_handler.cpp.
|
friend |
Definition at line 123 of file global_handler.cpp.