@@ -368,11 +368,21 @@ class CG {
368
368
vector_class<detail::AccessorImplPtr> AccStorage,
369
369
vector_class<shared_ptr_class<const void >> SharedPtrStorage,
370
370
vector_class<Requirement *> Requirements,
371
- vector_class<detail::EventImplPtr> Events)
371
+ vector_class<detail::EventImplPtr> Events, detail::code_location loc = {} )
372
372
: MType(Type), MArgsStorage(std::move(ArgsStorage)),
373
373
MAccStorage (std::move(AccStorage)),
374
374
MSharedPtrStorage(std::move(SharedPtrStorage)),
375
- MRequirements(std::move(Requirements)), MEvents(std::move(Events)) {}
375
+ MRequirements(std::move(Requirements)), MEvents(std::move(Events)) {
376
+ // Capture the user code-location from Q.submit(), Q.parallel_for()
377
+ // etc for later use; if code location information is not available,
378
+ // the file name and function name members will be empty strings
379
+ if (loc.functionName ())
380
+ MFunctionName = loc.functionName ();
381
+ if (loc.fileName ())
382
+ MFileName = loc.fileName ();
383
+ MLine = loc.lineNumber ();
384
+ MColumn = loc.columnNumber ();
385
+ }
376
386
377
387
CG (CG &&CommandGroup) = default;
378
388
@@ -397,6 +407,12 @@ class CG {
397
407
vector_class<Requirement *> MRequirements;
398
408
// List of events that order the execution of this CG
399
409
vector_class<detail::EventImplPtr> MEvents;
410
+ // Member variables to capture the user code-location
411
+ // information from Q.submit(), Q.parallel_for() etc
412
+ // Storage for function name and source file name
413
+ string_class MFunctionName, MFileName;
414
+ // Storage for line and column of code location
415
+ int32_t MLine, MColumn;
400
416
};
401
417
402
418
// The class which represents "execute kernel" command group.
@@ -420,10 +436,10 @@ class CGExecKernel : public CG {
420
436
vector_class<ArgDesc> Args, string_class KernelName,
421
437
detail::OSModuleHandle OSModuleHandle,
422
438
vector_class<shared_ptr_class<detail::stream_impl>> Streams,
423
- CGTYPE Type)
439
+ CGTYPE Type, detail::code_location loc = {} )
424
440
: CG(Type, std::move(ArgsStorage), std::move(AccStorage),
425
441
std::move (SharedPtrStorage), std::move(Requirements),
426
- std::move(Events)),
442
+ std::move(Events), std::move(loc) ),
427
443
MNDRDesc(std::move(NDRDesc)), MHostKernel(std::move(HKernel)),
428
444
MSyclKernel(std::move(SyclKernel)), MArgs(std::move(Args)),
429
445
MKernelName(std::move(KernelName)), MOSModuleHandle(OSModuleHandle),
@@ -450,10 +466,11 @@ class CGCopy : public CG {
450
466
vector_class<detail::AccessorImplPtr> AccStorage,
451
467
vector_class<shared_ptr_class<const void >> SharedPtrStorage,
452
468
vector_class<Requirement *> Requirements,
453
- vector_class<detail::EventImplPtr> Events)
469
+ vector_class<detail::EventImplPtr> Events,
470
+ detail::code_location loc = {})
454
471
: CG(CopyType, std::move(ArgsStorage), std::move(AccStorage),
455
472
std::move (SharedPtrStorage), std::move(Requirements),
456
- std::move(Events)),
473
+ std::move(Events), std::move(loc) ),
457
474
MSrc(Src), MDst(Dst) {}
458
475
void *getSrc () { return MSrc; }
459
476
void *getDst () { return MDst; }
@@ -470,10 +487,11 @@ class CGFill : public CG {
470
487
vector_class<detail::AccessorImplPtr> AccStorage,
471
488
vector_class<shared_ptr_class<const void >> SharedPtrStorage,
472
489
vector_class<Requirement *> Requirements,
473
- vector_class<detail::EventImplPtr> Events)
490
+ vector_class<detail::EventImplPtr> Events,
491
+ detail::code_location loc = {})
474
492
: CG(FILL, std::move(ArgsStorage), std::move(AccStorage),
475
493
std::move (SharedPtrStorage), std::move(Requirements),
476
- std::move(Events)),
494
+ std::move(Events), std::move(loc) ),
477
495
MPattern(std::move(Pattern)), MPtr((Requirement *)Ptr) {}
478
496
Requirement *getReqToFill () { return MPtr; }
479
497
};
@@ -487,10 +505,11 @@ class CGUpdateHost : public CG {
487
505
vector_class<detail::AccessorImplPtr> AccStorage,
488
506
vector_class<shared_ptr_class<const void >> SharedPtrStorage,
489
507
vector_class<Requirement *> Requirements,
490
- vector_class<detail::EventImplPtr> Events)
508
+ vector_class<detail::EventImplPtr> Events,
509
+ detail::code_location loc = {})
491
510
: CG(UPDATE_HOST, std::move(ArgsStorage), std::move(AccStorage),
492
511
std::move (SharedPtrStorage), std::move(Requirements),
493
- std::move(Events)),
512
+ std::move(Events), std::move(loc) ),
494
513
MPtr((Requirement *)Ptr) {}
495
514
496
515
Requirement *getReqToUpdate () { return MPtr; }
@@ -508,10 +527,11 @@ class CGCopyUSM : public CG {
508
527
vector_class<detail::AccessorImplPtr> AccStorage,
509
528
vector_class<shared_ptr_class<const void >> SharedPtrStorage,
510
529
vector_class<Requirement *> Requirements,
511
- vector_class<detail::EventImplPtr> Events)
530
+ vector_class<detail::EventImplPtr> Events,
531
+ detail::code_location loc = {})
512
532
: CG(COPY_USM, std::move(ArgsStorage), std::move(AccStorage),
513
533
std::move (SharedPtrStorage), std::move(Requirements),
514
- std::move(Events)),
534
+ std::move(Events), std::move(loc) ),
515
535
MSrc(Src), MDst(Dst), MLength(Length) {}
516
536
517
537
void *getSrc () { return MSrc; }
@@ -531,10 +551,11 @@ class CGFillUSM : public CG {
531
551
vector_class<detail::AccessorImplPtr> AccStorage,
532
552
vector_class<shared_ptr_class<const void >> SharedPtrStorage,
533
553
vector_class<Requirement *> Requirements,
534
- vector_class<detail::EventImplPtr> Events)
554
+ vector_class<detail::EventImplPtr> Events,
555
+ detail::code_location loc = {})
535
556
: CG(FILL_USM, std::move(ArgsStorage), std::move(AccStorage),
536
557
std::move (SharedPtrStorage), std::move(Requirements),
537
- std::move(Events)),
558
+ std::move(Events), std::move(loc) ),
538
559
MPattern(std::move(Pattern)), MDst(DstPtr), MLength(Length) {}
539
560
void *getDst () { return MDst; }
540
561
size_t getLength () { return MLength; }
@@ -552,10 +573,11 @@ class CGPrefetchUSM : public CG {
552
573
vector_class<detail::AccessorImplPtr> AccStorage,
553
574
vector_class<shared_ptr_class<const void >> SharedPtrStorage,
554
575
vector_class<Requirement *> Requirements,
555
- vector_class<detail::EventImplPtr> Events)
576
+ vector_class<detail::EventImplPtr> Events,
577
+ detail::code_location loc = {})
556
578
: CG(PREFETCH_USM, std::move(ArgsStorage), std::move(AccStorage),
557
579
std::move (SharedPtrStorage), std::move(Requirements),
558
- std::move(Events)),
580
+ std::move(Events), std::move(loc) ),
559
581
MDst(DstPtr), MLength(Length) {}
560
582
void *getDst () { return MDst; }
561
583
size_t getLength () { return MLength; }
@@ -570,10 +592,11 @@ class CGInteropTask : public CG {
570
592
std::vector<detail::AccessorImplPtr> AccStorage,
571
593
std::vector<std::shared_ptr<const void >> SharedPtrStorage,
572
594
std::vector<Requirement *> Requirements,
573
- std::vector<detail::EventImplPtr> Events, CGTYPE Type)
595
+ std::vector<detail::EventImplPtr> Events, CGTYPE Type,
596
+ detail::code_location loc = {})
574
597
: CG(Type, std::move(ArgsStorage), std::move(AccStorage),
575
598
std::move (SharedPtrStorage), std::move(Requirements),
576
- std::move(Events)),
599
+ std::move(Events), std::move(loc) ),
577
600
MInteropTask(std::move(InteropTask)) {}
578
601
};
579
602
0 commit comments