Skip to content

Commit f90554f

Browse files
[SYCL][Docs] Fix variadic properties ctor (#13676)
The [compile-time properties extension](https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_oneapi_properties.asciidoc) specifies that the variadic ctor has the following behavior: >Available only when each argument in props is an object of a property value. Construct a property list with zero or more property values. This constructor can accept both runtime and compile-time constant property values. Each property in the property list (as determined by PropertyValuesT) that is not default constructable must have an object provided in props. However, the current implementation does not adhere to these requirements. This commit makes the following changes to adhere to the required behavior: * The ctor is now SFINAE'd out when arguments are non-property types. * Each argument must now have a corresponding property in the list. * Default-constructible arguments can now be omitted from the arguments. This only applied to compile-time properties previously. Additionally, this exposed bugs in a set of extensions relying on these properties, which has in turn also been fixed with this commit. --------- Signed-off-by: Larsen, Steffen <[email protected]>
1 parent d81d8de commit f90554f

File tree

13 files changed

+249
-126
lines changed

13 files changed

+249
-126
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_annotated_arg.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ template <typename T, typename PropertyListT = empty_properties_t>
200200
class annotated_arg {
201201
public:
202202
annotated_arg() noexcept;
203-
annotated_arg(const T& v_, const PropertyListT &P = properties{}) noexcept;
203+
annotated_arg(const T& v_, const PropertyListT &P = PropertyListT{}) noexcept;
204204
template<typename... PropertyValueTs>
205205
annotated_arg(const T& v_, PropertyValueTs... props) noexcept;
206206
@@ -277,7 +277,7 @@ Constructs an `annotated_arg` object which is default initialized.
277277
a|
278278
[source,c++]
279279
----
280-
annotated_arg(const T& v_, const PropertyListT &P = properties{}) noexcept;
280+
annotated_arg(const T& v_, const PropertyListT &P = PropertyListT{}) noexcept;
281281
----
282282
| Not available in device code.
283283
Constructs an `annotated_arg` object from the input object `v_`.

sycl/doc/extensions/experimental/sycl_ext_oneapi_annotated_ptr.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ class annotated_ptr {
287287
using reference = annotated_ref<T, PropertyListT>;
288288
289289
annotated_ptr() noexcept;
290-
explicit annotated_ptr(T *Ptr, const PropertyListT &P = properties{}) noexcept;
290+
explicit annotated_ptr(T *Ptr, const PropertyListT &P = PropertyListT{}) noexcept;
291291
template<typename... PropertyValueTs>
292292
explicit annotated_ptr(T *Ptr, PropertyValueTs... props) noexcept;
293293
@@ -359,7 +359,7 @@ underlying pointer is initialized to `nullptr`.
359359
a|
360360
[source,c++]
361361
----
362-
explicit annotated_ptr(T *Ptr, const PropertyListT &P = properties{}) noexcept;
362+
explicit annotated_ptr(T *Ptr, const PropertyListT &P = PropertyListT{}) noexcept;
363363
----
364364
|
365365
Constructs an `annotated_ptr` object. Does not allocate new storage. The

sycl/doc/extensions/proposed/sycl_ext_oneapi_usm_malloc_properties.asciidoc

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ malloc_device_annotated(
281281
size_t numBytes,
282282
const device& syclDevice,
283283
const context& syclContext,
284-
const propertyListA &propList = properties{})
284+
const propertyListA &propList = propertyListA{})
285285
----
286286
a@ Returns an `annotated_ptr` containing a raw pointer to the newly allocated memory, which is allocated on `syclDevice`.
287287
The allocation size is specified in bytes.
@@ -316,7 +316,7 @@ malloc_device_annotated(
316316
size_t count,
317317
const device& syclDevice,
318318
const context& syclContext,
319-
const propertyListA &propList = properties{})
319+
const propertyListA &propList = propertyListA{})
320320
----
321321
a@ Returns an `annotated_ptr` containing a raw pointer to the newly allocated memory, which is allocated on `syclDevice`.
322322
The allocation size is specified in number of elements of type
@@ -349,7 +349,7 @@ annotated_ptr<void, propertyListB>
349349
malloc_device_annotated(
350350
size_t numBytes,
351351
const queue& syclQueue,
352-
const propertyListA &propList = properties{})
352+
const propertyListA &propList = propertyListA{})
353353
----
354354
a@ Simplified form where `syclQueue` provides the `device`
355355
and `context`.
@@ -364,7 +364,7 @@ annotated_ptr<T, propertyListB>
364364
malloc_device_annotated(
365365
size_t count,
366366
const queue& syclQueue,
367-
const propertyListA &propList = properties{})
367+
const propertyListA &propList = propertyListA{})
368368
----
369369
a@ Simplified form where `syclQueue` provides the `device`
370370
and `context`.
@@ -379,7 +379,7 @@ aligned_alloc_device_annotated(
379379
size_t numBytes,
380380
const device& syclDevice,
381381
const context& syclContext,
382-
const propertyListA &propList = properties{})
382+
const propertyListA &propList = propertyListA{})
383383
----
384384
a@ Returns an `annotated_ptr` containing a raw pointer to the newly allocated memory, which is allocated on
385385
`syclDevice`.
@@ -417,7 +417,7 @@ aligned_alloc_device_annotated(
417417
size_t count,
418418
const device& syclDevice,
419419
const context& syclContext,
420-
const propertyListA &propList = properties{})
420+
const propertyListA &propList = propertyListA{})
421421
----
422422
a@ Returns an `annotated_ptr` containing a raw pointer to the newly allocated memory, which is allocated on
423423
`syclDevice`.
@@ -452,7 +452,7 @@ aligned_alloc_device_annotated(
452452
size_t alignment,
453453
size_t numBytes,
454454
const queue& syclQueue,
455-
const propertyListA &propList = properties{})
455+
const propertyListA &propList = propertyListA{})
456456
----
457457
a@ Simplified form where `syclQueue` provides the `device`
458458
and `context`.
@@ -468,7 +468,7 @@ aligned_alloc_device_annotated(
468468
size_t alignment,
469469
size_t count,
470470
const queue& syclQueue,
471-
const propertyListA &propList = properties{})
471+
const propertyListA &propList = propertyListA{})
472472
----
473473
a@ Simplified form where `syclQueue` provides the `device`
474474
and `context`.
@@ -497,7 +497,7 @@ annotated_ptr<void, propertyListB>
497497
malloc_host_annotated(
498498
size_t numBytes,
499499
const context& syclContext,
500-
const propertyListA &propList = properties{})
500+
const propertyListA &propList = propertyListA{})
501501
----
502502
a@ Returns an `annotated_ptr` containing a raw pointer to the newly allocated memory. This allocation is specified in bytes.
503503

