15 #include <unordered_map>
26 class device_filter_list;
27 class ods_target_list;
33 using PluginPtr = std::shared_ptr<plugin>;
58 void registerSchedulerUsage(
bool ModifyCounter =
true);
62 std::vector<PlatformImplPtr> &getPlatformCache();
64 std::unordered_map<PlatformImplPtr, ContextImplPtr> &
65 getPlatformToDefaultContextCache();
67 std::mutex &getPlatformToDefaultContextCacheMutex();
68 std::mutex &getPlatformMapMutex();
69 std::mutex &getFilterMutex();
70 std::vector<PluginPtr> &getPlugins();
72 ods_target_list &getOneapiDeviceSelectorTargets(
const std::string &InitValue);
76 static void registerDefaultContextReleaseHandler();
79 void releaseDefaultContexts();
80 void drainThreadPool();
81 void prepareSchedulerToRelease();
84 void TraceEventXPTI(
const char *Message);
90 #ifdef XPTI_ENABLE_INSTRUMENTATION
91 void *GSYCLCallEvent =
nullptr;
97 static SpinLock MSyclGlobalHandlerProtector;
104 template <
typename T>
struct InstWithLock {
105 std::unique_ptr<T> Inst;
109 template <
typename T,
typename... Types>
110 T &getOrCreate(InstWithLock<T> &IWL, Types... Args);
112 InstWithLock<Scheduler> MScheduler;
113 InstWithLock<ProgramManager> MProgramManager;
114 InstWithLock<Sync> MSync;
115 InstWithLock<std::vector<PlatformImplPtr>> MPlatformCache;
116 InstWithLock<std::unordered_map<PlatformImplPtr, ContextImplPtr>>
117 MPlatformToDefaultContextCache;
118 InstWithLock<std::mutex> MPlatformToDefaultContextCacheMutex;
119 InstWithLock<std::mutex> MPlatformMapMutex;
120 InstWithLock<std::mutex> MFilterMutex;
121 InstWithLock<std::vector<PluginPtr>> MPlugins;
122 InstWithLock<device_filter_list> MDeviceFilterList;
123 InstWithLock<ods_target_list> MOneapiDeviceSelectorTargets;
124 InstWithLock<XPTIRegistry> MXPTIRegistry;
126 InstWithLock<ThreadPool> MHostTaskThreadPool;