Skip to content

Commit 0f9bf8f

Browse files
committed
Move property_list to experimental
Signed-off-by: Steffen Larsen <[email protected]>
1 parent 31d391e commit 0f9bf8f

12 files changed

+209
-160
lines changed

sycl/include/sycl/ext/oneapi/property_list/properties.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ __SYCL_INLINE_NAMESPACE(cl) {
137137
namespace sycl {
138138
namespace ext {
139139
namespace oneapi {
140+
namespace experimental {
140141
namespace detail {
141142

142143
// List of all properties.
@@ -161,6 +162,7 @@ template <typename PropertyT> struct IsRuntimeProperty : std::false_type {};
161162
template <typename PropertyT> struct IsCompileTimeProperty : std::false_type {};
162163

163164
} // namespace detail
165+
} // namespace experimental
164166
} // namespace oneapi
165167
} // namespace ext
166168
} // namespace sycl

sycl/include/sycl/ext/oneapi/property_list/property_list.hpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ __SYCL_INLINE_NAMESPACE(cl) {
2121
namespace sycl {
2222
namespace ext {
2323
namespace oneapi {
24+
namespace experimental {
2425

2526
namespace detail {
2627

@@ -65,10 +66,11 @@ template <typename... Ts> struct RuntimePropertyStorage<std::tuple<Ts...>> {
6566
};
6667
template <typename T, typename... Ts>
6768
struct RuntimePropertyStorage<std::tuple<T, Ts...>>
68-
: detail::conditional_t<IsRuntimeProperty<T>::value,
69-
PrependTuple<T, typename RuntimePropertyStorage<
70-
std::tuple<Ts...>>::type>,
71-
RuntimePropertyStorage<std::tuple<Ts...>>> {};
69+
: sycl::detail::conditional_t<
70+
IsRuntimeProperty<T>::value,
71+
PrependTuple<
72+
T, typename RuntimePropertyStorage<std::tuple<Ts...>>::type>,
73+
RuntimePropertyStorage<std::tuple<Ts...>>> {};
7274

7375
// Helper class to extract a subset of elements from a tuple.
7476
// NOTES: This assumes no duplicate properties and that all properties in the
@@ -127,15 +129,14 @@ template <typename PropertiesT> class property_list {
127129
std::tuple<PropertyValueTs...>{props...})) {}
128130

129131
template <typename PropertyT>
130-
static constexpr detail::enable_if_t<detail::IsProperty<PropertyT>::value,
131-
bool>
132+
static constexpr std::enable_if_t<detail::IsProperty<PropertyT>::value, bool>
132133
has_property() {
133134
return detail::ContainsProperty<PropertyT, PropertiesT>::value;
134135
}
135136

136137
template <typename PropertyT>
137-
typename detail::enable_if_t<detail::IsRuntimeProperty<PropertyT>::value,
138-
PropertyT>
138+
typename std::enable_if_t<detail::IsRuntimeProperty<PropertyT>::value,
139+
PropertyT>
139140
get_property() const {
140141
static_assert(has_property<PropertyT>(),
141142
"Property list does not contain the requested property.");
@@ -183,15 +184,17 @@ inline constexpr bool is_property_list_v =
183184
is_property_list<propertyListT>::value;
184185
#endif
185186

187+
} // namespace experimental
186188
} // namespace oneapi
187189
} // namespace ext
188190

189191
// If property_list is not trivially copyable, allow properties to propagate
190192
// is_device_copyable
191193
template <typename PropertiesT>
192-
struct is_device_copyable<ext::oneapi::property_list<PropertiesT>,
193-
std::enable_if_t<!std::is_trivially_copyable<
194-
ext::oneapi::property_list<PropertiesT>>::value>>
194+
struct is_device_copyable<
195+
ext::oneapi::experimental::property_list<PropertiesT>,
196+
std::enable_if_t<!std::is_trivially_copyable<
197+
ext::oneapi::experimental::property_list<PropertiesT>>::value>>
195198
: is_device_copyable<PropertiesT> {};
196199

197200
} // namespace sycl

sycl/include/sycl/ext/oneapi/property_list/property_utils.hpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ __SYCL_INLINE_NAMESPACE(cl) {
1717
namespace sycl {
1818
namespace ext {
1919
namespace oneapi {
20+
namespace experimental {
2021

2122
// Forward declaration
2223
template <class PropertyT, class T, class... Ts> struct property_value;
@@ -54,9 +55,9 @@ struct AllUnique<std::tuple<Ts...>> : std::true_type {};
5455
template <typename T> struct AllUnique<std::tuple<T>> : std::true_type {};
5556
template <typename L, typename R, typename... Rest>
5657
struct AllUnique<std::tuple<L, R, Rest...>>
57-
: detail::conditional_t<PropertyID<L>::value != PropertyID<R>::value,
58-
AllUnique<std::tuple<R, Rest...>>,
59-
std::false_type> {};
58+
: sycl::detail::conditional_t<PropertyID<L>::value != PropertyID<R>::value,
59+
AllUnique<std::tuple<R, Rest...>>,
60+
std::false_type> {};
6061

6162
//******************************************************************************
6263
// Property identification
@@ -87,9 +88,9 @@ template <typename... Ts>
8788
struct AllPropertyValues<std::tuple<Ts...>> : std::true_type {};
8889
template <typename T, typename... Ts>
8990
struct AllPropertyValues<std::tuple<T, Ts...>>
90-
: detail::conditional_t<IsPropertyValue<T>::value,
91-
AllPropertyValues<std::tuple<Ts...>>,
92-
std::false_type> {};
91+
: sycl::detail::conditional_t<IsPropertyValue<T>::value,
92+
AllPropertyValues<std::tuple<Ts...>>,
93+
std::false_type> {};
9394

9495
//******************************************************************************
9596
// Property type sorting
@@ -208,11 +209,12 @@ struct IsSorted<std::tuple<Ts...>> : std::true_type {};
208209
template <typename T> struct IsSorted<std::tuple<T>> : std::true_type {};
209210
template <typename L, typename R, typename... Rest>
210211
struct IsSorted<std::tuple<L, R, Rest...>>
211-
: detail::conditional_t<PropertyID<L>::value <= PropertyID<R>::value,
212-
IsSorted<std::tuple<R, Rest...>>, std::false_type> {
213-
};
212+
: sycl::detail::conditional_t<PropertyID<L>::value <= PropertyID<R>::value,
213+
IsSorted<std::tuple<R, Rest...>>,
214+
std::false_type> {};
214215

215216
} // namespace detail
217+
} // namespace experimental
216218
} // namespace oneapi
217219
} // namespace ext
218220
} // namespace sycl

sycl/include/sycl/ext/oneapi/property_list/property_value.hpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ __SYCL_INLINE_NAMESPACE(cl) {
1515
namespace sycl {
1616
namespace ext {
1717
namespace oneapi {
18+
namespace experimental {
1819
namespace detail {
1920

2021
// Base class for property values with a single type value.
@@ -31,31 +32,31 @@ template <class T> struct SingleNontypePropertyValueBase {
3132
// Helper class for property values with a single value
3233
template <class T>
3334
struct SinglePropertyValue
34-
: public detail::conditional_t<HasValue<T>::value,
35-
SingleNontypePropertyValueBase<T>,
36-
SingleTypePropertyValueBase> {
35+
: public sycl::detail::conditional_t<HasValue<T>::value,
36+
SingleNontypePropertyValueBase<T>,
37+
SingleTypePropertyValueBase> {
3738
using value_t = T;
3839
};
3940

4041
} // namespace detail
4142

4243
template <class PropertyT, class T = void, class... Ts>
4344
struct property_value
44-
: public detail::conditional_t<
45+
: public sycl::detail::conditional_t<
4546
sizeof...(Ts) == 0 && !std::is_same<T, void>::value,
4647
detail::SinglePropertyValue<T>, detail::EmptyPropertyValueBase> {};
4748

4849
template <class PropertyT, class... A, class... B>
49-
constexpr detail::enable_if_t<detail::IsCompileTimeProperty<PropertyT>::value,
50-
bool>
50+
constexpr std::enable_if_t<detail::IsCompileTimeProperty<PropertyT>::value,
51+
bool>
5152
operator==(const property_value<PropertyT, A...> &LHS,
5253
const property_value<PropertyT, B...> &RHS) {
5354
return (std::is_same<A, B>::value && ...);
5455
}
5556

5657
template <class PropertyT, class... A, class... B>
57-
constexpr detail::enable_if_t<detail::IsCompileTimeProperty<PropertyT>::value,
58-
bool>
58+
constexpr std::enable_if_t<detail::IsCompileTimeProperty<PropertyT>::value,
59+
bool>
5960
operator!=(const property_value<PropertyT, A...> &LHS,
6061
const property_value<PropertyT, B...> &RHS) {
6162
return (!std::is_same<A, B>::value || ...);
@@ -74,6 +75,7 @@ struct IsCompileTimePropertyValue<property_value<PropertyT, PropertyValueTs...>>
7475
: IsCompileTimeProperty<PropertyT> {};
7576

7677
} // namespace detail
78+
} // namespace experimental
7779
} // namespace oneapi
7880
} // namespace ext
7981
} // namespace sycl

sycl/test/extensions/property_list/mock_compile_time_properties.hpp

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
namespace sycl {
1616
namespace ext {
1717
namespace oneapi {
18+
namespace experimental {
1819

1920
struct bar {
2021
using value_t = property_value<bar>;
@@ -89,24 +90,35 @@ inline constexpr bar::value_t bar_v;
8990
template <int K> inline constexpr baz::value_t<K> baz_v;
9091
template <typename... Ts> inline constexpr boo::value_t<Ts...> boo_v;
9192

93+
} // namespace experimental
9294
} // namespace oneapi
9395
} // namespace ext
9496

95-
template <> struct is_property<ext::oneapi::bar> : std::true_type {};
96-
template <> struct is_property<ext::oneapi::baz> : std::true_type {};
97-
template <> struct is_property<ext::oneapi::boo> : std::true_type {};
98-
template <> struct is_property<ext::oneapi::foo> : std::true_type {};
99-
template <> struct is_property<ext::oneapi::foz> : std::true_type {};
97+
template <>
98+
struct is_property<ext::oneapi::experimental::bar> : std::true_type {};
99+
template <>
100+
struct is_property<ext::oneapi::experimental::baz> : std::true_type {};
101+
template <>
102+
struct is_property<ext::oneapi::experimental::boo> : std::true_type {};
103+
template <>
104+
struct is_property<ext::oneapi::experimental::foo> : std::true_type {};
105+
template <>
106+
struct is_property<ext::oneapi::experimental::foz> : std::true_type {};
100107

101108
template <typename syclObjectT>
102-
struct is_property_of<ext::oneapi::bar, syclObjectT> : std::true_type {};
109+
struct is_property_of<ext::oneapi::experimental::bar, syclObjectT>
110+
: std::true_type {};
103111
template <typename syclObjectT>
104-
struct is_property_of<ext::oneapi::baz, syclObjectT> : std::true_type {};
112+
struct is_property_of<ext::oneapi::experimental::baz, syclObjectT>
113+
: std::true_type {};
105114
template <typename syclObjectT>
106-
struct is_property_of<ext::oneapi::boo, syclObjectT> : std::true_type {};
115+
struct is_property_of<ext::oneapi::experimental::boo, syclObjectT>
116+
: std::true_type {};
107117
template <typename syclObjectT>
108-
struct is_property_of<ext::oneapi::foo, syclObjectT> : std::true_type {};
118+
struct is_property_of<ext::oneapi::experimental::foo, syclObjectT>
119+
: std::true_type {};
109120
template <typename syclObjectT>
110-
struct is_property_of<ext::oneapi::foz, syclObjectT> : std::true_type {};
121+
struct is_property_of<ext::oneapi::experimental::foz, syclObjectT>
122+
: std::true_type {};
111123

112124
} // namespace sycl

sycl/test/extensions/property_list/property_list_ctor_negative.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,21 @@
1313

1414
int main() {
1515
#if (TEST_CASE == 1)
16-
auto InvalidPropertyList = sycl::ext::oneapi::property_list(1);
16+
auto InvalidPropertyList = sycl::ext::oneapi::experimental::property_list(1);
1717
// CHECK-ERROR-1: Unrecognized property in property list.
1818
#elif (TEST_CASE == 2)
19-
auto InvalidPropertyList =
20-
sycl::ext::oneapi::property_list(sycl::ext::oneapi::foo{1}, true);
19+
auto InvalidPropertyList = sycl::ext::oneapi::experimental::property_list(
20+
sycl::ext::oneapi::experimental::foo{1}, true);
2121
// CHECK-ERROR-2: Unrecognized property in property list.
2222
#elif (TEST_CASE == 3)
23-
auto InvalidPropertyList = sycl::ext::oneapi::property_list(
24-
sycl::ext::oneapi::foo{0}, sycl::ext::oneapi::foo{1});
23+
auto InvalidPropertyList = sycl::ext::oneapi::experimental::property_list(
24+
sycl::ext::oneapi::experimental::foo{0},
25+
sycl::ext::oneapi::experimental::foo{1});
2526
// CHECK-ERROR-3: Duplicate properties in property list.
2627
#elif (TEST_CASE == 4)
27-
auto InvalidPropertyList = sycl::ext::oneapi::property_list(
28-
sycl::ext::oneapi::bar_v, sycl::ext::oneapi::bar_v);
28+
auto InvalidPropertyList = sycl::ext::oneapi::experimental::property_list(
29+
sycl::ext::oneapi::experimental::bar_v,
30+
sycl::ext::oneapi::experimental::bar_v);
2931
// CHECK-ERROR-4: Duplicate properties in property list.
3032
#endif
3133
}

sycl/test/extensions/property_list/property_list_device_copyable.cpp

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,51 @@ class TestClass2 {};
1313

1414
int main() {
1515
// Check only compile-time properties are device-copyable
16-
using P1 = sycl::ext::oneapi::property_list_t<
17-
sycl::ext::oneapi::baz::value_t<1>,
18-
sycl::ext::oneapi::boo::value_t<TestClass1, TestClass2>,
19-
sycl::ext::oneapi::bar::value_t>;
16+
using P1 = sycl::ext::oneapi::experimental::property_list_t<
17+
sycl::ext::oneapi::experimental::baz::value_t<1>,
18+
sycl::ext::oneapi::experimental::boo::value_t<TestClass1, TestClass2>,
19+
sycl::ext::oneapi::experimental::bar::value_t>;
2020

21-
static_assert(sycl::is_device_copyable_v<sycl::ext::oneapi::baz::value_t<1>>);
2221
static_assert(sycl::is_device_copyable_v<
23-
sycl::ext::oneapi::boo::value_t<TestClass1, TestClass2>>);
24-
static_assert(sycl::is_device_copyable_v<sycl::ext::oneapi::bar::value_t>);
22+
sycl::ext::oneapi::experimental::baz::value_t<1>>);
23+
static_assert(
24+
sycl::is_device_copyable_v<sycl::ext::oneapi::experimental::boo::value_t<
25+
TestClass1, TestClass2>>);
26+
static_assert(sycl::is_device_copyable_v<
27+
sycl::ext::oneapi::experimental::bar::value_t>);
2528
static_assert(sycl::is_device_copyable_v<P1>);
2629

2730
// Check property list with non-device-copyable property
28-
using P2 = sycl::ext::oneapi::property_list_t<sycl::ext::oneapi::bar::value_t,
29-
sycl::ext::oneapi::foz>;
30-
static_assert(!sycl::is_device_copyable_v<sycl::ext::oneapi::foz>);
31+
using P2 = sycl::ext::oneapi::experimental::property_list_t<
32+
sycl::ext::oneapi::experimental::bar::value_t,
33+
sycl::ext::oneapi::experimental::foz>;
34+
static_assert(
35+
!sycl::is_device_copyable_v<sycl::ext::oneapi::experimental::foz>);
3136
static_assert(!sycl::is_device_copyable_v<P2>);
3237

3338
// Check property list with device-copyable compile-time and runtime
3439
// properties
35-
using P3 =
36-
sycl::ext::oneapi::property_list_t<sycl::ext::oneapi::baz::value_t<1>,
37-
sycl::ext::oneapi::foo>;
38-
static_assert(sycl::is_device_copyable_v<sycl::ext::oneapi::foo>);
40+
using P3 = sycl::ext::oneapi::experimental::property_list_t<
41+
sycl::ext::oneapi::experimental::baz::value_t<1>,
42+
sycl::ext::oneapi::experimental::foo>;
43+
static_assert(
44+
sycl::is_device_copyable_v<sycl::ext::oneapi::experimental::foo>);
3945
static_assert(sycl::is_device_copyable_v<P3>);
4046

4147
// Check that device-copyable property list can indeed be used in a kernel
42-
const auto PropertyList = sycl::ext::oneapi::property_list(
43-
sycl::ext::oneapi::baz_v<1>, sycl::ext::oneapi::foo{0});
48+
const auto PropertyList = sycl::ext::oneapi::experimental::property_list(
49+
sycl::ext::oneapi::experimental::baz_v<1>,
50+
sycl::ext::oneapi::experimental::foo{0});
4451

4552
sycl::queue Q;
4653
Q.submit([&](sycl::handler &CGH) {
4754
CGH.single_task([=]() {
48-
decltype(PropertyList)::has_property<sycl::ext::oneapi::baz>();
49-
decltype(PropertyList)::has_property<sycl::ext::oneapi::foo>();
50-
PropertyList.get_property<sycl::ext::oneapi::baz>();
51-
PropertyList.get_property<sycl::ext::oneapi::foo>();
55+
decltype(PropertyList)::has_property<
56+
sycl::ext::oneapi::experimental::baz>();
57+
decltype(PropertyList)::has_property<
58+
sycl::ext::oneapi::experimental::foo>();
59+
PropertyList.get_property<sycl::ext::oneapi::experimental::baz>();
60+
PropertyList.get_property<sycl::ext::oneapi::experimental::foo>();
5261
});
5362
});
5463
}

sycl/test/extensions/property_list/property_list_equality.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
#include "mock_compile_time_properties.hpp"
77

88
int main() {
9-
using P1 =
10-
sycl::ext::oneapi::property_list_t<sycl::ext::oneapi::baz::value_t<1>,
11-
sycl::ext::oneapi::bar::value_t>;
12-
using P2 =
13-
sycl::ext::oneapi::property_list_t<sycl::ext::oneapi::bar::value_t,
14-
sycl::ext::oneapi::baz::value_t<1>>;
9+
using P1 = sycl::ext::oneapi::experimental::property_list_t<
10+
sycl::ext::oneapi::experimental::baz::value_t<1>,
11+
sycl::ext::oneapi::experimental::bar::value_t>;
12+
using P2 = sycl::ext::oneapi::experimental::property_list_t<
13+
sycl::ext::oneapi::experimental::bar::value_t,
14+
sycl::ext::oneapi::experimental::baz::value_t<1>>;
1515
static_assert(std::is_same<P1, P2>::value);
1616
}

0 commit comments

Comments
 (0)