@@ -151,8 +151,7 @@ queue_impl::getExtendDependencyList(const std::vector<event> &DepEvents,
151
151
return MutableVec;
152
152
}
153
153
154
- event queue_impl::memset (const std::shared_ptr<detail::queue_impl> &Self,
155
- void *Ptr, int Value, size_t Count,
154
+ event queue_impl::memset (void *Ptr, int Value, size_t Count,
156
155
const std::vector<event> &DepEvents,
157
156
bool CallerNeedsEvent) {
158
157
#if XPTI_ENABLE_INSTRUMENTATION
@@ -180,7 +179,7 @@ event queue_impl::memset(const std::shared_ptr<detail::queue_impl> &Self,
180
179
#endif
181
180
const std::vector<unsigned char > Pattern{static_cast <unsigned char >(Value)};
182
181
return submitMemOpHelper (
183
- Self, DepEvents, CallerNeedsEvent,
182
+ DepEvents, CallerNeedsEvent,
184
183
[&](handler &CGH) { CGH.memset (Ptr, Value, Count); },
185
184
MemoryManager::fill_usm, Ptr, *this , Count, Pattern);
186
185
}
@@ -198,8 +197,7 @@ void report(const code_location &CodeLoc) {
198
197
std::cout << ' \n ' ;
199
198
}
200
199
201
- event queue_impl::memcpy (const std::shared_ptr<detail::queue_impl> &Self,
202
- void *Dest, const void *Src, size_t Count,
200
+ event queue_impl::memcpy (void *Dest, const void *Src, size_t Count,
203
201
const std::vector<event> &DepEvents,
204
202
bool CallerNeedsEvent, const code_location &CodeLoc) {
205
203
#if XPTI_ENABLE_INSTRUMENTATION
@@ -231,28 +229,28 @@ event queue_impl::memcpy(const std::shared_ptr<detail::queue_impl> &Self,
231
229
" NULL pointer argument in memory copy operation." );
232
230
}
233
231
return submitMemOpHelper (
234
- Self, DepEvents, CallerNeedsEvent,
232
+ DepEvents, CallerNeedsEvent,
235
233
[&](handler &CGH) { CGH.memcpy (Dest, Src, Count); },
236
234
MemoryManager::copy_usm, Src, *this , Count, Dest);
237
235
}
238
236
239
- event queue_impl::mem_advise (const std::shared_ptr<detail::queue_impl> &Self,
240
- const void *Ptr, size_t Length,
237
+ event queue_impl::mem_advise (const void *Ptr, size_t Length,
241
238
ur_usm_advice_flags_t Advice,
242
239
const std::vector<event> &DepEvents,
243
240
bool CallerNeedsEvent) {
244
241
return submitMemOpHelper (
245
- Self, DepEvents, CallerNeedsEvent,
242
+ DepEvents, CallerNeedsEvent,
246
243
[&](handler &CGH) { CGH.mem_advise (Ptr, Length, Advice); },
247
244
MemoryManager::advise_usm, Ptr, *this , Length, Advice);
248
245
}
249
246
250
- event queue_impl::memcpyToDeviceGlobal (
251
- const std::shared_ptr<detail::queue_impl> &Self, void *DeviceGlobalPtr,
252
- const void *Src, bool IsDeviceImageScope, size_t NumBytes, size_t Offset,
253
- const std::vector<event> &DepEvents, bool CallerNeedsEvent) {
247
+ event queue_impl::memcpyToDeviceGlobal (void *DeviceGlobalPtr, const void *Src,
248
+ bool IsDeviceImageScope, size_t NumBytes,
249
+ size_t Offset,
250
+ const std::vector<event> &DepEvents,
251
+ bool CallerNeedsEvent) {
254
252
return submitMemOpHelper (
255
- Self, DepEvents, CallerNeedsEvent,
253
+ DepEvents, CallerNeedsEvent,
256
254
[&](handler &CGH) {
257
255
CGH.memcpyToDeviceGlobal (DeviceGlobalPtr, Src, IsDeviceImageScope,
258
256
NumBytes, Offset);
@@ -261,12 +259,14 @@ event queue_impl::memcpyToDeviceGlobal(
261
259
*this , NumBytes, Offset, Src);
262
260
}
263
261
264
- event queue_impl::memcpyFromDeviceGlobal (
265
- const std::shared_ptr<detail::queue_impl> &Self, void *Dest,
266
- const void *DeviceGlobalPtr, bool IsDeviceImageScope, size_t NumBytes,
267
- size_t Offset, const std::vector<event> &DepEvents, bool CallerNeedsEvent) {
262
+ event queue_impl::memcpyFromDeviceGlobal (void *Dest,
263
+ const void *DeviceGlobalPtr,
264
+ bool IsDeviceImageScope,
265
+ size_t NumBytes, size_t Offset,
266
+ const std::vector<event> &DepEvents,
267
+ bool CallerNeedsEvent) {
268
268
return submitMemOpHelper (
269
- Self, DepEvents, CallerNeedsEvent,
269
+ DepEvents, CallerNeedsEvent,
270
270
[&](handler &CGH) {
271
271
CGH.memcpyFromDeviceGlobal (Dest, DeviceGlobalPtr, IsDeviceImageScope,
272
272
NumBytes, Offset);
@@ -275,8 +275,7 @@ event queue_impl::memcpyFromDeviceGlobal(
275
275
IsDeviceImageScope, *this , NumBytes, Offset, Dest);
276
276
}
277
277
278
- sycl::detail::optional<event>
279
- queue_impl::getLastEvent (const std::shared_ptr<queue_impl> &Self) {
278
+ sycl::detail::optional<event> queue_impl::getLastEvent () {
280
279
// The external event is required to finish last if set, so it is considered
281
280
// the last event if present.
282
281
if (std::optional<event> ExternalEvent = MInOrderExternalEvent.read ())
@@ -291,7 +290,7 @@ queue_impl::getLastEvent(const std::shared_ptr<queue_impl> &Self) {
291
290
if (LastEvent)
292
291
return detail::createSyclObjFromImpl<event>(LastEvent);
293
292
// We insert a marker to represent an event at end.
294
- return detail::createSyclObjFromImpl<event>(insertMarkerEvent (Self ));
293
+ return detail::createSyclObjFromImpl<event>(insertMarkerEvent ());
295
294
}
296
295
297
296
void queue_impl::addEvent (const detail::EventImplPtr &EventImpl) {
@@ -307,16 +306,15 @@ void queue_impl::addEvent(const detail::EventImplPtr &EventImpl) {
307
306
308
307
detail::EventImplPtr
309
308
queue_impl::submit_impl (const detail::type_erased_cgfo_ty &CGF,
310
- const std::shared_ptr<queue_impl> &Self,
311
309
queue_impl *SecondaryQueue, bool CallerNeedsEvent,
312
310
const detail::code_location &Loc, bool IsTopCodeLoc,
313
311
const v1::SubmissionInfo &SubmitInfo) {
314
312
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
315
313
detail::handler_impl HandlerImplVal (SecondaryQueue, CallerNeedsEvent);
316
314
detail::handler_impl *HandlerImpl = &HandlerImplVal;
317
- handler Handler (HandlerImpl, Self );
315
+ handler Handler (HandlerImpl, shared_from_this () );
318
316
#else
319
- handler Handler (Self , SecondaryQueue, CallerNeedsEvent);
317
+ handler Handler (shared_from_this () , SecondaryQueue, CallerNeedsEvent);
320
318
auto &HandlerImpl = detail::getSyclObjImpl (Handler);
321
319
#endif
322
320
@@ -398,9 +396,8 @@ queue_impl::submit_impl(const detail::type_erased_cgfo_ty &CGF,
398
396
Stream->generateFlushCommand (ServiceCGH);
399
397
};
400
398
detail::type_erased_cgfo_ty CGF{L};
401
- detail::EventImplPtr FlushEvent =
402
- submit_impl (CGF, Self, SecondaryQueue, /* CallerNeedsEvent*/ true , Loc,
403
- IsTopCodeLoc, {});
399
+ detail::EventImplPtr FlushEvent = submit_impl (
400
+ CGF, SecondaryQueue, /* CallerNeedsEvent*/ true , Loc, IsTopCodeLoc, {});
404
401
if (EventImpl)
405
402
EventImpl->attachEventToCompleteWeak (FlushEvent);
406
403
registerStreamServiceEvent (FlushEvent);
@@ -412,19 +409,17 @@ queue_impl::submit_impl(const detail::type_erased_cgfo_ty &CGF,
412
409
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
413
410
detail::EventImplPtr
414
411
queue_impl::submit_impl (const detail::type_erased_cgfo_ty &CGF,
415
- const std::shared_ptr<queue_impl> &Self,
416
- const std::shared_ptr<queue_impl> &,
412
+ const std::shared_ptr<queue_impl> & /* PrimaryQueue*/ ,
417
413
const std::shared_ptr<queue_impl> &SecondaryQueue,
418
414
bool CallerNeedsEvent, const detail::code_location &Loc,
419
415
bool IsTopCodeLoc, const SubmissionInfo &SubmitInfo) {
420
- return submit_impl (CGF, Self, SecondaryQueue.get (), CallerNeedsEvent, Loc,
416
+ return submit_impl (CGF, SecondaryQueue.get (), CallerNeedsEvent, Loc,
421
417
IsTopCodeLoc, SubmitInfo);
422
418
}
423
419
#endif
424
420
425
421
template <typename HandlerFuncT>
426
- event queue_impl::submitWithHandler (const std::shared_ptr<queue_impl> &Self,
427
- const std::vector<event> &DepEvents,
422
+ event queue_impl::submitWithHandler (const std::vector<event> &DepEvents,
428
423
bool CallerNeedsEvent,
429
424
HandlerFuncT HandlerFunc) {
430
425
v1::SubmissionInfo SI{};
@@ -435,17 +430,16 @@ event queue_impl::submitWithHandler(const std::shared_ptr<queue_impl> &Self,
435
430
detail::type_erased_cgfo_ty CGF{L};
436
431
437
432
if (!CallerNeedsEvent && supportsDiscardingPiEvents ()) {
438
- submit_without_event (CGF, Self, SI,
433
+ submit_without_event (CGF, SI,
439
434
/* CodeLoc*/ {}, /* IsTopCodeLoc*/ true );
440
435
return createDiscardedEvent ();
441
436
}
442
- return submit_with_event (CGF, Self, SI,
437
+ return submit_with_event (CGF, SI,
443
438
/* CodeLoc*/ {}, /* IsTopCodeLoc*/ true );
444
439
}
445
440
446
441
template <typename HandlerFuncT, typename MemOpFuncT, typename ... MemOpArgTs>
447
- event queue_impl::submitMemOpHelper (const std::shared_ptr<queue_impl> &Self,
448
- const std::vector<event> &DepEvents,
442
+ event queue_impl::submitMemOpHelper (const std::vector<event> &DepEvents,
449
443
bool CallerNeedsEvent,
450
444
HandlerFuncT HandlerFunc,
451
445
MemOpFuncT MemOpFunc,
@@ -475,7 +469,7 @@ event queue_impl::submitMemOpHelper(const std::shared_ptr<queue_impl> &Self,
475
469
return createDiscardedEvent ();
476
470
}
477
471
478
- event ResEvent = prepareSYCLEventAssociatedWithQueue (Self );
472
+ event ResEvent = prepareSYCLEventAssociatedWithQueue (shared_from_this () );
479
473
const auto &EventImpl = detail::getSyclObjImpl (ResEvent);
480
474
{
481
475
NestedCallsTracker tracker;
@@ -509,7 +503,7 @@ event queue_impl::submitMemOpHelper(const std::shared_ptr<queue_impl> &Self,
509
503
return ResEvent;
510
504
}
511
505
}
512
- return submitWithHandler (Self, DepEvents, CallerNeedsEvent, HandlerFunc);
506
+ return submitWithHandler (DepEvents, CallerNeedsEvent, HandlerFunc);
513
507
}
514
508
515
509
void *queue_impl::instrumentationProlog (const detail::code_location &CodeLoc,
0 commit comments