Skip to content

Commit c1666d9

Browse files
authored
[SYCL][DOC] Update properties design to new API (#6115)
We previously made some minor updates to the extension specification for compile time properties, which affected the API. This commit just makes some minor tweaks to the design document to bring it into alignment with the extension spec.
1 parent 6ac62ab commit c1666d9

File tree

1 file changed

+27
-32
lines changed

1 file changed

+27
-32
lines changed

sycl/doc/design/CompileTimeProperties.md

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ for declaring global variables. One such example is the
4545
```
4646
namespace sycl::ext::oneapi {
4747
48-
template <typename T, typename PropertyListT = property_list<>>
48+
template <typename T, typename PropertyListT = properties<>>
4949
class device_global {/*...*/};
5050
5151
} // namespace sycl::ext::oneapi
@@ -57,10 +57,7 @@ two compile-time properties:
5757
```
5858
using sycl::ext::oneapi;
5959
60-
device_global<int,
61-
property_list_t<
62-
device_image_scope::value_t,
63-
host_access::value_t<host_access::access::read>>>
60+
device_global<int, decltype(properties{device_image_scope, host_access_read})>
6461
dm1;
6562
```
6663

@@ -71,7 +68,7 @@ is a list that is created through a template parameter pack expansion:
7168
```
7269
namespace sycl::ext::oneapi {
7370
74-
template <typename T, typename PropertyListT = property_list<>>
71+
template <typename T, typename PropertyListT = properties<>>
7572
class device_global {/*...*/};
7673
7774
// Partial specialization to make PropertyListT visible as a parameter pack
@@ -83,7 +80,7 @@ class
8380
Props::meta_name..., Props::meta_value...
8481
)]]
8582
#endif
86-
device_global<T, property_list<Props...>> {/*...*/};
83+
device_global<T, properties<Props...>> {/*...*/};
8784
8885
} // namespace sycl::ext::oneapi
8986
```
@@ -158,7 +155,7 @@ template <typename dataT,
158155
access::mode accessmode,
159156
access::target accessTarget,
160157
access::placeholder isPlaceholder,
161-
typename PropertyListT = ext::oneapi::property_list<>>
158+
typename PropertyListT = ext::oneapi::properties<>>
162159
class __attribute__((sycl_special_class)) accessor {/* ... */};
163160
164161
} // namespace sycl
@@ -171,7 +168,7 @@ Typical usage would look like this (showing a hypothetical property named
171168
using sycl;
172169
using sycl::ext::oneapi;
173170
174-
accessor acc(buf, cgh, property_list{no_alias_v, foo_v<32>});
171+
accessor acc(buf, cgh, properties{no_alias, foo<32>});
175172
```
176173

