@@ -79,19 +79,19 @@ together with specializations for each aspect:
79
79
``` c++
80
80
namespace sycl {
81
81
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__ > {};
85
85
...
86
86
87
87
#ifdef __ SYCL_ANY_DEVICE_HAS_ANY_ASPECT__
88
88
// Special case where any_device_has is trivially true.
89
89
template <aspect Aspect > any_device_has : std::true_t {};
90
90
#else
91
91
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__ > {};
95
95
...
96
96
#endif // __ SYCL_ANY_DEVICE_HAS_ANY_ASPECT__
97
97
@@ -100,9 +100,10 @@ template <aspect Aspect> constexpr bool any_device_has_v = any_device_has<Aspect
100
100
} // namespace sycl
101
101
```
102
102
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$.
106
107
107
108
Since the specializations need to be explicitly specified, there is a high
108
109
probability of mistakes when new aspects are added. To avoid such mistakes, a
0 commit comments