@@ -60,13 +60,15 @@ struct device_has_key
6060 std::integral_constant<aspect, Aspects>...>;
6161};
6262
63- struct nd_range_kernel_key {
63+ struct nd_range_kernel_key
64+ : detail::compile_time_property_key<detail::PropKind::NDRangeKernel> {
6465 template <int Dims>
6566 using value_t =
6667 property_value<nd_range_kernel_key, std::integral_constant<int , Dims>>;
6768};
6869
69- struct single_task_kernel_key {
70+ struct single_task_kernel_key
71+ : detail::compile_time_property_key<detail::PropKind::SingleTaskKernel> {
7072 using value_t = property_value<single_task_kernel_key>;
7173};
7274
@@ -87,15 +89,18 @@ struct max_linear_work_group_size_key
8789
8890template <size_t Dim0, size_t ... Dims>
8991struct 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> {
9198 static_assert (
9299 sizeof ...(Dims) + 1 <= 3 ,
93100 " work_group_size property currently only supports up to three values." );
94101 static_assert (detail::AllNonZero<Dim0, Dims...>::value,
95102 " work_group_size property must only contain non-zero values." );
96103
97- using key_t = work_group_size_key;
98-
99104 constexpr size_t operator [](int Dim) const {
100105 return std::array<size_t , sizeof ...(Dims) + 1 >{Dim0, Dims...}[Dim];
101106 }
@@ -104,75 +109,94 @@ struct property_value<work_group_size_key, std::integral_constant<size_t, Dim0>,
104109template <size_t Dim0, size_t ... Dims>
105110struct property_value <work_group_size_hint_key,
106111 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> {
108118 static_assert (sizeof ...(Dims) + 1 <= 3 ,
109119 " work_group_size_hint property currently "
110120 " only supports up to three values." );
111121 static_assert (
112122 detail::AllNonZero<Dim0, Dims...>::value,
113123 " work_group_size_hint property must only contain non-zero values." );
114124
115- using key_t = work_group_size_hint_key;
116-
117125 constexpr size_t operator [](int Dim) const {
118126 return std::array<size_t , sizeof ...(Dims) + 1 >{Dim0, Dims...}[Dim];
119127 }
120128};
121129
122130template <uint32_t Size>
123131struct 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> {
125137 static_assert (Size != 0 ,
126138 " sub_group_size_key property must contain a non-zero value." );
127139
128- using key_t = sub_group_size_key;
129140 using value_t = std::integral_constant<uint32_t , Size>;
130141 static constexpr uint32_t value = Size;
131142};
132143
133144template <aspect... Aspects>
134145struct 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> {
137151 static constexpr std::array<aspect, sizeof ...(Aspects)> value{Aspects...};
138152};
139153
140154template <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> {
142160 static_assert (
143161 Dims >= 1 && Dims <= 3 ,
144162 " nd_range_kernel_key property must use dimension of 1, 2 or 3." );
145163
146- using key_t = nd_range_kernel_key;
147164 using value_t = int ;
148165 static constexpr int dimensions = Dims;
149166};
150167
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> {};
154173
155174template <size_t Dim0, size_t ... Dims>
156175struct property_value <max_work_group_size_key,
157176 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> {
159183 static_assert (sizeof ...(Dims) + 1 <= 3 ,
160184 " max_work_group_size property currently "
161185 " only supports up to three values." );
162186 static_assert (
163187 detail::AllNonZero<Dim0, Dims...>::value,
164188 " max_work_group_size property must only contain non-zero values." );
165189
166- using key_t = max_work_group_size_key;
167-
168190 constexpr size_t operator [](int Dim) const {
169191 return std::array<size_t , sizeof ...(Dims) + 1 >{Dim0, Dims...}[Dim];
170192 }
171193};
172194
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> {};
176200
177201template <size_t Dim0, size_t ... Dims>
178202inline constexpr work_group_size_key::value_t <Dim0, Dims...> work_group_size;
@@ -235,8 +259,13 @@ template <forward_progress_guarantee Guarantee,
235259struct property_value <
236260 work_group_progress_key,
237261 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> {
240269 static constexpr forward_progress_guarantee guarantee = Guarantee;
241270 static constexpr execution_scope coordinationScope = CoordinationScope;
242271};
@@ -246,8 +275,13 @@ template <forward_progress_guarantee Guarantee,
246275struct property_value <
247276 sub_group_progress_key,
248277 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> {
251285 static constexpr forward_progress_guarantee guarantee = Guarantee;
252286 static constexpr execution_scope coordinationScope = CoordinationScope;
253287};
@@ -257,8 +291,13 @@ template <forward_progress_guarantee Guarantee,
257291struct property_value <
258292 work_item_progress_key,
259293 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> {
262301 static constexpr forward_progress_guarantee guarantee = Guarantee;
263302 static constexpr execution_scope coordinationScope = CoordinationScope;
264303};
0 commit comments