@@ -526,7 +526,7 @@ annotated_ptr<T, propertyListB>
526526
malloc_host_annotated(
527527
size_t count,
528528
const context& syclContext,
529-
const propertyListA &propList = properties{})
529+
const propertyListA &propList = propertyListA{})
530530
----
531531
a@ Returns an `annotated_ptr` containing a raw pointer to the newly allocated memory. This allocation is specified in number of elements of type `T`.
532532

@@ -553,7 +553,7 @@ annotated_ptr<void, propertyListB>
553553
malloc_host_annotated(
554554
size_t numBytes,
555555
const queue& syclQueue,
556-
const propertyListA &propList = properties{})
556+
const propertyListA &propList = propertyListA{})
557557
----
558558
a@ Simplified form where `syclQueue` provides the `context`.
559559

@@ -567,7 +567,7 @@ annotated_ptr<T, propertyListB>
567567
malloc_host_annotated(
568568
size_t count,
569569
const queue& syclQueue,
570-
const propertyListA &propList = properties{})
570+
const propertyListA &propList = propertyListA{})
571571
----
572572
a@ Simplified form where `syclQueue` provides the `context`.
573573

@@ -580,7 +580,7 @@ aligned_alloc_host_annotated(
580580
size_t alignment,
581581
size_t numBytes,
582582
const context& syclContext,
583-
const propertyListA &propList = properties{})
583+
const propertyListA &propList = propertyListA{})
584584
----
585585
a@ Returns an `annotated_ptr` containing a raw pointer to the newly allocated memory.
586586
This allocation is specified in bytes and aligned according to `alignment`.
@@ -611,7 +611,7 @@ aligned_alloc_host_annotated(
611611
size_t alignment,
612612
size_t count,
613613
const context& syclContext,
614-
const propertyListA &propList = properties{})
614+
const propertyListA &propList = propertyListA{})
615615
----
616616
a@ Returns an `annotated_ptr` containing a raw pointer to the newly allocated memory.
617617
This allocation is specified in elements of type `T` and aligned according to `alignment`.
@@ -640,7 +640,7 @@ aligned_alloc_host_annotated(
640640
size_t alignment,
641641
size_t numBytes,
642642
const queue& syclQueue,
643-
const propertyListA &propList = properties{})
643+
const propertyListA &propList = propertyListA{})
644644
----
645645
a@ Simplified form where `syclQueue` provides the `context`.
646646

