Skip to content

Commit df83271

Browse files
authored
[SYCL][DOC] Tweak to optional feature design (#5404)
During a conversation with @elizabethandrews, we decided that the `[[sycl_detail::uses_aspects()]]` attribute should not be allowed on type aliases.
1 parent d183807 commit df83271

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

sycl/doc/OptionalDeviceFeatures.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -344,21 +344,17 @@ To illustrate, the type `sycl::half` is an optional feature whose associated
344344
aspect is `aspect::fp16`. We therefore decorate the declaration like this:
345345

346346
```
347-
using half [[__sycl_detail__::__uses_aspects__(aspect::fp16)]] =
348-
cl::sycl::detail::half_impl::half;
349-
```
350-
351-
If an optional feature is expressed as a class type, it can be similarly
352-
decorated (here illustrating a hypothetical AMX type):
347+
namespace sycl::detail::half_impl {
353348
354-
```
355-
class [[__sycl_detail__::__uses_aspects__(aspect::ext_intel_amx)]] amx_type {
356-
/* ... */
349+
class [[__sycl_detail__::__uses_aspects__(aspect::fp16)]] half {
350+
/* ... */
357351
};
352+
353+
} // namespace sycl::detail::half_impl;
358354
```
359355

360356
This attribute is also used to decorate function declarations that correspond
361-
to optional features. Again, illustrating a hypothetical AMX extension:
357+
to optional features. Illustrating a hypothetical AMX extension:
362358

363359
```
364360
[[__sycl_detail__::__uses_aspects__(aspect::ext_intel_amx)]]
@@ -382,10 +378,11 @@ might be decorated with
382378
`[[sycl_detail::uses_aspects(aspect::fp64, aspect::atomic64)]]`).
383379

384380
Unfortunately, the fundamental type `double` is also an optional kernel
385-
feature. Since there is no type alias for `double`, there is no convenient
386-
place to add an attribute. Instead, the FE device compiler must behave as
387-
though there was an implicit `[[sycl_detail::uses_aspects(aspect::fp64)]]`
388-
attribute for any device code that uses the `double` type.
381+
feature. Since there is no type definition for `double` in the headers, there
382+
is no convenient place to add an attribute. Instead, the FE device compiler
383+
must behave as though there was an implicit
384+
`[[sycl_detail::uses_aspects(aspect::fp64)]]` attribute for any device code
385+
that uses the `double` type.
389386

390387

391388
### New LLVM IR metadata

0 commit comments

Comments
 (0)