@@ -45,7 +45,7 @@ context_impl::context_impl(const std::vector<sycl::device> Devices,
45
45
MPlatform(), MPropList(PropList), MHostContext(false ),
46
46
MSupportBufferLocationByDevices(NotChecked) {
47
47
MPlatform = detail::getSyclObjImpl (MDevices[0 ].get_platform ());
48
- std::vector<RT ::PiDevice> DeviceIds;
48
+ std::vector<sycl::detail::pi ::PiDevice> DeviceIds;
49
49
for (const auto &D : MDevices) {
50
50
DeviceIds.push_back (getSyclObjImpl (D)->getHandleRef ());
51
51
}
@@ -69,27 +69,27 @@ context_impl::context_impl(const std::vector<sycl::device> Devices,
69
69
MKernelProgramCache.setContextPtr (this );
70
70
}
71
71
72
- context_impl::context_impl (RT:: PiContext PiContext, async_handler AsyncHandler ,
73
- const PluginPtr &Plugin)
72
+ context_impl::context_impl (sycl::detail::pi:: PiContext PiContext,
73
+ async_handler AsyncHandler, const PluginPtr &Plugin)
74
74
: MAsyncHandler(AsyncHandler), MDevices(), MContext(PiContext), MPlatform(),
75
75
MHostContext(false ), MSupportBufferLocationByDevices(NotChecked) {
76
76
77
- std::vector<RT ::PiDevice> DeviceIds;
77
+ std::vector<sycl::detail::pi ::PiDevice> DeviceIds;
78
78
size_t DevicesNum = 0 ;
79
79
// TODO catch an exception and put it to list of asynchronous exceptions
80
80
Plugin->call <PiApiKind::piContextGetInfo>(
81
81
MContext, PI_CONTEXT_INFO_NUM_DEVICES, sizeof (DevicesNum), &DevicesNum,
82
82
nullptr );
83
83
DeviceIds.resize (DevicesNum);
84
84
// TODO catch an exception and put it to list of asynchronous exceptions
85
- Plugin->call <PiApiKind::piContextGetInfo>(MContext, PI_CONTEXT_INFO_DEVICES,
86
- sizeof (RT::PiDevice) * DevicesNum ,
87
- &DeviceIds[0 ], nullptr );
85
+ Plugin->call <PiApiKind::piContextGetInfo>(
86
+ MContext, PI_CONTEXT_INFO_DEVICES ,
87
+ sizeof (sycl::detail::pi::PiDevice) * DevicesNum, &DeviceIds[0 ], nullptr );
88
88
89
89
if (!DeviceIds.empty ()) {
90
90
std::shared_ptr<detail::platform_impl> Platform =
91
91
platform_impl::getPlatformFromPiDevice (DeviceIds[0 ], Plugin);
92
- for (RT ::PiDevice Dev : DeviceIds) {
92
+ for (sycl::detail::pi ::PiDevice Dev : DeviceIds) {
93
93
MDevices.emplace_back (createSyclObjFromImpl<device>(
94
94
Platform->getOrMakeDeviceImpl (Dev, Platform)));
95
95
}
@@ -230,8 +230,10 @@ context_impl::get_info<info::context::atomic_fence_scope_capabilities>() const {
230
230
return CapabilityList;
231
231
}
232
232
233
- RT::PiContext &context_impl::getHandleRef () { return MContext; }
234
- const RT::PiContext &context_impl::getHandleRef () const { return MContext; }
233
+ sycl::detail::pi::PiContext &context_impl::getHandleRef () { return MContext; }
234
+ const sycl::detail::pi::PiContext &context_impl::getHandleRef () const {
235
+ return MContext;
236
+ }
235
237
236
238
KernelProgramCache &context_impl::getKernelProgramCache () const {
237
239
return MKernelProgramCache;
@@ -245,8 +247,8 @@ bool context_impl::hasDevice(
245
247
return false ;
246
248
}
247
249
248
- DeviceImplPtr
249
- context_impl::findMatchingDeviceImpl (RT ::PiDevice &DevicePI) const {
250
+ DeviceImplPtr context_impl::findMatchingDeviceImpl (
251
+ sycl::detail::pi ::PiDevice &DevicePI) const {
250
252
for (device D : MDevices)
251
253
if (getSyclObjImpl (D)->getHandleRef () == DevicePI)
252
254
return getSyclObjImpl (D);
@@ -283,7 +285,7 @@ void context_impl::addAssociatedDeviceGlobal(const void *DeviceGlobalPtr) {
283
285
}
284
286
285
287
void context_impl::addDeviceGlobalInitializer (
286
- RT ::PiProgram Program, const std::vector<device> &Devs,
288
+ sycl::detail::pi ::PiProgram Program, const std::vector<device> &Devs,
287
289
const RTDeviceBinaryImage *BinImage) {
288
290
std::lock_guard<std::mutex> Lock (MDeviceGlobalInitializersMutex);
289
291
for (const device &Dev : Devs) {
@@ -292,7 +294,7 @@ void context_impl::addDeviceGlobalInitializer(
292
294
}
293
295
}
294
296
295
- std::vector<RT ::PiEvent> context_impl::initializeDeviceGlobals (
297
+ std::vector<sycl::detail::pi ::PiEvent> context_impl::initializeDeviceGlobals (
296
298
pi::PiProgram NativePrg, const std::shared_ptr<queue_impl> &QueueImpl) {
297
299
const PluginPtr &Plugin = getPlugin ();
298
300
const DeviceImplPtr &DeviceImpl = QueueImpl->getDeviceImplPtr ();
@@ -306,12 +308,13 @@ std::vector<RT::PiEvent> context_impl::initializeDeviceGlobals(
306
308
DeviceGlobalInitializer &InitRef = ImgIt->second ;
307
309
{
308
310
std::lock_guard<std::mutex> InitLock (InitRef.MDeviceGlobalInitMutex );
309
- std::vector<RT::PiEvent> &InitEventsRef = InitRef.MDeviceGlobalInitEvents ;
311
+ std::vector<sycl::detail::pi::PiEvent> &InitEventsRef =
312
+ InitRef.MDeviceGlobalInitEvents ;
310
313
if (!InitEventsRef.empty ()) {
311
314
// Initialization has begun but we do not know if the events are done.
312
315
auto NewEnd = std::remove_if (
313
316
InitEventsRef.begin (), InitEventsRef.end (),
314
- [&Plugin](const RT ::PiEvent &Event) {
317
+ [&Plugin](const sycl::detail::pi ::PiEvent &Event) {
315
318
return get_event_info<info::event::command_execution_status>(
316
319
Event, Plugin) == info::event_command_status::complete;
317
320
});
@@ -373,7 +376,7 @@ std::vector<RT::PiEvent> context_impl::initializeDeviceGlobals(
373
376
374
377
// Write the pointer to the device global and store the event in the
375
378
// initialize events list.
376
- RT ::PiEvent InitEvent;
379
+ sycl::detail::pi ::PiEvent InitEvent;
377
380
void *const &USMPtr = DeviceGlobalUSM.getPtr ();
378
381
Plugin->call <PiApiKind::piextEnqueueDeviceGlobalVariableWrite>(
379
382
QueueImpl->getHandleRef (), NativePrg,
@@ -389,7 +392,7 @@ std::vector<RT::PiEvent> context_impl::initializeDeviceGlobals(
389
392
390
393
void context_impl::DeviceGlobalInitializer::ClearEvents (
391
394
const PluginPtr &Plugin) {
392
- for (const RT ::PiEvent &Event : MDeviceGlobalInitEvents)
395
+ for (const sycl::detail::pi ::PiEvent &Event : MDeviceGlobalInitEvents)
393
396
Plugin->call <PiApiKind::piEventRelease>(Event);
394
397
MDeviceGlobalInitEvents.clear ();
395
398
}
@@ -398,7 +401,7 @@ void context_impl::memcpyToHostOnlyDeviceGlobal(
398
401
const std::shared_ptr<device_impl> &DeviceImpl, const void *DeviceGlobalPtr,
399
402
const void *Src, size_t DeviceGlobalTSize, bool IsDeviceImageScoped,
400
403
size_t NumBytes, size_t Offset) {
401
- std::optional<RT ::PiDevice> KeyDevice = std::nullopt;
404
+ std::optional<sycl::detail::pi ::PiDevice> KeyDevice = std::nullopt;
402
405
if (IsDeviceImageScoped)
403
406
KeyDevice = DeviceImpl->getHandleRef ();
404
407
auto Key = std::make_pair (DeviceGlobalPtr, KeyDevice);
@@ -421,7 +424,7 @@ void context_impl::memcpyFromHostOnlyDeviceGlobal(
421
424
const void *DeviceGlobalPtr, bool IsDeviceImageScoped, size_t NumBytes,
422
425
size_t Offset) {
423
426
424
- std::optional<RT ::PiDevice> KeyDevice = std::nullopt;
427
+ std::optional<sycl::detail::pi ::PiDevice> KeyDevice = std::nullopt;
425
428
if (IsDeviceImageScoped)
426
429
KeyDevice = DeviceImpl->getHandleRef ();
427
430
auto Key = std::make_pair (DeviceGlobalPtr, KeyDevice);
@@ -440,7 +443,7 @@ void context_impl::memcpyFromHostOnlyDeviceGlobal(
440
443
std::memcpy (Dest, ValuePtr + Offset, NumBytes);
441
444
}
442
445
443
- std::optional<RT ::PiProgram> context_impl::getProgramForDevImgs (
446
+ std::optional<sycl::detail::pi ::PiProgram> context_impl::getProgramForDevImgs (
444
447
const device &Device, const std::set<std::uintptr_t > &ImgIdentifiers,
445
448
const std::string &ObjectTypeName) {
446
449
@@ -449,7 +452,8 @@ std::optional<RT::PiProgram> context_impl::getProgramForDevImgs(
449
452
auto LockedCache = MKernelProgramCache.acquireCachedPrograms ();
450
453
auto &KeyMap = LockedCache.get ().KeyMap ;
451
454
auto &Cache = LockedCache.get ().Cache ;
452
- RT::PiDevice &DevHandle = getSyclObjImpl (Device)->getHandleRef ();
455
+ sycl::detail::pi::PiDevice &DevHandle =
456
+ getSyclObjImpl (Device)->getHandleRef ();
453
457
for (std::uintptr_t ImageIDs : ImgIdentifiers) {
454
458
auto OuterKey = std::make_pair (ImageIDs, DevHandle);
455
459
size_t NProgs = KeyMap.count (OuterKey);
@@ -475,13 +479,14 @@ std::optional<RT::PiProgram> context_impl::getProgramForDevImgs(
475
479
return *MKernelProgramCache.waitUntilBuilt <compile_program_error>(BuildRes);
476
480
}
477
481
478
- std::optional<RT::PiProgram> context_impl::getProgramForDeviceGlobal (
482
+ std::optional<sycl::detail::pi::PiProgram>
483
+ context_impl::getProgramForDeviceGlobal (
479
484
const device &Device, DeviceGlobalMapEntry *DeviceGlobalEntry) {
480
485
return getProgramForDevImgs (Device, DeviceGlobalEntry->MImageIdentifiers ,
481
486
" device_global" );
482
487
}
483
488
// / Gets a program associated with a HostPipe Entry from the cache.
484
- std::optional<RT ::PiProgram>
489
+ std::optional<sycl::detail::pi ::PiProgram>
485
490
context_impl::getProgramForHostPipe (const device &Device,
486
491
HostPipeMapEntry *HostPipeEntry) {
487
492
// One HostPipe entry belongs to one Img
0 commit comments