@@ -655,7 +655,7 @@ aligned_alloc_host_annotated(
655655
size_t alignment,
656656
size_t count,
657657
const queue& syclQueue,
658-
const propertyListA &propList = properties{})
658+
const propertyListA &propList = propertyListA{})
659659
----
660660
a@ Simplified form where `syclQueue` provides the `context`.
661661

@@ -683,7 +683,7 @@ malloc_shared_annotated(
683683
size_t numBytes,
684684
const device& syclDevice,
685685
const context& syclContext,
686-
const propertyListA &propList = properties{})
686+
const propertyListA &propList = propertyListA{})
687687
----
688688
a@ Returns an `annotated_ptr` containing a raw pointer to the newly allocated memory, which is associated with `syclDevice`.
689689
This allocation is specified in bytes.
@@ -718,7 +718,7 @@ malloc_shared_annotated(
718718
size_t count,
719719
const device& syclDevice,
720720
const context& syclContext,
721-
const propertyListA &propList = properties{})
721+
const propertyListA &propList = propertyListA{})
722722
----
723723
a@ Returns an `annotated_ptr` containing a raw pointer to the newly allocated memory, which is associated with `syclDevice`.
724724
This allocation is specified in number of elements of
@@ -751,7 +751,7 @@ annotated_ptr<void, propertyListB>
751751
malloc_shared_annotated(
752752
size_t numBytes,
753753
const queue& syclQueue,
754-
const propertyListA &propList = properties{})
754+
const propertyListA &propList = propertyListA{})
755755
----
756756
a@ Simplified form where `syclQueue` provides the `device` and
757757
`context`.
@@ -766,7 +766,7 @@ annotated_ptr<T, propertyListB>
766766
malloc_shared_annotated(
767767
size_t count,
768768
const queue& syclQueue,
769-
const propertyListA &propList = properties{})
769+
const propertyListA &propList = propertyListA{})
770770
----
771771
a@ Simplified form where `syclQueue` provides the `device` and
772772
`context`.
@@ -781,7 +781,7 @@ aligned_alloc_shared_annotated(
781781
size_t numBytes,
782782
const device& syclDevice,
783783
const context& syclContext,
784-
const propertyListA &propList = properties{})
784+
const propertyListA &propList = propertyListA{})
785785
----
786786
a@ Returns an `annotated_ptr` containing a raw pointer to the newly allocated memory, which is associated with `syclDevice`.
787787
This allocation is specified in bytes and aligned according to `alignment`.
@@ -817,7 +817,7 @@ aligned_alloc_shared_annotated(
817817
size_t count,
818818
const device& syclDevice,
819819
const context& syclContext,
820-
const propertyListA &propList = properties{})
820+
const propertyListA &propList = propertyListA{})
821821
----
822822
a@ Returns an `annotated_ptr` containing a raw pointer to the newly allocated memory, which is associated with `syclDevice`.
823823
This allocation is specified in number of elements of type `T` and aligned according to `alignment`.
@@ -850,7 +850,7 @@ aligned_alloc_shared_annotated(
850850
size_t alignment,
851851
size_t numBytes,
852852
const queue& syclQueue,
853-
const propertyListA &propList = properties{})
853+
const propertyListA &propList = propertyListA{})
854854
----
855855
a@ Simplified form where `syclQueue` provides the `device` and
856856
`context`.
@@ -866,7 +866,7 @@ aligned_alloc_shared_annotated(
866866
size_t alignment,
867867
size_t count,
868868
const queue& syclQueue,
869-
const propertyListA &propList = properties{})
869+
const propertyListA &propList = propertyListA{})
870870
----
871871
a@ Simplified form where `syclQueue` provides the `device` and
872872
`context`.
@@ -907,7 +907,7 @@ malloc_annotated(
907907
const device& syclDevice,
908908
const context& syclContext,
909909
sycl::usm::alloc kind,
910-
const propertyListA &propList = properties{})
910+
const propertyListA &propList = propertyListA{})
911911
----
912912
a@ Returns an `annotated_ptr` containing a raw pointer to the newly allocated memory of type `kind`.
913913
This allocation size is specified in bytes.
@@ -940,7 +940,7 @@ malloc_annotated(
940940
const device& syclDevice,
941941
const context& syclContext,
942942
sycl::usm::alloc kind,
943-
const propertyListA &propList = properties{})
943+
const propertyListA &propList = propertyListA{})
944944
----
945945
a@ Returns an `annotated_ptr` containing a raw pointer to the newly allocated memory of type `kind`.
946946
This allocation is specified in number of elements of type `T`.
@@ -971,7 +971,7 @@ malloc_annotated(
971971
size_t numBytes,
972972
const queue& syclQueue,
973973
sycl::usm::alloc kind,
974-
const propertyListA &propList = properties{})
974+
const propertyListA &propList = propertyListA{})
975975
----
976976
a@ Simplified form where `syclQueue` provides the `context`
977977
and any necessary `device`.
@@ -987,7 +987,7 @@ malloc_annotated(
987987
size_t count,
988988
const queue& syclQueue,
989989
sycl::usm::alloc kind,
990-
const propertyListA &propList = properties{})
990+
const propertyListA &propList = propertyListA{})
991991
----
992992
a@ Simplified form where `syclQueue` provides the `context`
993993
and any necessary `device`.
@@ -1003,7 +1003,7 @@ aligned_alloc_annotated(
10031003
const device& syclDevice,
10041004
const context& syclContext,
10051005
sycl::usm::alloc kind,
1006-
const propertyListA &propList = properties{})
1006+
const propertyListA &propList = propertyListA{})
10071007
----
10081008
a@ Returns an `annotated_ptr` containing a raw pointer to the newly allocated memory of type `kind`.
10091009
This allocation is specified in bytes and is aligned according to `alignment`.
@@ -1037,7 +1037,7 @@ aligned_alloc_annotated(
10371037
const device& syclDevice,
10381038
const context& syclContext,
10391039
sycl::usm::alloc kind,
1040-
const propertyListA &propList = properties{})
1040+
const propertyListA &propList = propertyListA{})
10411041
----
10421042
a@ Returns an `annotated_ptr` containing a raw pointer to the newly allocated memory of type `kind`.
10431043
This allocation is specified in number of elements of type `T` and is aligned according to `alignment`.
@@ -1068,7 +1068,7 @@ aligned_alloc_annotated(
10681068
size_t numBytes,
10691069
const queue& syclQueue,
10701070
sycl::usm::alloc kind,
1071-
const propertyListA &propList = properties{})
1071+
const propertyListA &propList = propertyListA{})
10721072
----
10731073
a@ Simplified form where `syclQueue` provides the `context`
10741074
and any necessary `device`.
@@ -1085,7 +1085,7 @@ aligned_alloc_annotated(
10851085
size_t count,
10861086
const queue& syclQueue,
10871087
sycl::usm::alloc kind,
1088-
const propertyListA &propList = properties{})
1088+
const propertyListA &propList = propertyListA{})
10891089
----
10901090
a@ Simplified form where `syclQueue` provides the `context`
10911091
and any necessary `device`.

