@@ -480,11 +480,15 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
480
480
// / trivially copyable.
481
481
// / \param Count is the number of times to fill Pattern into Ptr.
482
482
// / \return an event representing fill operation.
483
- template <typename T> event fill (void *Ptr, const T &Pattern, size_t Count) {
484
- // TODO: to add code location as parameter when ABI break is permitted
485
- const detail::code_location CodeLoc (" sycl/queue.hpp" , " fill" , 0 , 0 );
486
- return submit ([&](handler &CGH) { CGH.fill <T>(Ptr, Pattern, Count); },
487
- CodeLoc);
483
+ template <typename T>
484
+ event fill (void *Ptr, const T &Pattern,
485
+ size_t Count _CODELOCPARAM (&CodeLoc)) {
486
+ _CODELOCARG (&CodeLoc);
487
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
488
+
489
+ return submit ([&](handler &CGH) {
490
+ CGH.fill <T>(Ptr, Pattern, Count);
491
+ } _CODELOCFW (CodeLoc));
488
492
}
489
493
490
494
// / Fills the specified memory with the specified pattern.
@@ -496,11 +500,14 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
496
500
// / \param DepEvent is an event that specifies the kernel dependencies.
497
501
// / \return an event representing fill operation.
498
502
template <typename T>
499
- event fill (void *Ptr, const T &Pattern, size_t Count, event DepEvent) {
503
+ event fill (void *Ptr, const T &Pattern, size_t Count,
504
+ event DepEvent _CODELOCPARAM (&CodeLoc)) {
505
+ _CODELOCARG (&CodeLoc);
506
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
500
507
return submit ([&](handler &CGH) {
501
508
CGH.depends_on (DepEvent);
502
509
CGH.fill <T>(Ptr, Pattern, Count);
503
- });
510
+ } _CODELOCFW (CodeLoc) );
504
511
}
505
512
506
513
// / Fills the specified memory with the specified pattern.
@@ -514,11 +521,13 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
514
521
// / \return an event representing fill operation.
515
522
template <typename T>
516
523
event fill (void *Ptr, const T &Pattern, size_t Count,
517
- const std::vector<event> &DepEvents) {
524
+ const std::vector<event> &DepEvents _CODELOCPARAM (&CodeLoc)) {
525
+ _CODELOCARG (&CodeLoc);
526
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
518
527
return submit ([&](handler &CGH) {
519
528
CGH.depends_on (DepEvents);
520
529
CGH.fill <T>(Ptr, Pattern, Count);
521
- });
530
+ } _CODELOCFW (CodeLoc) );
522
531
}
523
532
524
533
// / Fills the memory pointed by a USM pointer with the value specified.
@@ -530,7 +539,7 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
530
539
// / \param Value is a value to be set. Value is cast as an unsigned char.
531
540
// / \param Count is a number of bytes to fill.
532
541
// / \return an event representing fill operation.
533
- event memset (void *Ptr, int Value, size_t Count);
542
+ event memset (void *Ptr, int Value, size_t Count _CODELOCPARAM (&CodeLoc) );
534
543
535
544
// / Fills the memory pointed by a USM pointer with the value specified.
536
545
// / No operations is done if \param Count is zero. An exception is thrown
@@ -542,7 +551,8 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
542
551
// / \param Count is a number of bytes to fill.
543
552
// / \param DepEvent is an event that specifies the kernel dependencies.
544
553
// / \return an event representing fill operation.
545
- event memset (void *Ptr, int Value, size_t Count, event DepEvent);
554
+ event memset (void *Ptr, int Value, size_t Count,
555
+ event DepEvent _CODELOCPARAM (&CodeLoc));
546
556
547
557
// / Fills the memory pointed by a USM pointer with the value specified.
548
558
// / No operations is done if \param Count is zero. An exception is thrown
@@ -556,7 +566,7 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
556
566
// / dependencies.
557
567
// / \return an event representing fill operation.
558
568
event memset (void *Ptr, int Value, size_t Count,
559
- const std::vector<event> &DepEvents);
569
+ const std::vector<event> &DepEvents _CODELOCPARAM (&CodeLoc) );
560
570
561
571
// / Copies data from one memory region to another, each is either a host
562
572
// / pointer or a pointer within USM allocation accessible on the device
@@ -569,7 +579,8 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
569
579
// / \param Src is a USM pointer to the source memory.
570
580
// / \param Count is a number of bytes to copy.
571
581
// / \return an event representing copy operation.
572
- event memcpy (void *Dest, const void *Src, size_t Count);
582
+ event memcpy (void *Dest, const void *Src,
583
+ size_t Count _CODELOCPARAM (&CodeLoc));
573
584
574
585
// / Copies data from one memory region to another, each is either a host
575
586
// / pointer or a pointer within USM allocation accessible on the device
@@ -583,7 +594,8 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
583
594
// / \param Count is a number of bytes to copy.
584
595
// / \param DepEvent is an event that specifies the kernel dependencies.
585
596
// / \return an event representing copy operation.
586
- event memcpy (void *Dest, const void *Src, size_t Count, event DepEvent);
597
+ event memcpy (void *Dest, const void *Src, size_t Count,
598
+ event DepEvent _CODELOCPARAM (&CodeLoc));
587
599
588
600
// / Copies data from one memory region to another, each is either a host
589
601
// / pointer or a pointer within USM allocation accessible on the device
@@ -599,7 +611,7 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
599
611
// / dependencies.
600
612
// / \return an event representing copy operation.
601
613
event memcpy (void *Dest, const void *Src, size_t Count,
602
- const std::vector<event> &DepEvents);
614
+ const std::vector<event> &DepEvents _CODELOCPARAM (&CodeLoc) );
603
615
604
616
// / Copies data from one memory region to another, each is either a host
605
617
// / pointer or a pointer within USM allocation accessible on the device
@@ -670,7 +682,8 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
670
682
// / \param Advice is a device-defined advice for the specified allocation.
671
683
// / \return an event representing advice operation.
672
684
__SYCL2020_DEPRECATED (" use the overload with int Advice instead" )
673
- event mem_advise(const void *Ptr, size_t Length, pi_mem_advice Advice);
685
+ event mem_advise(const void *Ptr, size_t Length,
686
+ pi_mem_advice Advice _CODELOCPARAM (&CodeLoc));
674
687
675
688
// / Provides additional information to the underlying runtime about how
676
689
// / different allocations are used.
@@ -679,7 +692,8 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
679
692
// / \param Length is a number of bytes in the allocation.
680
693
// / \param Advice is a device-defined advice for the specified allocation.
681
694
// / \return an event representing advice operation.
682
- event mem_advise (const void *Ptr, size_t Length, int Advice);
695
+ event mem_advise (const void *Ptr, size_t Length,
696
+ int Advice _CODELOCPARAM (&CodeLoc));
683
697
684
698
// / Provides additional information to the underlying runtime about how
685
699
// / different allocations are used.
@@ -689,7 +703,8 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
689
703
// / \param Advice is a device-defined advice for the specified allocation.
690
704
// / \param DepEvent is an event that specifies the kernel dependencies.
691
705
// / \return an event representing advice operation.
692
- event mem_advise (const void *Ptr, size_t Length, int Advice, event DepEvent);
706
+ event mem_advise (const void *Ptr, size_t Length, int Advice,
707
+ event DepEvent _CODELOCPARAM (&CodeLoc));
693
708
694
709
// / Provides additional information to the underlying runtime about how
695
710
// / different allocations are used.
@@ -701,7 +716,7 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
701
716
// / dependencies.
702
717
// / \return an event representing advice operation.
703
718
event mem_advise (const void *Ptr, size_t Length, int Advice,
704
- const std::vector<event> &DepEvents);
719
+ const std::vector<event> &DepEvents _CODELOCPARAM (&CodeLoc) );
705
720
706
721
// / Provides hints to the runtime library that data should be made available
707
722
// / on a device earlier than Unified Shared Memory would normally require it
@@ -710,10 +725,11 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
710
725
// / \param Ptr is a USM pointer to the memory to be prefetched to the device.
711
726
// / \param Count is a number of bytes to be prefetched.
712
727
// / \return an event representing prefetch operation.
713
- event prefetch (const void *Ptr, size_t Count) {
714
- // TODO: to add code location as parameter when ABI break is permitted
715
- const detail::code_location CodeLoc (" sycl/queue.hpp" , " prefetch" , 0 , 0 );
716
- return submit ([=](handler &CGH) { CGH.prefetch (Ptr, Count); }, CodeLoc);
728
+ event prefetch (const void *Ptr, size_t Count _CODELOCPARAM (&CodeLoc)) {
729
+ _CODELOCARG (&CodeLoc);
730
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
731
+ return submit (
732
+ [=](handler &CGH) { CGH.prefetch (Ptr, Count); } _CODELOCFW (CodeLoc));
717
733
}
718
734
719
735
// / Provides hints to the runtime library that data should be made available
@@ -724,11 +740,14 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
724
740
// / \param Count is a number of bytes to be prefetched.
725
741
// / \param DepEvent is an event that specifies the kernel dependencies.
726
742
// / \return an event representing prefetch operation.
727
- event prefetch (const void *Ptr, size_t Count, event DepEvent) {
743
+ event prefetch (const void *Ptr, size_t Count,
744
+ event DepEvent _CODELOCPARAM (&CodeLoc)) {
745
+ _CODELOCARG (&CodeLoc);
746
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
728
747
return submit ([=](handler &CGH) {
729
748
CGH.depends_on (DepEvent);
730
749
CGH.prefetch (Ptr, Count);
731
- });
750
+ } _CODELOCFW (CodeLoc) );
732
751
}
733
752
734
753
// / Provides hints to the runtime library that data should be made available
@@ -741,11 +760,13 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
741
760
// / dependencies.
742
761
// / \return an event representing prefetch operation.
743
762
event prefetch (const void *Ptr, size_t Count,
744
- const std::vector<event> &DepEvents) {
763
+ const std::vector<event> &DepEvents _CODELOCPARAM (&CodeLoc)) {
764
+ _CODELOCARG (&CodeLoc);
765
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
745
766
return submit ([=](handler &CGH) {
746
767
CGH.depends_on (DepEvents);
747
768
CGH.prefetch (Ptr, Count);
748
- });
769
+ } _CODELOCFW (CodeLoc) );
749
770
}
750
771
751
772
// / Copies data from one 2D memory region to another, both pointed by
@@ -1085,7 +1106,9 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
1085
1106
template <typename T, typename PropertyListT>
1086
1107
event memcpy (ext::oneapi::experimental::device_global<T, PropertyListT> &Dest,
1087
1108
const void *Src, size_t NumBytes, size_t Offset,
1088
- const std::vector<event> &DepEvents) {
1109
+ const std::vector<event> &DepEvents _CODELOCPARAM (&CodeLoc)) {
1110
+ _CODELOCARG (&CodeLoc);
1111
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
1089
1112
if (sizeof (T) < Offset + NumBytes)
1090
1113
throw sycl::exception (make_error_code (errc::invalid),
1091
1114
" Copy to device_global is out of bounds." );
@@ -1096,7 +1119,7 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
1096
1119
return submit ([&](handler &CGH) {
1097
1120
CGH.depends_on (DepEvents);
1098
1121
return CGH.memcpy (Dest, Src, NumBytes, Offset);
1099
- });
1122
+ } _CODELOCFW (CodeLoc) );
1100
1123
}
1101
1124
1102
1125
constexpr bool IsDeviceImageScoped = PropertyListT::template has_property<
@@ -1120,7 +1143,9 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
1120
1143
template <typename T, typename PropertyListT>
1121
1144
event memcpy (ext::oneapi::experimental::device_global<T, PropertyListT> &Dest,
1122
1145
const void *Src, size_t NumBytes, size_t Offset,
1123
- event DepEvent) {
1146
+ event DepEvent _CODELOCPARAM (&CodeLoc)) {
1147
+ _CODELOCARG (&CodeLoc);
1148
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
1124
1149
return this ->memcpy (Dest, Src, NumBytes, Offset,
1125
1150
std::vector<event>{DepEvent});
1126
1151
}
@@ -1138,7 +1163,9 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
1138
1163
template <typename T, typename PropertyListT>
1139
1164
event memcpy (ext::oneapi::experimental::device_global<T, PropertyListT> &Dest,
1140
1165
const void *Src, size_t NumBytes = sizeof (T),
1141
- size_t Offset = 0) {
1166
+ size_t Offset = 0 _CODELOCPARAM(&CodeLoc)) {
1167
+ _CODELOCARG (&CodeLoc);
1168
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
1142
1169
return this ->memcpy (Dest, Src, NumBytes, Offset, std::vector<event>{});
1143
1170
}
1144
1171
@@ -1158,7 +1185,10 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
1158
1185
event
1159
1186
memcpy (void *Dest,
1160
1187
const ext::oneapi::experimental::device_global<T, PropertyListT> &Src,
1161
- size_t NumBytes, size_t Offset, const std::vector<event> &DepEvents) {
1188
+ size_t NumBytes, size_t Offset,
1189
+ const std::vector<event> &DepEvents _CODELOCPARAM (&CodeLoc)) {
1190
+ _CODELOCARG (&CodeLoc);
1191
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
1162
1192
if (sizeof (T) < Offset + NumBytes)
1163
1193
throw sycl::exception (make_error_code (errc::invalid),
1164
1194
" Copy from device_global is out of bounds." );
@@ -1194,7 +1224,10 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
1194
1224
event
1195
1225
memcpy (void *Dest,
1196
1226
const ext::oneapi::experimental::device_global<T, PropertyListT> &Src,
1197
- size_t NumBytes, size_t Offset, event DepEvent) {
1227
+ size_t NumBytes, size_t Offset,
1228
+ event DepEvent _CODELOCPARAM (&CodeLoc)) {
1229
+ _CODELOCARG (&CodeLoc);
1230
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
1198
1231
return this ->memcpy (Dest, Src, NumBytes, Offset,
1199
1232
std::vector<event>{DepEvent});
1200
1233
}
@@ -1213,7 +1246,10 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
1213
1246
event
1214
1247
memcpy (void *Dest,
1215
1248
const ext::oneapi::experimental::device_global<T, PropertyListT> &Src,
1216
- size_t NumBytes = sizeof (T), size_t Offset = 0) {
1249
+ size_t NumBytes = sizeof (T),
1250
+ size_t Offset = 0 _CODELOCPARAM(&CodeLoc)) {
1251
+ _CODELOCARG (&CodeLoc);
1252
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
1217
1253
return this ->memcpy (Dest, Src, NumBytes, Offset, std::vector<event>{});
1218
1254
}
1219
1255
@@ -1234,7 +1270,9 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
1234
1270
event copy (const std::remove_all_extents_t <T> *Src,
1235
1271
ext::oneapi::experimental::device_global<T, PropertyListT> &Dest,
1236
1272
size_t Count, size_t StartIndex,
1237
- const std::vector<event> &DepEvents) {
1273
+ const std::vector<event> &DepEvents _CODELOCPARAM (&CodeLoc)) {
1274
+ _CODELOCARG (&CodeLoc);
1275
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
1238
1276
return this ->memcpy (Dest, Src, Count * sizeof (std::remove_all_extents_t <T>),
1239
1277
StartIndex * sizeof (std::remove_all_extents_t <T>),
1240
1278
DepEvents);
@@ -1256,7 +1294,10 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
1256
1294
template <typename T, typename PropertyListT>
1257
1295
event copy (const std::remove_all_extents_t <T> *Src,
1258
1296
ext::oneapi::experimental::device_global<T, PropertyListT> &Dest,
1259
- size_t Count, size_t StartIndex, event DepEvent) {
1297
+ size_t Count, size_t StartIndex,
1298
+ event DepEvent _CODELOCPARAM (&CodeLoc)) {
1299
+ _CODELOCARG (&CodeLoc);
1300
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
1260
1301
return this ->memcpy (Dest, Src, Count * sizeof (std::remove_all_extents_t <T>),
1261
1302
StartIndex * sizeof (std::remove_all_extents_t <T>),
1262
1303
DepEvent);
@@ -1277,7 +1318,9 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
1277
1318
event copy (const std::remove_all_extents_t <T> *Src,
1278
1319
ext::oneapi::experimental::device_global<T, PropertyListT> &Dest,
1279
1320
size_t Count = sizeof (T) / sizeof(std::remove_all_extents_t <T>),
1280
- size_t StartIndex = 0) {
1321
+ size_t StartIndex = 0 _CODELOCPARAM(&CodeLoc)) {
1322
+ _CODELOCARG (&CodeLoc);
1323
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
1281
1324
return this ->memcpy (Dest, Src, Count * sizeof (std::remove_all_extents_t <T>),
1282
1325
StartIndex * sizeof (std::remove_all_extents_t <T>));
1283
1326
}
@@ -1299,7 +1342,9 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
1299
1342
event
1300
1343
copy (const ext::oneapi::experimental::device_global<T, PropertyListT> &Src,
1301
1344
std::remove_all_extents_t <T> *Dest, size_t Count, size_t StartIndex,
1302
- const std::vector<event> &DepEvents) {
1345
+ const std::vector<event> &DepEvents _CODELOCPARAM (&CodeLoc)) {
1346
+ _CODELOCARG (&CodeLoc);
1347
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
1303
1348
return this ->memcpy (Dest, Src, Count * sizeof (std::remove_all_extents_t <T>),
1304
1349
StartIndex * sizeof (std::remove_all_extents_t <T>),
1305
1350
DepEvents);
@@ -1322,7 +1367,9 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
1322
1367
event
1323
1368
copy (const ext::oneapi::experimental::device_global<T, PropertyListT> &Src,
1324
1369
std::remove_all_extents_t <T> *Dest, size_t Count, size_t StartIndex,
1325
- event DepEvent) {
1370
+ event DepEvent _CODELOCPARAM (&CodeLoc)) {
1371
+ _CODELOCARG (&CodeLoc);
1372
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
1326
1373
return this ->memcpy (Dest, Src, Count * sizeof (std::remove_all_extents_t <T>),
1327
1374
StartIndex * sizeof (std::remove_all_extents_t <T>),
1328
1375
DepEvent);
@@ -1344,7 +1391,9 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
1344
1391
copy (const ext::oneapi::experimental::device_global<T, PropertyListT> &Src,
1345
1392
std::remove_all_extents_t <T> *Dest,
1346
1393
size_t Count = sizeof (T) / sizeof(std::remove_all_extents_t <T>),
1347
- size_t StartIndex = 0) {
1394
+ size_t StartIndex = 0 _CODELOCPARAM(&CodeLoc)) {
1395
+ _CODELOCARG (&CodeLoc);
1396
+ detail::tls_code_loc_t TlsCodeLocCapture (CodeLoc);
1348
1397
return this ->memcpy (Dest, Src, Count * sizeof (std::remove_all_extents_t <T>),
1349
1398
StartIndex * sizeof (std::remove_all_extents_t <T>));
1350
1399
}
0 commit comments