@@ -19,16 +19,16 @@ template <typename Set>
19
19
inline constexpr indirectly_callable_key::value_t <Set> indirectly_callable_in;
20
20
21
21
struct calls_indirectly_key {
22
- template <typename First = void , typename ... SetIds>
22
+ template <typename ... SetIds>
23
23
using value_t =
24
24
sycl::ext::oneapi::experimental::property_value<calls_indirectly_key,
25
- First, SetIds...>;
25
+ SetIds...>;
26
26
};
27
27
28
28
inline constexpr calls_indirectly_key::value_t <void > assume_indirect_calls;
29
29
30
- template <typename First, typename ... Rest >
31
- inline constexpr calls_indirectly_key::value_t <First, Rest ...>
30
+ template <typename ... SetIds >
31
+ inline constexpr calls_indirectly_key::value_t <SetIds ...>
32
32
assume_indirect_calls_to;
33
33
34
34
template <> struct is_property_key <indirectly_callable_key> : std::true_type {};
@@ -60,16 +60,54 @@ struct PropertyMetaInfo<indirectly_callable_key::value_t<Set>> {
60
60
#endif
61
61
};
62
62
63
- template <typename First, typename ... Rest>
64
- struct PropertyMetaInfo <calls_indirectly_key::value_t <First, Rest...>> {
65
- static_assert (
66
- sizeof ...(Rest) == 0 ,
67
- " assume_indirect_calls_to property only supports a single set for now" );
63
+ // Helper to concatenate several lists of characters into a single string.
64
+ // Lists are separated from each other with comma within the resulting string.
65
+ template <typename List, typename ... Rest> struct ConcatenateCharsToStr ;
66
+
67
+ // Specialization for a single list
68
+ template <char ... Chars> struct ConcatenateCharsToStr <CharList<Chars...>> {
69
+ static constexpr char value[] = {Chars..., ' \0 ' };
70
+ };
71
+
72
+ // Specialization for two lists
73
+ template <char ... Chars, char ... CharsToAppend>
74
+ struct ConcatenateCharsToStr <CharList<Chars...>, CharList<CharsToAppend...>>
75
+ : ConcatenateCharsToStr<CharList<Chars..., ' ,' , CharsToAppend...>> {};
76
+
77
+ // Specialization for the case when there are more than two lists
78
+ template <char ... Chars, char ... CharsToAppend, typename ... Rest>
79
+ struct ConcatenateCharsToStr <CharList<Chars...>, CharList<CharsToAppend...>,
80
+ Rest...>
81
+ : ConcatenateCharsToStr<CharList<Chars..., ' ,' , CharsToAppend...>,
82
+ Rest...> {};
83
+
84
+ // Helper to convert type T to a list of characters representing the type (its
85
+ // mangled name).
86
+ template <typename T, size_t ... Indices> struct StableNameToCharsHelper {
87
+ #ifdef __SYCL_DEVICE_ONLY__
88
+ using chars = CharList<__builtin_sycl_unique_stable_name(T)[Indices]...>;
89
+ #else
90
+ using chars = CharList<>;
91
+ #endif
92
+ };
93
+
94
+ // Wrapper helper for the struct above
95
+ template <typename T, typename Sequence> struct StableNameToChars ;
96
+
97
+ // Specialization of that wrapper helper which accepts sequence of integers
98
+ template <typename T, size_t ... Indices>
99
+ struct StableNameToChars <T, std::integer_sequence<size_t , Indices...>>
100
+ : StableNameToCharsHelper<T, Indices...> {};
101
+
102
+ template <typename ... SetIds>
103
+ struct PropertyMetaInfo <calls_indirectly_key::value_t <SetIds...>> {
68
104
static constexpr const char *name = " calls-indirectly" ;
69
105
static constexpr const char *value =
70
106
#ifdef __SYCL_DEVICE_ONLY__
71
- // FIXME: we should handle Rest... here as well
72
- __builtin_sycl_unique_stable_name (First);
107
+ ConcatenateCharsToStr<typename StableNameToChars<
108
+ SetIds,
109
+ std::make_index_sequence<__builtin_strlen(
110
+ __builtin_sycl_unique_stable_name (SetIds))>>::chars...>::value;
73
111
#else
74
112
" " ;
75
113
#endif
0 commit comments