80 return MPropList.has_property<propertyT>();
90 return MPropList.get_property<propertyT>();
96 cl_context
get()
const;
101 bool is_host()
const;
117 template <
typename Param>
typename Param::return_type get_info()
const;
141 const std::vector<device> &
getDevices()
const {
return MDevices; }
143 using CachedLibProgramsT =
160 return {MCachedLibPrograms, MCachedLibProgramsMutex};
166 bool hasDevice(std::shared_ptr<detail::device_impl> Device)
const;
176 if (!is_host() &&
getPlugin().getBackend() == backend::opencl)
177 return hasDevice(Device);
179 while (!hasDevice(Device)) {
180 if (Device->isRootDevice())
183 Device->get_info<info::device::parent_device>());
199 bool isBufferLocationSupported()
const;
202 void addAssociatedDeviceGlobal(
const void *DeviceGlobalPtr);
206 const std::vector<device> &Devs,
210 std::vector<RT::PiEvent>
212 const std::shared_ptr<queue_impl> &QueueImpl);
215 std::optional<RT::PiProgram>
216 getProgramForDeviceGlobal(
const device &Device,
223 std::vector<device> MDevices;
228 CachedLibProgramsT MCachedLibPrograms;
229 std::mutex MCachedLibProgramsMutex;
231 mutable PropertySupport MSupportBufferLocationByDevices;
233 std::set<const void *> MAssociatedDeviceGlobals;
234 std::mutex MAssociatedDeviceGlobalsMutex;
236 struct DeviceGlobalInitializer {
237 DeviceGlobalInitializer() =
default;
239 : MBinImage(BinImage) {
246 void ClearEvents(
const plugin &Plugin);
249 const RTDeviceBinaryImage *MBinImage =
nullptr;
252 std::mutex MDeviceGlobalInitMutex;
261 bool MDeviceGlobalsFullyInitialized =
false;
265 std::vector<RT::PiEvent> MDeviceGlobalInitEvents;
268 std::map<std::pair<RT::PiProgram, RT::PiDevice>, DeviceGlobalInitializer>
269 MDeviceGlobalInitializers;
270 std::mutex MDeviceGlobalInitializersMutex;
273 template <
typename T,
typename Capabilities>
275 std::vector<T> &CapabilityList) {
276 for (
const sycl::device &Device : Devices) {
277 std::vector<T> NewCapabilityList;
278 std::vector<T> DeviceCapabilities = Device.get_info<Capabilities>();
279 std::set_intersection(
280 CapabilityList.begin(), CapabilityList.end(),
281 DeviceCapabilities.begin(), DeviceCapabilities.end(),
282 std::inserter(NewCapabilityList, NewCapabilityList.begin()));
283 CapabilityList = NewCapabilityList;
285 CapabilityList.shrink_to_fit();