Skip to content

Commit 61d963b

Browse files
[SYCL] Use inheritance to implement oneapi properties (#16024)
This is based on @rolandschulz 's #13776. The only remaining boost/mp11 usage is to sort/filter properties, I'm going to remove that in a separate PRs. I've also left multiple utilities (that accept variadic pack) still using `std::tuple` as *their* implementation detail. That can be cleaned up separately as well. Closes #13677.
1 parent 797177b commit 61d963b

File tree

13 files changed

+687
-653
lines changed

13 files changed

+687
-653
lines changed

sycl/include/sycl/ext/intel/esimd/memory_properties.hpp

+14-7
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,17 @@ template <typename PropertyListT> struct remove_alignment_property {
238238
};
239239
template <size_t Alignment, typename... LastTs>
240240
struct remove_alignment_property<
241-
properties<std::tuple<alignment_key::value_t<Alignment>, LastTs...>>> {
242-
using type = properties<std::tuple<LastTs...>>;
241+
properties<oneapi::experimental::detail::properties_type_list<
242+
alignment_key::value_t<Alignment>, LastTs...>>> {
243+
using type =
244+
properties<oneapi::experimental::detail::properties_type_list<LastTs...>>;
243245
};
244246
template <typename FirstT, size_t Alignment, typename... LastTs>
245-
struct remove_alignment_property<properties<
246-
std::tuple<FirstT, alignment_key::value_t<Alignment>, LastTs...>>> {
247-
using type = properties<std::tuple<FirstT, LastTs...>>;
247+
struct remove_alignment_property<
248+
properties<oneapi::experimental::detail::properties_type_list<
249+
FirstT, alignment_key::value_t<Alignment>, LastTs...>>> {
250+
using type = properties<
251+
oneapi::experimental::detail::properties_type_list<FirstT, LastTs...>>;
248252
};
249253
template <typename PropertyListT>
250254
using remove_alignment_property_t =
@@ -323,8 +327,11 @@ struct property_value<__ESIMD_NS::cache_hint_L3_key,
323327

324328
// Declare that esimd::properties is a property_list.
325329
template <typename... PropertyValueTs>
326-
struct is_property_list<__ESIMD_NS::properties<std::tuple<PropertyValueTs...>>>
327-
: is_property_list<properties<std::tuple<PropertyValueTs...>>> {};
330+
struct is_property_list<__ESIMD_NS::properties<
331+
oneapi::experimental::detail::properties_type_list<PropertyValueTs...>>>
332+
: is_property_list<
333+
properties<oneapi::experimental::detail::properties_type_list<
334+
PropertyValueTs...>>> {};
328335

329336
namespace detail {
330337
// We do not override the class ConflictingProperties for cache_hint properties

sycl/include/sycl/ext/oneapi/experimental/annotated_arg/annotated_arg.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ annotated_arg(T, Args...)
6666
-> annotated_arg<T, typename detail::DeducedProperties<Args...>::type>;
6767

6868
template <typename T, typename old, typename... ArgT>
69-
annotated_arg(annotated_arg<T, old>, properties<std::tuple<ArgT...>>)
69+
annotated_arg(annotated_arg<T, old>,
70+
properties<detail::properties_type_list<ArgT...>>)
7071
-> annotated_arg<
7172
T, detail::merged_properties_t<old, detail::properties_t<ArgT...>>>;
7273

sycl/include/sycl/ext/oneapi/experimental/annotated_ptr/annotated_ptr.hpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ using PropertiesFilter =
6161

6262
// filter properties that are applied on annotations
6363
template <typename... Props>
64-
using annotation_filter = properties<
65-
PropertiesFilter<std::tuple<Props...>, propagateToPtrAnnotation>>;
64+
using annotation_filter =
65+
properties<PropertiesFilter<detail::properties_type_list<Props...>,
66+
propagateToPtrAnnotation>>;
6667
} // namespace detail
6768

6869
template <typename I, typename P> struct annotationHelper {};
@@ -245,7 +246,8 @@ annotated_ptr(T *, Args...)
245246
-> annotated_ptr<T, typename detail::DeducedProperties<Args...>::type>;
246247

247248
template <typename T, typename old, typename... ArgT>
248-
annotated_ptr(annotated_ptr<T, old>, properties<std::tuple<ArgT...>>)
249+
annotated_ptr(annotated_ptr<T, old>,
250+
properties<detail::properties_type_list<ArgT...>>)
249251
-> annotated_ptr<
250252
T, detail::merged_properties_t<old, detail::properties_t<ArgT...>>>;
251253
#endif // __cpp_deduction_guides

sycl/include/sycl/ext/oneapi/experimental/work_group_memory.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class __SYCL_SPECIAL_CLASS __SYCL_TYPE(work_group_memory) work_group_memory
7777
void __init(decoratedPtr ptr) { this->ptr = ptr; }
7878
#endif
7979
private:
80-
decoratedPtr ptr;
80+
decoratedPtr ptr = nullptr;
8181
};
8282
} // namespace ext::oneapi::experimental
8383
} // namespace _V1

0 commit comments

Comments
 (0)