Skip to content

Commit 05ef111

Browse files
author
Michael Kinsner
committed
Apply suggestions from @Pennycook
1 parent a301564 commit 05ef111

File tree

1 file changed

+67
-62
lines changed

1 file changed

+67
-62
lines changed

sycl/doc/extensions/DeviceGlobal/SYCL_INTEL_device_global.asciidoc

Lines changed: 67 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Roland Schulz, Intel
7878

7979
This extension is written against the SYCL 2020 specification, revision 3.
8080

81-
It also depends on the `sycl::ext::oneapi::property_list` extension.
81+
It also depends on the `SYCL_EXT_ONEAPI_PROPERTY_LIST` extension.
8282

8383
== Overview
8484

@@ -171,14 +171,14 @@ A `device_global` on a given device maintains its state (address of the allocati
171171
[source,c++]
172172
----
173173
namespace sycl::ext::oneapi {
174-
template <typename T, typename propertyListT = property_list<>>
174+
template <typename T, typename PropertyListT = property_list<>>
175175
class device_global {
176176
...
177177
----
178178

179-
`device_global` is a class template, parameterized by the type of the underlying allocation _T_, and a list of properties _propertyListT_. The type of the allocation _T_ also encodes the size of the allocation for potentially multidimensional array types.
179+
`device_global` is a class template, parameterized by the type of the underlying allocation _T_, and a list of properties _PropertyListT_. The type of the allocation _T_ also encodes the size of the allocation for potentially multidimensional array types.
180180

181-
_T_ is restricted to types that have a trivial destructor and a trivial default constructor in this revision of the specification (the constructor restriction may be partially relaxed in a future revision). _propertyListT_ enables properties to be associated with a `device_global`.
181+
_T_ is restricted to types that have a trivial destructor and a trivial default constructor in this revision of the specification (the constructor restriction may be partially relaxed in a future revision). _PropertyListT_ enables properties to be associated with a `device_global`.
182182

183183
Since _T_ is restricted to types with trivial default constructors in this version of the specification, there are no non-default `device_global` constructors, and therefore no initialization values may be specified for the content of a `device_global` allocation on a device.
184184

@@ -229,7 +229,7 @@ The section below and the table following describe the constructors, member func
229229
----
230230
namespace sycl::ext::oneapi {
231231
232-
template <typename T, typename property_listT = property_list<>>
232+
template <typename T, typename PropertyListT = property_list<>>
233233
class device_global {
234234
public:
235235
using element_type = std::remove_extent_t<T>;
@@ -431,74 +431,79 @@ global variable that isn’t `const` or `constexpr` unless the variable is of ty
431431
Add the following functions to the `sycl::queue` interface described in Section 4.6.5.1 of
432432
the SYCL 2020 specification.
433433

434+
[NOTE]
435+
====
436+
A pointer to the allocation within a `device_global` may not be obtained by the host program (can only be extracted in device functions because allocations are per device), so pointer arithmetic can therefore not be used in the host program to define `copy`/`memcpy' offsets into data. `startIndex` and `offset` arguments are provided in these interfaces to allow offsetting without pointer arithmetic.
437+
====
438+
434439
```c++
435440
namespace sycl {
436441
class queue {
437442
public:
438443
// Copy to device_global
439-
template <typename T, typename propertyListT>
444+
template <typename T, typename PropertyListT>
440445
event copy(const std::remove_all_extents_t<T> *src,
441-
device_global<T, propertyListT>& dest,
446+
device_global<T, PropertyListT>& dest,
442447
size_t count = sizeof(T) / sizeof(std::remove_all_extents_t<T>),
443448
size_t startIndex = 0);
444449

445-
template <typename T, typename propertyListT>
450+
template <typename T, typename PropertyListT>
446451
event copy(const std::remove_all_extents_t<T> *src,
447-
device_global<T, propertyListT>& dest,
452+
device_global<T, PropertyListT>& dest,
448453
size_t count, size_t startIndex, event depEvent);
449454

450-
template <typename T, typename propertyListT>
455+
template <typename T, typename PropertyListT>
451456
event copy(const std::remove_all_extents_t<T> *src,
452-
device_global<T, propertyListT>& dest,
457+
device_global<T, PropertyListT>& dest,
453458
size_t count, size_t startIndex,
454459
const std::vector<event> &depEvents);
455460

456461
// Copy from device_global
457-
template <typename T, typename propertyListT>
458-
event copy(const device_global<T, propertyListT>& src,
462+
template <typename T, typename PropertyListT>
463+
event copy(const device_global<T, PropertyListT>& src,
459464
std::remove_all_extents_t<T> *dest,
460465
size_t count = sizeof(T) / sizeof(std::remove_all_extents_t<T>),
461466
size_t startIndex = 0);
462467

463-
template <typename T, typename propertyListT>
464-
event copy(const device_global<T, propertyListT>& src,
468+
template <typename T, typename PropertyListT>
469+
event copy(const device_global<T, PropertyListT>& src,
465470
std::remove_all_extents_t<T> *dest,
466471
size_t count, size_t startIndex, event depEvent);
467472

468-
template <typename T, typename propertyListT>
469-
event copy(const device_global<T, propertyListT>& src,
473+
template <typename T, typename PropertyListT>
474+
event copy(const device_global<T, PropertyListT>& src,
470475
std::remove_all_extents_t<T> *dest,
471476
size_t count,size_t startIndex, const std::vector<event> &depEvents);
472477

473478
// memcpy to device_global
474-
template <typename T, typename propertyListT>
475-
event memcpy(device_global<T, propertyListT>& dest,
479+
template <typename T, typename PropertyListT>
480+
event memcpy(device_global<T, PropertyListT>& dest,
476481
const void *src, size_t numBytes = sizeof(T), size_t offset = 0);
477482

478-
template <typename T, typename propertyListT>
479-
event memcpy(device_global<T, propertyListT>& dest,
483+
template <typename T, typename PropertyListT>
484+
event memcpy(device_global<T, PropertyListT>& dest,
480485
const void *src, size_t numBytes,
481486
size_t offset, event depEvent);
482487

483-
template <typename T, typename propertyListT>
484-
event memcpy(device_global<T, propertyListT>& dest,
488+
template <typename T, typename PropertyListT>
489+
event memcpy(device_global<T, PropertyListT>& dest,
485490
const void *src, size_t numBytes,
486491
size_t offset, const std::vector<event> &depEvents);
487492

488493
// memcpy from device_global
489-
template <typename T, typename propertyListT>
494+
template <typename T, typename PropertyListT>
490495
event memcpy(void *dest,
491-
const device_global<T, propertyListT>& src,
496+
const device_global<T, PropertyListT>& src,
492497
size_t numBytes = sizeof(T), size_t offset = 0);
493498

494-
template <typename T, typename propertyListT>
499+
template <typename T, typename PropertyListT>
495500
event memcpy(void *dest,
496-
const device_global<T, propertyListT>& src, size_t numBytes,
501+
const device_global<T, PropertyListT>& src, size_t numBytes,
497502
size_t offset, event depEvent);
498503

499-
template <typename T, typename propertyListT>
504+
template <typename T, typename PropertyListT>
500505
event memcpy(void *dest,
501-
const device_global<T, propertyListT>& src, size_t numBytes,
506+
const device_global<T, PropertyListT>& src, size_t numBytes,
502507
size_t offset, const std::vector<event> &depEvents);
503508
};
504509
} // namespace sycl
@@ -515,9 +520,9 @@ in Section 4.6.5.1 of the SYCL 2020 specification.
515520
a|
516521
[source, c++]
517522
----
518-
template <typename T, typename propertyListT>
523+
template <typename T, typename PropertyListT>
519524
event copy(const std::remove_all_extents_t<T> *src,
520-
device_global<T, propertyListT>& dest,
525+
device_global<T, PropertyListT>& dest,
521526
size_t count = sizeof(T) / sizeof(std::remove_all_extents_t<T>),
522527
size_t startIndex = 0);
523528
----
@@ -526,28 +531,28 @@ event copy(const std::remove_all_extents_t<T> *src,
526531
a|
527532
[source, c++]
528533
----
529-
template <typename T, typename propertyListT>
534+
template <typename T, typename PropertyListT>
530535
event copy(const std::remove_all_extents_t<T> *src,
531-
device_global<T, propertyListT>& dest,
536+
device_global<T, PropertyListT>& dest,
532537
size_t count, size_t startIndex, event depEvent);
533538
----
534539
| Explicit copy
535540

536541
a|
537542
[source, c++]
538543
----
539-
template <typename T, typename propertyListT>
544+
template <typename T, typename PropertyListT>
540545
event copy(const std::remove_all_extents_t<T> *src,
541-
device_global<T, propertyListT>& dest,
546+
device_global<T, PropertyListT>& dest,
542547
size_t count, size_t startIndex, const std::vector<event> &depEvents);
543548
----
544549
| Explicit copy
545550

546551
a|
547552
[source, c++]
548553
----
549-
template <typename T, typename propertyListT>
550-
event copy(const device_global<T, propertyListT>& src,
554+
template <typename T, typename PropertyListT>
555+
event copy(const device_global<T, PropertyListT>& src,
551556
std::remove_all_extents_t<T> *dest,
552557
size_t count = sizeof(T) / sizeof(std::remove_all_extents_t<T>),
553558
size_t startIndex = 0);
@@ -557,8 +562,8 @@ event copy(const device_global<T, propertyListT>& src,
557562
a|
558563
[source, c++]
559564
----
560-
template <typename T, typename propertyListT>
561-
event copy(const device_global<T, propertyListT>& src,
565+
template <typename T, typename PropertyListT>
566+
event copy(const device_global<T, PropertyListT>& src,
562567
std::remove_all_extents_t<T> *dest,
563568
size_t count, size_t startIndex, event depEvent);
564569
----
@@ -567,8 +572,8 @@ event copy(const device_global<T, propertyListT>& src,
567572
a|
568573
[source, c++]
569574
----
570-
template <typename T, typename propertyListT>
571-
event copy(const device_global<T, propertyListT>& src,
575+
template <typename T, typename PropertyListT>
576+
event copy(const device_global<T, PropertyListT>& src,
572577
std::remove_all_extents_t<T> *dest,
573578
size_t count, size_t startIndex, const std::vector<event> &depEvents);
574579
----
@@ -577,17 +582,17 @@ event copy(const device_global<T, propertyListT>& src,
577582
a|
578583
[source, c++]
579584
----
580-
template <typename T, typename propertyListT>
581-
event memcpy(device_global<T, propertyListT>& dest,
585+
template <typename T, typename PropertyListT>
586+
event memcpy(device_global<T, PropertyListT>& dest,
582587
const void *src, size_t numBytes = sizeof(T), size_t offset = 0);
583588
----
584589
| Explicit copy
585590

586591
a|
587592
[source, c++]
588593
----
589-
template <typename T, typename propertyListT>
590-
event memcpy(device_global<T, propertyListT>& dest,
594+
template <typename T, typename PropertyListT>
595+
event memcpy(device_global<T, PropertyListT>& dest,
591596
const void *src, size_t numBytes,
592597
size_t offset, event depEvent);
593598
----
@@ -596,8 +601,8 @@ event memcpy(device_global<T, propertyListT>& dest,
596601
a|
597602
[source, c++]
598603
----
599-
template <typename T, typename propertyListT>
600-
event memcpy(device_global<T, propertyListT>& dest,
604+
template <typename T, typename PropertyListT>
605+
event memcpy(device_global<T, PropertyListT>& dest,
601606
const void *src, size_t numBytes,
602607
size_t offset, const std::vector<event> &depEvents);
603608
----
@@ -606,29 +611,29 @@ event memcpy(device_global<T, propertyListT>& dest,
606611
a|
607612
[source, c++]
608613
----
609-
template <typename T, typename propertyListT>
614+
template <typename T, typename PropertyListT>
610615
event memcpy(void *dest,
611-
const device_global<T, propertyListT>& src,
616+
const device_global<T, PropertyListT>& src,
612617
size_t numBytes = sizeof(T), size_t offset = 0);
613618
----
614619
| Explicit copy
615620

616621
a|
617622
[source, c++]
618623
----
619-
template <typename T, typename propertyListT>
624+
template <typename T, typename PropertyListT>
620625
event memcpy(void *dest,
621-
const device_global<T, propertyListT>& src, size_t numBytes,
626+
const device_global<T, PropertyListT>& src, size_t numBytes,
622627
size_t offset, event depEvent);
623628
----
624629
| Explicit copy
625630

626631
a|
627632
[source, c++]
628633
----
629-
template <typename T, typename propertyListT>
634+
template <typename T, typename PropertyListT>
630635
event memcpy(void *dest,
631-
const device_global<T, propertyListT>& src, size_t numBytes,
636+
const device_global<T, PropertyListT>& src, size_t numBytes,
632637
size_t offset, const std::vector<event> &depEvents);
633638
----
634639
| Explicit copy
@@ -650,9 +655,9 @@ Add to Table 130, "Member functions of the handler class".
650655
a|
651656
[source, c++]
652657
----
653-
template <typename T, typename propertyListT>
658+
template <typename T, typename PropertyListT>
654659
void copy(const std::remove_all_extents_t<T> *src,
655-
device_global<T, propertyListT>& dest,
660+
device_global<T, PropertyListT>& dest,
656661
size_t count = sizeof(T) / sizeof(std::remove_all_extents_t<T>),
657662
size_t startIndex = 0);
658663
----
@@ -662,8 +667,8 @@ Copies _count_ elements of type `std::remove_all_extents_t<T>` from the pointer
662667
a|
663668
[source, c++]
664669
----
665-
template <typename T, typename propertyListT>
666-
void copy(const device_global<T, propertyListT>& src,
670+
template <typename T, typename PropertyListT>
671+
void copy(const device_global<T, PropertyListT>& src,
667672
std::remove_all_extents_t<T> *dest,
668673
size_t count = sizeof(T) / sizeof(std::remove_all_extents_t<T>),
669674
size_t startIndex = 0);
@@ -675,8 +680,8 @@ Copies _count_ elements of type `std::remove_all_extents_t<T>` from the `device_
675680
a|
676681
[source, c++]
677682
----
678-
template <typename T, typename propertyListT>
679-
void memcpy(device_global<T, propertyListT>& dest,
683+
template <typename T, typename PropertyListT>
684+
void memcpy(device_global<T, PropertyListT>& dest,
680685
const void *src, size_t numBytes = sizeof(T), size_t offset = 0);
681686
----
682687
|`T` must be device copyable.
@@ -686,9 +691,9 @@ Copies _count_ bytes from the pointer _src_ to the `device_global` _dest_, start
686691
a|
687692
[source, c++]
688693
----
689-
template <typename T, typename propertyListT>
694+
template <typename T, typename PropertyListT>
690695
void memcpy(void *dest,
691-
const device_global<T, propertyListT>& src,
696+
const device_global<T, PropertyListT>& src,
692697
size_t numBytes = sizeof(T), size_t offset = 0);
693698
----
694699
|`T` must be device copyable.
@@ -708,7 +713,7 @@ A sketch of the anticipated constructor interface is:
708713
----
709714
namespace sycl::ext::oneapi {
710715
711-
template <typename T, typename propertyListT = property_list<>>
716+
template <typename T, typename PropertyListT = property_list<>>
712717
class device_global {
713718
public:
714719
using element_type = std::remove_extent_t<T>;

0 commit comments

Comments
 (0)