Skip to content

Commit 93a5e80

Browse files
committed
Amend case for undefined macros
Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 114a834 commit 93a5e80

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

sycl/doc/design/DeviceAspectTraitDesign.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,19 @@ together with specializations for each aspect:
7979
```c++
8080
namespace sycl {
8181
template <aspect Aspect> all_devices_have;
82-
template<> all_devices_have<aspect::host> : std::bool_constant<__SYCL_ALL_DEVICES_HAVE_0__ + 0> {};
83-
template<> all_devices_have<aspect::cpu> : std::bool_constant<__SYCL_ALL_DEVICES_HAVE_1__ + 0> {};
84-
template<> all_devices_have<aspect::gpu> : std::bool_constant<__SYCL_ALL_DEVICES_HAVE_2__ + 0> {};
82+
template<> all_devices_have<aspect::host> : std::bool_constant<__SYCL_ALL_DEVICES_HAVE_0__> {};
83+
template<> all_devices_have<aspect::cpu> : std::bool_constant<__SYCL_ALL_DEVICES_HAVE_1__> {};
84+
template<> all_devices_have<aspect::gpu> : std::bool_constant<__SYCL_ALL_DEVICES_HAVE_2__> {};
8585
...
8686

8787
#ifdef __SYCL_ANY_DEVICE_HAS_ANY_ASPECT__
8888
// Special case where any_device_has is trivially true.
8989
template <aspect Aspect> any_device_has : std::true_t {};
9090
#else
9191
template <aspect Aspect> any_device_has;
92-
template<> any_device_has<aspect::host> : std::bool_constant<__SYCL_ANY_DEVICE_HAS_0__ + 0> {};
93-
template<> any_device_has<aspect::cpu> : std::bool_constant<__SYCL_ANY_DEVICE_HAS_1__ + 0> {};
94-
template<> any_device_has<aspect::gpu> : std::bool_constant<__SYCL_ANY_DEVICE_HAS_2__ + 0> {};
92+
template<> any_device_has<aspect::host> : std::bool_constant<__SYCL_ANY_DEVICE_HAS_0__> {};
93+
template<> any_device_has<aspect::cpu> : std::bool_constant<__SYCL_ANY_DEVICE_HAS_1__> {};
94+
template<> any_device_has<aspect::gpu> : std::bool_constant<__SYCL_ANY_DEVICE_HAS_2__> {};
9595
...
9696
#endif // __SYCL_ANY_DEVICE_HAS_ANY_ASPECT__
9797

@@ -100,9 +100,10 @@ template <aspect Aspect> constexpr bool any_device_has_v = any_device_has<Aspect
100100
} // namespace sycl
101101
```
102102
103-
Note that the driver may not define macros for all aspects, so the `+ 0` is
104-
used to ensure the boolean constant value of the specializations become `false`
105-
when the corresponding macro is undefined.
103+
Note that the driver may not define macros for all aspects as it only knows the
104+
specified subset from the configuration file. As such the device headers will
105+
have to define any undefined `__SYCL_ANY_DEVICE_HAS_`$i$`__` and
106+
`__SYCL_ALL_DEVICES_HAVE_`$i$`__` as `0` for all aspect values $i$.
106107
107108
Since the specializations need to be explicitly specified, there is a high
108109
probability of mistakes when new aspects are added. To avoid such mistakes, a

0 commit comments

Comments
 (0)