Skip to content

Commit

Permalink
[WIP][SYCL] Use inheritance to implement oneapi properties
Browse files Browse the repository at this point in the history
  • Loading branch information
aelovikov-intel committed Nov 8, 2024
1 parent e68ebeb commit 8fa4d79
Show file tree
Hide file tree
Showing 12 changed files with 686 additions and 652 deletions.
21 changes: 14 additions & 7 deletions sycl/include/sycl/ext/intel/esimd/memory_properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,17 @@ template <typename PropertyListT> struct remove_alignment_property {
};
template <size_t Alignment, typename... LastTs>
struct remove_alignment_property<
properties<std::tuple<alignment_key::value_t<Alignment>, LastTs...>>> {
using type = properties<std::tuple<LastTs...>>;
properties<oneapi::experimental::detail::properties_type_list<
alignment_key::value_t<Alignment>, LastTs...>>> {
using type =
properties<oneapi::experimental::detail::properties_type_list<LastTs...>>;
};
template <typename FirstT, size_t Alignment, typename... LastTs>
struct remove_alignment_property<properties<
std::tuple<FirstT, alignment_key::value_t<Alignment>, LastTs...>>> {
using type = properties<std::tuple<FirstT, LastTs...>>;
struct remove_alignment_property<
properties<oneapi::experimental::detail::properties_type_list<
FirstT, alignment_key::value_t<Alignment>, LastTs...>>> {
using type = properties<
oneapi::experimental::detail::properties_type_list<FirstT, LastTs...>>;
};
template <typename PropertyListT>
using remove_alignment_property_t =
Expand Down Expand Up @@ -323,8 +327,11 @@ struct property_value<__ESIMD_NS::cache_hint_L3_key,

// Declare that esimd::properties is a property_list.
template <typename... PropertyValueTs>
struct is_property_list<__ESIMD_NS::properties<std::tuple<PropertyValueTs...>>>
: is_property_list<properties<std::tuple<PropertyValueTs...>>> {};
struct is_property_list<__ESIMD_NS::properties<
oneapi::experimental::detail::properties_type_list<PropertyValueTs...>>>
: is_property_list<
properties<oneapi::experimental::detail::properties_type_list<
PropertyValueTs...>>> {};

namespace detail {
// We do not override the class ConflictingProperties for cache_hint properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ annotated_arg(T, Args...)
-> annotated_arg<T, typename detail::DeducedProperties<Args...>::type>;

template <typename T, typename old, typename... ArgT>
annotated_arg(annotated_arg<T, old>, properties<std::tuple<ArgT...>>)
annotated_arg(annotated_arg<T, old>,
properties<detail::properties_type_list<ArgT...>>)
-> annotated_arg<
T, detail::merged_properties_t<old, detail::properties_t<ArgT...>>>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ using PropertiesFilter =

// filter properties that are applied on annotations
template <typename... Props>
using annotation_filter = properties<
PropertiesFilter<std::tuple<Props...>, propagateToPtrAnnotation>>;
using annotation_filter =
properties<PropertiesFilter<detail::properties_type_list<Props...>,
propagateToPtrAnnotation>>;
} // namespace detail

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

template <typename T, typename old, typename... ArgT>
annotated_ptr(annotated_ptr<T, old>, properties<std::tuple<ArgT...>>)
annotated_ptr(annotated_ptr<T, old>,
properties<detail::properties_type_list<ArgT...>>)
-> annotated_ptr<
T, detail::merged_properties_t<old, detail::properties_t<ArgT...>>>;
#endif // __cpp_deduction_guides
Expand Down
Loading

0 comments on commit 8fa4d79

Please sign in to comment.