sycl/include/sycl/ext/oneapi/experimental/annotated_arg/annotated_arg.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ __SYCL_TYPE(annotated_arg) annotated_arg<T *, detail::properties_t<Props...>> {
114114
annotated_arg &operator=(annotated_arg &) = default;
115115

116116
annotated_arg(T *_ptr,
117-
const property_list_t &PropList = properties{}) noexcept
117+
const property_list_t &PropList = property_list_t{}) noexcept
118118
: obj(_ptr) {
119119
(void)PropList;
120120
}
@@ -250,7 +250,7 @@ __SYCL_TYPE(annotated_arg) annotated_arg<T, detail::properties_t<Props...>> {
250250
annotated_arg &operator=(annotated_arg &) = default;
251251

252252
annotated_arg(const T &_obj,
253-
const property_list_t &PropList = properties{}) noexcept
253+
const property_list_t &PropList = property_list_t{}) noexcept
254254
: obj(_obj) {
255255
(void)PropList;
256256
}

sycl/include/sycl/ext/oneapi/experimental/annotated_ptr/annotated_ptr.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ __SYCL_TYPE(annotated_ptr) annotated_ptr<T, detail::properties_t<Props...>> {
303303
annotated_ptr &operator=(const annotated_ptr &) = default;
304304

305305
explicit annotated_ptr(T *Ptr,
306-
const property_list_t & = properties{}) noexcept
306+
const property_list_t & = property_list_t{}) noexcept
307307
: m_Ptr(Ptr) {}
308308

309309
// Constructs an annotated_ptr object from a raw pointer and variadic

0 commit comments

Comments
 (0)