15 #include <unordered_map>
26 class device_filter_list;
59 std::vector<PlatformImplPtr> &getPlatformCache();
61 std::unordered_map<PlatformImplPtr, ContextImplPtr> &
62 getPlatformToDefaultContextCache();
64 std::mutex &getPlatformToDefaultContextCacheMutex();
65 std::mutex &getPlatformMapMutex();
66 std::mutex &getFilterMutex();
67 std::vector<plugin> &getPlugins();
70 std::mutex &getHandlerExtendedMembersMutex();
73 static void registerDefaultContextReleaseHandler();
84 template <
typename T>
struct InstWithLock {
85 std::unique_ptr<T> Inst;
89 template <
typename T,
typename... Types>
90 T &getOrCreate(InstWithLock<T> &IWL, Types... Args);
92 InstWithLock<Scheduler> MScheduler;
93 InstWithLock<ProgramManager> MProgramManager;
94 InstWithLock<Sync> MSync;
95 InstWithLock<std::vector<PlatformImplPtr>> MPlatformCache;
96 InstWithLock<std::unordered_map<PlatformImplPtr, ContextImplPtr>>
97 MPlatformToDefaultContextCache;
98 InstWithLock<std::mutex> MPlatformToDefaultContextCacheMutex;
99 InstWithLock<std::mutex> MPlatformMapMutex;
100 InstWithLock<std::mutex> MFilterMutex;
101 InstWithLock<std::vector<plugin>> MPlugins;
102 InstWithLock<device_filter_list> MDeviceFilterList;
103 InstWithLock<XPTIRegistry> MXPTIRegistry;
105 InstWithLock<std::mutex> MHandlerExtendedMembersMutex;
107 InstWithLock<ThreadPool> MHostTaskThreadPool;