@@ -60,13 +60,15 @@ struct device_has_key
60
60
std::integral_constant<aspect, Aspects>...>;
61
61
};
62
62
63
- struct nd_range_kernel_key {
63
+ struct nd_range_kernel_key
64
+ : detail::compile_time_property_key<detail::PropKind::NDRangeKernel> {
64
65
template <int Dims>
65
66
using value_t =
66
67
property_value<nd_range_kernel_key, std::integral_constant<int , Dims>>;
67
68
};
68
69
69
- struct single_task_kernel_key {
70
+ struct single_task_kernel_key
71
+ : detail::compile_time_property_key<detail::PropKind::SingleTaskKernel> {
70
72
using value_t = property_value<single_task_kernel_key>;
71
73
};
72
74
@@ -87,15 +89,18 @@ struct max_linear_work_group_size_key
87
89
88
90
template <size_t Dim0, size_t ... Dims>
89
91
struct property_value <work_group_size_key, std::integral_constant<size_t , Dim0>,
90
- std::integral_constant<size_t , Dims>...> {
92
+ std::integral_constant<size_t , Dims>...>
93
+ : detail::property_base<
94
+ property_value<work_group_size_key,
95
+ std::integral_constant<size_t , Dim0>,
96
+ std::integral_constant<size_t , Dims>...>,
97
+ detail::PropKind::WorkGroupSize, work_group_size_key> {
91
98
static_assert (
92
99
sizeof ...(Dims) + 1 <= 3 ,
93
100
" work_group_size property currently only supports up to three values." );
94
101
static_assert (detail::AllNonZero<Dim0, Dims...>::value,
95
102
" work_group_size property must only contain non-zero values." );
96
103
97
- using key_t = work_group_size_key;
98
-
99
104
constexpr size_t operator [](int Dim) const {
100
105
return std::array<size_t , sizeof ...(Dims) + 1 >{Dim0, Dims...}[Dim];
101
106
}
@@ -104,75 +109,94 @@ struct property_value<work_group_size_key, std::integral_constant<size_t, Dim0>,
104
109
template <size_t Dim0, size_t ... Dims>
105
110
struct property_value <work_group_size_hint_key,
106
111
std::integral_constant<size_t , Dim0>,
107
- std::integral_constant<size_t , Dims>...> {
112
+ std::integral_constant<size_t , Dims>...>
113
+ : detail::property_base<
114
+ property_value<work_group_size_hint_key,
115
+ std::integral_constant<size_t , Dim0>,
116
+ std::integral_constant<size_t , Dims>...>,
117
+ detail::PropKind::WorkGroupSizeHint, work_group_size_hint_key> {
108
118
static_assert (sizeof ...(Dims) + 1 <= 3 ,
109
119
" work_group_size_hint property currently "
110
120
" only supports up to three values." );
111
121
static_assert (
112
122
detail::AllNonZero<Dim0, Dims...>::value,
113
123
" work_group_size_hint property must only contain non-zero values." );
114
124
115
- using key_t = work_group_size_hint_key;
116
-
117
125
constexpr size_t operator [](int Dim) const {
118
126
return std::array<size_t , sizeof ...(Dims) + 1 >{Dim0, Dims...}[Dim];
119
127
}
120
128
};
121
129
122
130
template <uint32_t Size>
123
131
struct property_value <sub_group_size_key,
124
- std::integral_constant<uint32_t , Size>> {
132
+ std::integral_constant<uint32_t , Size>>
133
+ : detail::property_base<
134
+ property_value<sub_group_size_key,
135
+ std::integral_constant<uint32_t , Size>>,
136
+ detail::PropKind::SubGroupSize, sub_group_size_key> {
125
137
static_assert (Size != 0 ,
126
138
" sub_group_size_key property must contain a non-zero value." );
127
139
128
- using key_t = sub_group_size_key;
129
140
using value_t = std::integral_constant<uint32_t , Size>;
130
141
static constexpr uint32_t value = Size;
131
142
};
132
143
133
144
template <aspect... Aspects>
134
145
struct property_value <device_has_key,
135
- std::integral_constant<aspect, Aspects>...> {
136
- using key_t = device_has_key;
146
+ std::integral_constant<aspect, Aspects>...>
147
+ : detail::property_base<
148
+ property_value<device_has_key,
149
+ std::integral_constant<aspect, Aspects>...>,
150
+ detail::PropKind::DeviceHas, device_has_key> {
137
151
static constexpr std::array<aspect, sizeof ...(Aspects)> value{Aspects...};
138
152
};
139
153
140
154
template <int Dims>
141
- struct property_value <nd_range_kernel_key, std::integral_constant<int , Dims>> {
155
+ struct property_value <nd_range_kernel_key, std::integral_constant<int , Dims>>
156
+ : detail::property_base<property_value<nd_range_kernel_key,
157
+ std::integral_constant<int , Dims>>,
158
+ detail::PropKind::NDRangeKernel,
159
+ nd_range_kernel_key> {
142
160
static_assert (
143
161
Dims >= 1 && Dims <= 3 ,
144
162
" nd_range_kernel_key property must use dimension of 1, 2 or 3." );
145
163
146
- using key_t = nd_range_kernel_key;
147
164
using value_t = int ;
148
165
static constexpr int dimensions = Dims;
149
166
};
150
167
151
- template <> struct property_value <single_task_kernel_key> {
152
- using key_t = single_task_kernel_key;
153
- };
168
+ template <>
169
+ struct property_value <single_task_kernel_key>
170
+ : detail::property_base<property_value<single_task_kernel_key>,
171
+ detail::PropKind::SingleTaskKernel,
172
+ single_task_kernel_key> {};
154
173
155
174
template <size_t Dim0, size_t ... Dims>
156
175
struct property_value <max_work_group_size_key,
157
176
std::integral_constant<size_t , Dim0>,
158
- std::integral_constant<size_t , Dims>...> {
177
+ std::integral_constant<size_t , Dims>...>
178
+ : detail::property_base<
179
+ property_value<max_work_group_size_key,
180
+ std::integral_constant<size_t , Dim0>,
181
+ std::integral_constant<size_t , Dims>...>,
182
+ detail::PropKind::MaxWorkGroupSize, max_work_group_size_key> {
159
183
static_assert (sizeof ...(Dims) + 1 <= 3 ,
160
184
" max_work_group_size property currently "
161
185
" only supports up to three values." );
162
186
static_assert (
163
187
detail::AllNonZero<Dim0, Dims...>::value,
164
188
" max_work_group_size property must only contain non-zero values." );
165
189
166
- using key_t = max_work_group_size_key;
167
-
168
190
constexpr size_t operator [](int Dim) const {
169
191
return std::array<size_t , sizeof ...(Dims) + 1 >{Dim0, Dims...}[Dim];
170
192
}
171
193
};
172
194
173
- template <> struct property_value <max_linear_work_group_size_key> {
174
- using key_t = max_linear_work_group_size_key;
175
- };
195
+ template <>
196
+ struct property_value <max_linear_work_group_size_key>
197
+ : detail::property_base<property_value<max_linear_work_group_size_key>,
198
+ detail::PropKind::MaxLinearWorkGroupSize,
199
+ max_linear_work_group_size_key> {};
176
200
177
201
template <size_t Dim0, size_t ... Dims>
178
202
inline constexpr work_group_size_key::value_t <Dim0, Dims...> work_group_size;
@@ -235,8 +259,13 @@ template <forward_progress_guarantee Guarantee,
235
259
struct property_value <
236
260
work_group_progress_key,
237
261
std::integral_constant<forward_progress_guarantee, Guarantee>,
238
- std::integral_constant<execution_scope, CoordinationScope>> {
239
- using key_t = work_group_progress_key;
262
+ std::integral_constant<execution_scope, CoordinationScope>>
263
+ : detail::property_base<
264
+ property_value<
265
+ work_group_progress_key,
266
+ std::integral_constant<forward_progress_guarantee, Guarantee>,
267
+ std::integral_constant<execution_scope, CoordinationScope>>,
268
+ detail::PropKind::WorkGroupProgress, work_group_progress_key> {
240
269
static constexpr forward_progress_guarantee guarantee = Guarantee;
241
270
static constexpr execution_scope coordinationScope = CoordinationScope;
242
271
};
@@ -246,8 +275,13 @@ template <forward_progress_guarantee Guarantee,
246
275
struct property_value <
247
276
sub_group_progress_key,
248
277
std::integral_constant<forward_progress_guarantee, Guarantee>,
249
- std::integral_constant<execution_scope, CoordinationScope>> {
250
- using key_t = work_group_progress_key;
278
+ std::integral_constant<execution_scope, CoordinationScope>>
279
+ : detail::property_base<
280
+ property_value<
281
+ sub_group_progress_key,
282
+ std::integral_constant<forward_progress_guarantee, Guarantee>,
283
+ std::integral_constant<execution_scope, CoordinationScope>>,
284
+ detail::PropKind::SubGroupProgress, sub_group_progress_key> {
251
285
static constexpr forward_progress_guarantee guarantee = Guarantee;
252
286
static constexpr execution_scope coordinationScope = CoordinationScope;
253
287
};
@@ -257,8 +291,13 @@ template <forward_progress_guarantee Guarantee,
257
291
struct property_value <
258
292
work_item_progress_key,
259
293
std::integral_constant<forward_progress_guarantee, Guarantee>,
260
- std::integral_constant<execution_scope, CoordinationScope>> {
261
- using key_t = work_group_progress_key;
294
+ std::integral_constant<execution_scope, CoordinationScope>>
295
+ : detail::property_base<
296
+ property_value<
297
+ work_item_progress_key,
298
+ std::integral_constant<forward_progress_guarantee, Guarantee>,
299
+ std::integral_constant<execution_scope, CoordinationScope>>,
300
+ detail::PropKind::WorkItemProgress, work_item_progress_key> {
262
301
static constexpr forward_progress_guarantee guarantee = Guarantee;
263
302
static constexpr execution_scope coordinationScope = CoordinationScope;
264
303
};
0 commit comments