177174
In the headers the C++ attribute
@@ -188,7 +185,7 @@ template <typename dataT,
188185
access::mode accessmode,
189186
access::target accessTarget,
190187
access::placeholder isPlaceholder,
191-
typename PropertyListT = ext::oneapi::property_list<>>
188+
typename PropertyListT = ext::oneapi::properties<>>
192189
class __attribute__((sycl_special_class)) accessor {/* ... */};
193190
194191
// Partial specialization to make PropertyListT visible as a parameter pack
@@ -204,7 +201,7 @@ class __attribute__((sycl_special_class)) accessor<dataT,
204201
accessmode,
205202
accessTarget,
206203
isPlaceholder,
207-
property_list<Props...>> {
204+
properties<Props...>> {
208205
dataT *ptr;
209206
210207
#ifdef __SYCL_DEVICE_ONLY__
@@ -269,12 +266,12 @@ the property value to a string if it is not already a string.
269266

270267
## Properties on kernel functions
271268

272-
Compile-time properties can also be used to decorate kernel functions as with
273-
the [sycl\_ext\_oneapi\_properties][8] extension. There are two ways the
274-
application can specify these properties. The first is by passing a
275-
`property_list` parameter to the function that submits the kernel:
269+
Compile-time properties can also be used to decorate kernel functions as
270+
proposed in the [sycl\_ext\_oneapi\_kernel\_properties][8] extension. There
271+
are two ways the application can specify these properties. The first is by
272+
passing a `properties` parameter to the function that submits the kernel:
276273

277-
[8]: <../extensions/experimental/sycl_ext_oneapi_properties.asciidoc>
274+
[8]: <../extensions/proposed/sycl_ext_oneapi_kernel_properties.asciidoc>
278275

279276
```
280277
namespace sycl {
@@ -295,13 +292,14 @@ using sycl::ext::oneapi;
295292
296293
void foo(handler &cgh) {
297294
cgh.single_task(
298-
property_list{sub_group_size_v<32>, device_has_v<aspect::fp16>},
295+
properties{sub_group_size<32>, device_has<aspect::fp16>},
299296
[=] {/* ... */});
300297
}
301298
```
302299

303300
The second way an application can specify kernel properties is by adding a
304-
`properties` member variable to a named kernel function object:
301+
member function named `get(sycl::ext::oneapi::properties_tag)` to a named
302+
kernel function object:
305303

306304
```
307305
using sycl;
@@ -311,8 +309,9 @@ class MyKernel {
311309
public:
312310
void operator()() {/* ... */}
313311
314-
static constexpr auto properties =
315-
property_list{sub_group_size_v<32>, device_has_v<aspect::fp16>};
312+
auto get(properties_tag) {
313+
return properties{sub_group_size<32>, device_has<aspect::fp16>};
314+
}
316315
};
317316
318317
void foo(handler &cgh) {
@@ -335,7 +334,7 @@ class KernelSingleTaskWrapper;
335334
// Partial specialization to make PropertyListT visible as a parameter pack
336335
// of properties.
337336
template<typename KernelType, typename ...Props>
338-
class KernelSingleTaskWrapper<KernelType, property_list<Props...>> {
337+
class KernelSingleTaskWrapper<KernelType, properties<Props...>> {
339338
KernelType k;
340339
341340
public:
@@ -379,7 +378,7 @@ class.
379378
```
380379
namespace sycl::ext::oneapi {
381380
382-
template <typename T, typename PropertyListT = property_list_t<>>
381+
template <typename T, typename PropertyListT = properties<>>
383382
class annotated_ptr {
384383
T *ptr;
385384
public:
@@ -395,11 +394,7 @@ where an example use looks like:
395394
using sycl::ext::oneapi;
396395
397396
void foo(int *p) {
398-
annotated_ptr<int
399-
property_list_t<
400-
foo::value_t,
401-
bar::value_t<32>>>
402-
aptr(p);
397+
annotated_ptr<int, decltype(properties{foo, bar<32>})> aptr(p);
403398
}
404399
```
405400

@@ -411,13 +406,13 @@ represent the properties.
411406
```
412407
namespace sycl::ext::oneapi {
413408
414-
template <typename T, typename PropertyListT = property_list_t<>>
409+
template <typename T, typename PropertyListT = properties<>>
415410
class annotated_ptr;
416411
417412
// Partial specialization to make PropertyListT visible as a parameter pack
418413
// of properties.
419414
template <typename T, typename ...Props>
420-
class annotated_ptr<T, property_list<Props...>> {
415+
class annotated_ptr<T, properties<Props...>> {
421416
T *ptr
422417
#ifdef __SYCL_DEVICE_ONLY__
423418
[[__sycl_detail__::add_ir_annotations_member(
@@ -437,13 +432,13 @@ Illustrating this with properties from our previous example:
437432
```
438433
namespace sycl::ext::oneapi {
439434
440-
template <typename T, typename PropertyListT = property_list_t<>>
435+
template <typename T, typename PropertyListT = properties<>>
441436
class annotated_ptr;
442437
443438
// Partial specialization to make PropertyListT visible as a parameter pack
444439
// of properties.
445440
template <typename T, typename ...Props>
446-
class annotated_ptr<T, property_list<Props...>> {
441+
class annotated_ptr<T, properties<Props...>> {
447442
T *ptr
448443
#ifdef __SYCL_DEVICE_ONLY__
449444
[[__sycl_detail__::add_ir_annotations_member(
@@ -660,7 +655,7 @@ class __attribute__((sycl_special_class)) accessor<dataT,
660655
accessmode,
661656
accessTarget,
662657
isPlaceholder,
663-
property_list<Props...>> {
658+
properties<Props...>> {
664659
T *ptr
665660
#ifdef __SYCL_DEVICE_ONLY__
666661
[[__sycl_detail__::add_ir_annotations_member(

0 commit comments

Comments
 (0)