DPC++ Runtime
Runtime libraries for oneAPI DPC++
context_impl.cpp
Go to the documentation of this file.
1 //==---------------- context_impl.cpp - SYCL context -----------*- C++ -*---==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 // ===--------------------------------------------------------------------=== //
8 
10 #include <detail/context_info.hpp>
11 #include <detail/event_info.hpp>
12 #include <detail/platform_impl.hpp>
13 #include <detail/queue_impl.hpp>
14 #include <sycl/detail/common.hpp>
16 #include <sycl/detail/pi.hpp>
17 #include <sycl/device.hpp>
18 #include <sycl/exception.hpp>
19 #include <sycl/exception_list.hpp>
20 #include <sycl/info/info_desc.hpp>
21 #include <sycl/platform.hpp>
23 #include <sycl/property_list.hpp>
24 #include <sycl/stl.hpp>
25 
26 namespace sycl {
28 namespace detail {
29 
30 context_impl::context_impl(const device &Device, async_handler AsyncHandler,
31  const property_list &PropList)
32  : MAsyncHandler(AsyncHandler), MDevices(1, Device), MContext(nullptr),
33  MPlatform(), MPropList(PropList),
34  MHostContext(detail::getSyclObjImpl(Device)->is_host()),
35  MSupportBufferLocationByDevices(NotChecked) {
36  MKernelProgramCache.setContextPtr(this);
37 }
38 
39 context_impl::context_impl(const std::vector<sycl::device> Devices,
40  async_handler AsyncHandler,
41  const property_list &PropList)
42  : MAsyncHandler(AsyncHandler), MDevices(Devices), MContext(nullptr),
43  MPlatform(), MPropList(PropList), MHostContext(false),
44  MSupportBufferLocationByDevices(NotChecked) {
45  MPlatform = detail::getSyclObjImpl(MDevices[0].get_platform());
46  std::vector<RT::PiDevice> DeviceIds;
47  for (const auto &D : MDevices) {
48  DeviceIds.push_back(getSyclObjImpl(D)->getHandleRef());
49  }
50 
51  const auto Backend = getPlugin().getBackend();
52  if (Backend == backend::ext_oneapi_cuda) {
53  const bool UseCUDAPrimaryContext = MPropList.has_property<
54  ext::oneapi::cuda::property::context::use_primary_context>();
55  const pi_context_properties Props[] = {
56  static_cast<pi_context_properties>(
58  static_cast<pi_context_properties>(UseCUDAPrimaryContext), 0};
59 
61  Props, DeviceIds.size(), DeviceIds.data(), nullptr, nullptr, &MContext);
62  } else {
63  getPlugin().call<PiApiKind::piContextCreate>(nullptr, DeviceIds.size(),
64  DeviceIds.data(), nullptr,
65  nullptr, &MContext);
66  }
67 
68  MKernelProgramCache.setContextPtr(this);
69 }
70 
72  const plugin &Plugin)
73  : MAsyncHandler(AsyncHandler), MDevices(), MContext(PiContext), MPlatform(),
74  MHostContext(false), MSupportBufferLocationByDevices(NotChecked) {
75 
76  std::vector<RT::PiDevice> DeviceIds;
77  size_t DevicesNum = 0;
78  // TODO catch an exception and put it to list of asynchronous exceptions
80  MContext, PI_CONTEXT_INFO_NUM_DEVICES, sizeof(DevicesNum), &DevicesNum,
81  nullptr);
82  DeviceIds.resize(DevicesNum);
83  // TODO catch an exception and put it to list of asynchronous exceptions
85  sizeof(RT::PiDevice) * DevicesNum,
86  &DeviceIds[0], nullptr);
87 
88  if (!DeviceIds.empty()) {
89  std::shared_ptr<detail::platform_impl> Platform =
90  platform_impl::getPlatformFromPiDevice(DeviceIds[0], Plugin);
91  for (RT::PiDevice Dev : DeviceIds) {
92  MDevices.emplace_back(createSyclObjFromImpl<device>(
93  Platform->getOrMakeDeviceImpl(Dev, Platform)));
94  }
95  MPlatform = Platform;
96  }
97  // TODO catch an exception and put it to list of asynchronous exceptions
98  // getPlugin() will be the same as the Plugin passed. This should be taken
99  // care of when creating device object.
100  //
101  // TODO: Move this backend-specific retain of the context to SYCL-2020 style
102  // make_context<backend::opencl> interop, when that is created.
103  if (getPlugin().getBackend() == sycl::backend::opencl) {
105  }
106  MKernelProgramCache.setContextPtr(this);
107 }
108 
109 cl_context context_impl::get() const {
110  if (MHostContext) {
111  throw invalid_object_error(
112  "This instance of context doesn't support OpenCL interoperability.",
113  PI_ERROR_INVALID_CONTEXT);
114  }
115  // TODO catch an exception and put it to list of asynchronous exceptions
117  return pi::cast<cl_context>(MContext);
118 }
119 
120 bool context_impl::is_host() const { return MHostContext; }
121 
123  // Free all events associated with the initialization of device globals.
124  for (auto &DeviceGlobalInitializer : MDeviceGlobalInitializers)
125  DeviceGlobalInitializer.second.ClearEvents(getPlugin());
126  // Free all device_global USM allocations associated with this context.
127  for (const void *DeviceGlobal : MAssociatedDeviceGlobals) {
128  DeviceGlobalMapEntry *DGEntry =
130  DeviceGlobal);
131  DGEntry->removeAssociatedResources(this);
132  }
133  for (auto LibProg : MCachedLibPrograms) {
134  assert(LibProg.second && "Null program must not be kept in the cache");
135  getPlugin().call<PiApiKind::piProgramRelease>(LibProg.second);
136  }
137  if (!MHostContext) {
138  // TODO catch an exception and put it to list of asynchronous exceptions
140  }
141 }
142 
144  return MAsyncHandler;
145 }
146 
147 template <>
148 uint32_t context_impl::get_info<info::context::reference_count>() const {
149  if (is_host())
150  return 0;
151  return get_context_info<info::context::reference_count>(this->getHandleRef(),
152  this->getPlugin());
153 }
154 template <> platform context_impl::get_info<info::context::platform>() const {
155  if (is_host())
156  return createSyclObjFromImpl<platform>(
158  return createSyclObjFromImpl<platform>(MPlatform);
159 }
160 template <>
161 std::vector<sycl::device>
162 context_impl::get_info<info::context::devices>() const {
163  return MDevices;
164 }
165 template <>
166 std::vector<sycl::memory_order>
167 context_impl::get_info<info::context::atomic_memory_order_capabilities>()
168  const {
169  if (is_host())
170  return {sycl::memory_order::relaxed, sycl::memory_order::acquire,
171  sycl::memory_order::release, sycl::memory_order::acq_rel,
172  sycl::memory_order::seq_cst};
173 
176  MContext,
178  sizeof(Result), &Result, nullptr);
179  return readMemoryOrderBitfield(Result);
180 }
181 template <>
182 std::vector<sycl::memory_scope>
183 context_impl::get_info<info::context::atomic_memory_scope_capabilities>()
184  const {
185  if (is_host())
186  return {sycl::memory_scope::work_item, sycl::memory_scope::sub_group,
187  sycl::memory_scope::work_group, sycl::memory_scope::device,
188  sycl::memory_scope::system};
189 
192  MContext,
194  sizeof(Result), &Result, nullptr);
195  return readMemoryScopeBitfield(Result);
196 }
197 
199 const RT::PiContext &context_impl::getHandleRef() const { return MContext; }
200 
202  return MKernelProgramCache;
203 }
204 
206  std::shared_ptr<detail::device_impl> Device) const {
207  for (auto D : MDevices)
208  if (getSyclObjImpl(D) == Device)
209  return true;
210  return false;
211 }
212 
215  for (device D : MDevices)
216  if (getSyclObjImpl(D)->getHandleRef() == DevicePI)
217  return getSyclObjImpl(D);
218 
219  return nullptr;
220 }
221 
223  auto Plugin = getPlugin();
224  if (Plugin.getBackend() == backend::opencl)
226  pi_native_handle Handle;
227  Plugin.call<PiApiKind::piextContextGetNativeHandle>(getHandleRef(), &Handle);
228  return Handle;
229 }
230 
232  if (MSupportBufferLocationByDevices != NotChecked)
233  return MSupportBufferLocationByDevices == Supported ? true : false;
234  // Check that devices within context have support of buffer location
235  MSupportBufferLocationByDevices = Supported;
236  for (auto &Device : MDevices) {
237  if (!Device.has_extension("cl_intel_mem_alloc_buffer_location")) {
238  MSupportBufferLocationByDevices = NotSupported;
239  break;
240  }
241  }
242  return MSupportBufferLocationByDevices == Supported ? true : false;
243 }
244 
245 void context_impl::addAssociatedDeviceGlobal(const void *DeviceGlobalPtr) {
246  std::lock_guard<std::mutex> Lock{MAssociatedDeviceGlobalsMutex};
247  MAssociatedDeviceGlobals.insert(DeviceGlobalPtr);
248 }
249 
251  RT::PiProgram Program, const std::vector<device> &Devs,
252  const RTDeviceBinaryImage *BinImage) {
253  std::lock_guard<std::mutex> Lock(MDeviceGlobalInitializersMutex);
254  for (const device &Dev : Devs) {
255  auto Key = std::make_pair(Program, getSyclObjImpl(Dev)->getHandleRef());
256  MDeviceGlobalInitializers.emplace(Key, BinImage);
257  }
258 }
259 
260 std::vector<RT::PiEvent> context_impl::initializeDeviceGlobals(
261  pi::PiProgram NativePrg, const std::shared_ptr<queue_impl> &QueueImpl) {
262  const plugin &Plugin = getPlugin();
263  const DeviceImplPtr &DeviceImpl = QueueImpl->getDeviceImplPtr();
264  std::lock_guard<std::mutex> NativeProgramLock(MDeviceGlobalInitializersMutex);
265  auto ImgIt = MDeviceGlobalInitializers.find(
266  std::make_pair(NativePrg, DeviceImpl->getHandleRef()));
267  if (ImgIt == MDeviceGlobalInitializers.end() ||
268  ImgIt->second.MDeviceGlobalsFullyInitialized)
269  return {};
270 
271  DeviceGlobalInitializer &InitRef = ImgIt->second;
272  {
273  std::lock_guard<std::mutex> InitLock(InitRef.MDeviceGlobalInitMutex);
274  std::vector<RT::PiEvent> &InitEventsRef = InitRef.MDeviceGlobalInitEvents;
275  if (!InitEventsRef.empty()) {
276  // Initialization has begun but we do not know if the events are done.
277  auto NewEnd = std::remove_if(
278  InitEventsRef.begin(), InitEventsRef.end(),
279  [&Plugin](const RT::PiEvent &Event) {
280  return get_event_info<info::event::command_execution_status>(
281  Event, Plugin) == info::event_command_status::complete;
282  });
283  // Release the removed events.
284  for (auto EventIt = NewEnd; EventIt != InitEventsRef.end(); ++EventIt)
285  Plugin.call<PiApiKind::piEventRelease>(*EventIt);
286  // Remove them from the collection.
287  InitEventsRef.erase(NewEnd, InitEventsRef.end());
288  // If there are no more events, we can mark it as fully initialized.
289  if (InitEventsRef.empty())
290  InitRef.MDeviceGlobalsFullyInitialized = true;
291  return InitEventsRef;
292  } else if (InitRef.MDeviceGlobalsFullyInitialized) {
293  // MDeviceGlobalsFullyInitialized could have been set while we were
294  // waiting on the lock and since there were no init events we are done.
295  return {};
296  }
297 
298  // There were no events and it was not set as fully initialized, so this is
299  // responsible for intializing the device globals.
300  auto DeviceGlobals = InitRef.MBinImage->getDeviceGlobals();
301  std::vector<std::string> DeviceGlobalIds;
302  DeviceGlobalIds.reserve(DeviceGlobals.size());
303  for (const pi_device_binary_property &DeviceGlobal : DeviceGlobals)
304  DeviceGlobalIds.push_back(DeviceGlobal->Name);
305  std::vector<DeviceGlobalMapEntry *> DeviceGlobalEntries =
307  DeviceGlobalIds,
308  /*ExcludeDeviceImageScopeDecorated=*/true);
309 
310  // If there were no device globals without device_image_scope the device
311  // globals are trivially fully initialized and we can end early.
312  if (DeviceGlobalEntries.empty()) {
313  InitRef.MDeviceGlobalsFullyInitialized = true;
314  return {};
315  }
316 
317  // We may have reserved too much for DeviceGlobalEntries, but now that we
318  // know number of device globals to initialize, we can use that for the
319  // list.
320  InitEventsRef.reserve(DeviceGlobalEntries.size());
321 
322  // Device global map entry pointers will not die before the end of the
323  // program and the pointers will stay the same, so we do not need
324  // m_DeviceGlobalsMutex here.
325  for (DeviceGlobalMapEntry *DeviceGlobalEntry : DeviceGlobalEntries) {
326  // Get or allocate the USM memory associated with the device global.
327  DeviceGlobalUSMMem &DeviceGlobalUSM =
328  DeviceGlobalEntry->getOrAllocateDeviceGlobalUSM(QueueImpl);
329 
330  // If the device global still has a zero-initialization event it should be
331  // added to the initialization events list. Since initialization events
332  // are cleaned up separately from cleaning up the device global USM memory
333  // this must retain the event.
334  {
335  if (OwnedPiEvent ZIEvent = DeviceGlobalUSM.getZeroInitEvent(Plugin))
336  InitEventsRef.push_back(ZIEvent.TransferOwnership());
337  }
338 
339  // Write the pointer to the device global and store the event in the
340  // initialize events list.
341  RT::PiEvent InitEvent;
342  void *const &USMPtr = DeviceGlobalUSM.getPtr();
344  QueueImpl->getHandleRef(), NativePrg,
345  DeviceGlobalEntry->MUniqueId.c_str(), false, sizeof(void *), 0,
346  &USMPtr, 0, nullptr, &InitEvent);
347 
348  InitEventsRef.push_back(InitEvent);
349  }
350 
351  return InitEventsRef;
352  }
353 }
354 
355 void context_impl::DeviceGlobalInitializer::ClearEvents(const plugin &Plugin) {
356  for (const RT::PiEvent &Event : MDeviceGlobalInitEvents)
357  Plugin.call<PiApiKind::piEventRelease>(Event);
358  MDeviceGlobalInitEvents.clear();
359 }
360 
361 std::optional<RT::PiProgram> context_impl::getProgramForDeviceGlobal(
362  const device &Device, DeviceGlobalMapEntry *DeviceGlobalEntry) {
363  KernelProgramCache::ProgramWithBuildStateT *BuildRes = nullptr;
364  {
365  auto LockedCache = MKernelProgramCache.acquireCachedPrograms();
366  auto &KeyMap = LockedCache.get().KeyMap;
367  auto &Cache = LockedCache.get().Cache;
368  RT::PiDevice &DevHandle = getSyclObjImpl(Device)->getHandleRef();
369  for (std::uintptr_t ImageIDs : DeviceGlobalEntry->MImageIdentifiers) {
370  auto OuterKey = std::make_pair(ImageIDs, DevHandle);
371  size_t NProgs = KeyMap.count(OuterKey);
372  if (NProgs == 0)
373  continue;
374  // If the cache has multiple programs for the identifiers or if we have
375  // already found a program in the cache with the device_global, we cannot
376  // proceed.
377  if (NProgs > 1 || (BuildRes && NProgs == 1))
378  throw sycl::exception(
380  "More than one image exists with the device_global.");
381  auto KeyMappingsIt = KeyMap.find(OuterKey);
382  assert(KeyMappingsIt != KeyMap.end());
383  auto CachedProgIt = Cache.find(KeyMappingsIt->second);
384  assert(CachedProgIt != Cache.end());
385  BuildRes = &CachedProgIt->second;
386  }
387  }
388  if (!BuildRes)
389  return std::nullopt;
390  return MKernelProgramCache.waitUntilBuilt<compile_program_error>(BuildRes);
391 }
392 
393 } // namespace detail
394 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
395 } // namespace sycl
sycl::_V1::detail::context_impl::addAssociatedDeviceGlobal
void addAssociatedDeviceGlobal(const void *DeviceGlobalPtr)
Adds an associated device global to the tracked associates.
Definition: context_impl.cpp:245
sycl::_V1::property_list
Objects of the property_list class are containers for the SYCL properties.
Definition: property_list.hpp:24
piEventRelease
pi_result piEventRelease(pi_event event)
Definition: pi_esimd_emulator.cpp:1485
property_list.hpp
sycl::_V1::detail::KernelProgramCache::acquireCachedPrograms
Locked< ProgramCache > acquireCachedPrograms()
Definition: kernel_program_cache.hpp:105
sycl::_V1::detail::DeviceGlobalMapEntry::MImageIdentifiers
std::set< std::uintptr_t > MImageIdentifiers
Definition: device_global_map_entry.hpp:88
event_info.hpp
sycl::_V1::detail::platform_impl::getPlatformFromPiDevice
static std::shared_ptr< platform_impl > getPlatformFromPiDevice(RT::PiDevice PiDevice, const plugin &Plugin)
Queries the cache for the specified platform based on an input device.
Definition: platform_impl.cpp:61
sycl::_V1::detail::context_impl::get_async_handler
const async_handler & get_async_handler() const
Gets asynchronous exception handler.
Definition: context_impl.cpp:143
context_impl.hpp
sycl::_V1::make_error_code
std::error_code make_error_code(sycl::errc E) noexcept
Constructs an error code using e and sycl_category()
Definition: exception.cpp:91
sycl::_V1::detail::context_impl::context_impl
context_impl(const device &Device, async_handler AsyncHandler, const property_list &PropList)
Constructs a context_impl using a single SYCL devices.
Definition: context_impl.cpp:30
stl.hpp
device.hpp
__SYCL_INLINE_VER_NAMESPACE
#define __SYCL_INLINE_VER_NAMESPACE(X)
Definition: defines_elementary.hpp:11
sycl::_V1::detail::context_impl::hasDevice
bool hasDevice(std::shared_ptr< detail::device_impl > Device) const
Returns true if and only if context contains the given device.
Definition: context_impl.cpp:205
sycl::_V1::detail::DeviceImplPtr
std::shared_ptr< device_impl > DeviceImplPtr
Definition: program_manager.hpp:59
sycl::_V1::detail::readMemoryOrderBitfield
std::vector< memory_order > readMemoryOrderBitfield(pi_memory_order_capabilities bits)
Definition: memory_enums.hpp:49
pi_context_properties
intptr_t pi_context_properties
Definition: pi.h:536
context_properties.hpp
sycl::_V1::detail::pi::PiDevice
::pi_device PiDevice
Definition: pi.hpp:124
piContextGetInfo
pi_result piContextGetInfo(pi_context context, pi_context_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
Definition: pi_esimd_emulator.cpp:864
sycl::_V1::detail::DeviceGlobalMapEntry
Definition: device_global_map_entry.hpp:81
cuda_definitions.hpp
sycl::_V1::detail::platform_impl::getHostPlatformImpl
static std::shared_ptr< platform_impl > getHostPlatformImpl()
Static functions that help maintain platform uniquess and equality of comparison.
Definition: platform_impl.cpp:31
sycl::_V1::detail::context_impl::isBufferLocationSupported
bool isBufferLocationSupported() const
Definition: context_impl.cpp:231
sycl
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14
sycl::_V1::detail::PiInfoCode
Definition: info_desc_helpers.hpp:18
sycl::_V1::detail::plugin::getBackend
backend getBackend(void) const
Definition: plugin.hpp:229
PI_CONTEXT_INFO_NUM_DEVICES
@ PI_CONTEXT_INFO_NUM_DEVICES
Definition: pi.h:342
queue_impl.hpp
pi.hpp
sycl::_V1::detail::getPlugin
static const plugin & getPlugin(backend Backend)
Definition: backend.cpp:32
sycl::_V1::detail::context_impl::Supported
@ Supported
Definition: context_impl.hpp:219
sycl::_V1::backend::ext_oneapi_cuda
@ ext_oneapi_cuda
sycl::_V1::detail::KernelProgramCache::BuildResult
Denotes pointer to some entity with its general state and build error.
Definition: kernel_program_cache.hpp:49
sycl::_V1::detail::DeviceGlobalMapEntry::removeAssociatedResources
void removeAssociatedResources(const context_impl *CtxImpl)
Definition: device_global_map_entry.cpp:95
compile_program_error
sycl::_V1::detail::context_impl::getHandleRef
RT::PiContext & getHandleRef()
Gets the underlying context object (if any) without reference count modification.
Definition: context_impl.cpp:198
sycl::_V1::detail::context_impl::getNative
pi_native_handle getNative() const
Gets the native handle of the SYCL context.
Definition: context_impl.cpp:222
PI_CONTEXT_INFO_DEVICES
@ PI_CONTEXT_INFO_DEVICES
Definition: pi.h:340
sycl::_V1::detail::ProgramManager::getInstance
static ProgramManager & getInstance()
Definition: program_manager.cpp:65
sycl::_V1::detail::context_impl::getProgramForDeviceGlobal
std::optional< RT::PiProgram > getProgramForDeviceGlobal(const device &Device, DeviceGlobalMapEntry *DeviceGlobalEntry)
Gets a program associated with a device global from the cache.
Definition: context_impl.cpp:361
sycl::_V1::detail::context_impl::initializeDeviceGlobals
std::vector< RT::PiEvent > initializeDeviceGlobals(pi::PiProgram NativePrg, const std::shared_ptr< queue_impl > &QueueImpl)
Initializes device globals for a program on the associated queue.
Definition: context_impl.cpp:260
piContextRelease
pi_result piContextRelease(pi_context context)
Definition: pi_esimd_emulator.cpp:894
sycl::_V1::detail::plugin
The plugin class provides a unified interface to the underlying low-level runtimes for the device-agn...
Definition: plugin.hpp:90
piProgramRelease
pi_result piProgramRelease(pi_program program)
Definition: pi_esimd_emulator.cpp:1352
sycl::_V1::detail::context_impl::getKernelProgramCache
KernelProgramCache & getKernelProgramCache() const
Definition: context_impl.cpp:201
platform_impl.hpp
sycl::_V1::detail::context_impl::addDeviceGlobalInitializer
void addDeviceGlobalInitializer(RT::PiProgram Program, const std::vector< device > &Devs, const RTDeviceBinaryImage *BinImage)
Adds a device global initializer.
Definition: context_impl.cpp:250
sycl::_V1::detail::ProgramManager::getDeviceGlobalEntries
std::vector< DeviceGlobalMapEntry * > getDeviceGlobalEntries(const std::vector< std::string > &UniqueIds, bool ExcludeDeviceImageScopeDecorated=false)
Definition: program_manager.cpp:1618
sycl::_V1::detail::context_impl::getPlugin
const plugin & getPlugin() const
Definition: context_impl.hpp:109
sycl::_V1::detail::DeviceGlobalUSMMem::getZeroInitEvent
OwnedPiEvent getZeroInitEvent(const plugin &Plugin)
Definition: device_global_map_entry.cpp:41
sycl::_V1::detail::readMemoryScopeBitfield
std::vector< memory_scope > readMemoryScopeBitfield(pi_memory_scope_capabilities bits)
Definition: memory_enums.hpp:65
sycl::_V1::detail::pi::PiContext
::pi_context PiContext
Definition: pi.hpp:128
sycl::_V1::detail::pi::PiProgram
::pi_program PiProgram
Definition: pi.hpp:130
sycl::_V1::detail::KernelProgramCache::setContextPtr
void setContextPtr(const ContextPtr &AContext)
Definition: kernel_program_cache.hpp:103
sycl::_V1::detail::DeviceGlobalUSMMem
Definition: device_global_map_entry.hpp:63
common.hpp
sycl::_V1::detail::DeviceGlobalUSMMem::getPtr
void *const & getPtr() const noexcept
Definition: device_global_map_entry.hpp:67
sycl::_V1::device
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition: device.hpp:49
pi_memory_scope_capabilities
pi_bitfield pi_memory_scope_capabilities
Definition: pi.h:557
_pi_device_binary_property_struct
Definition: pi.h:721
_pi_program
Implementation of PI Program on CUDA Module object.
Definition: pi_cuda.hpp:760
sycl::_V1::errc::invalid
@ invalid
pi_native_handle
uintptr_t pi_native_handle
Definition: pi.h:128
piContextRetain
pi_result piContextRetain(pi_context context)
Definition: pi_esimd_emulator.cpp:884
sycl::_V1::property_list::has_property
bool has_property() const noexcept
Definition: property_list.hpp:48
sycl::_V1::detail::context_impl::is_host
bool is_host() const
Checks if this context is a host context.
Definition: context_impl.cpp:120
sycl::_V1::detail::context_impl::findMatchingDeviceImpl
DeviceImplPtr findMatchingDeviceImpl(RT::PiDevice &DevicePI) const
Given a PiDevice, returns the matching shared_ptr<device_impl> within this context.
Definition: context_impl.cpp:214
sycl::_V1::detail::plugin::call_nocheck
RT::PiResult call_nocheck(ArgsT... Args) const
Calls the PiApi, traces the call, and returns the result.
Definition: plugin.hpp:170
sycl::_V1::backend::opencl
@ opencl
platform.hpp
piContextCreate
pi_result piContextCreate(const pi_context_properties *properties, pi_uint32 num_devices, const pi_device *devices, void(*pfn_notify)(const char *errinfo, const void *private_info, size_t cb, void *user_data), void *user_data, pi_context *ret_context)
exception.hpp
sycl::_V1::detail::plugin::call
void call(ArgsT... Args) const
Calls the API, traces the call, checks the result.
Definition: plugin.hpp:217
sycl::_V1::detail::context_impl::get
cl_context get() const
Gets OpenCL interoperability context handle.
Definition: context_impl.cpp:109
sycl::_V1::detail::ProgramManager::getDeviceGlobalEntry
DeviceGlobalMapEntry * getDeviceGlobalEntry(const void *DeviceGlobalPtr)
Definition: program_manager.cpp:1611
sycl::_V1::detail::context_impl::NotSupported
@ NotSupported
Definition: context_impl.hpp:219
context_info.hpp
piextEnqueueDeviceGlobalVariableWrite
pi_result piextEnqueueDeviceGlobalVariableWrite(pi_queue queue, pi_program program, const char *name, pi_bool blocking_write, size_t count, size_t offset, const void *src, pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, pi_event *event)
Device global variable.
Definition: pi_esimd_emulator.cpp:2033
sycl::_V1::async_handler
std::function< void(sycl::exception_list)> async_handler
Definition: exception_list.hpp:54
sycl::_V1::detail::OwnedPiEvent
Definition: device_global_map_entry.hpp:32
exception_list.hpp
info_desc.hpp
sycl::_V1::platform
Encapsulates a SYCL platform on which kernels may be executed.
Definition: platform.hpp:45
sycl::_V1::detail::context_impl::~context_impl
~context_impl()
Definition: context_impl.cpp:122
piextContextGetNativeHandle
pi_result piextContextGetNativeHandle(pi_context context, pi_native_handle *nativeHandle)
Gets the native handle of a PI context object.
Definition: pi_esimd_emulator.cpp:874
sycl::_V1::detail::KernelProgramCache::waitUntilBuilt
void waitUntilBuilt(BuildResult< T > &BR, Predicate Pred) const
Definition: kernel_program_cache.hpp:142
sycl::_V1::detail::KernelProgramCache
Definition: kernel_program_cache.hpp:31
pi_memory_order_capabilities
pi_bitfield pi_memory_order_capabilities
Definition: pi.h:550
sycl::_V1::detail::RTDeviceBinaryImage
Definition: device_binary_image.hpp:82
sycl::_V1::detail::pi::PiEvent
::pi_event PiEvent
Definition: pi.hpp:136
__SYCL_PI_CONTEXT_PROPERTIES_CUDA_PRIMARY
#define __SYCL_PI_CONTEXT_PROPERTIES_CUDA_PRIMARY
Definition: cuda_definitions.hpp:19
sycl::_V1::detail::getSyclObjImpl
decltype(Obj::impl) getSyclObjImpl(const Obj &SyclObject)
Definition: common.hpp:300
sycl::_V1::detail::context_impl::NotChecked
@ NotChecked
Definition: context_impl.hpp:219