Skip to content

Commit 43149a4

Browse files
committed
Adjust for renaming
Signed-off-by: Steffen Larsen <[email protected]>
1 parent 0f9bf8f commit 43149a4

17 files changed

+461
-273
lines changed

sycl/include/CL/sycl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
#include <sycl/ext/oneapi/filter_selector.hpp>
5858
#include <sycl/ext/oneapi/group_algorithm.hpp>
5959
#include <sycl/ext/oneapi/matrix/matrix.hpp>
60-
#include <sycl/ext/oneapi/property_list/property_list.hpp>
61-
#include <sycl/ext/oneapi/property_list/property_value.hpp>
60+
#include <sycl/ext/oneapi/properties/properties.hpp>
61+
#include <sycl/ext/oneapi/properties/property_value.hpp>
6262
#include <sycl/ext/oneapi/reduction.hpp>
6363
#include <sycl/ext/oneapi/sub_group.hpp>
6464
#include <sycl/ext/oneapi/sub_group_mask.hpp>

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

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//==-------- property_list.hpp --- SYCL extended property list -------------==//
1+
//==---------- properties.hpp --- SYCL extended property list --------------==//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -10,9 +10,9 @@
1010

1111
#include <CL/sycl/detail/property_helper.hpp>
1212
#include <CL/sycl/types.hpp>
13-
#include <sycl/ext/oneapi/property_list/properties.hpp>
14-
#include <sycl/ext/oneapi/property_list/property_utils.hpp>
15-
#include <sycl/ext/oneapi/property_list/property_value.hpp>
13+
#include <sycl/ext/oneapi/properties/property.hpp>
14+
#include <sycl/ext/oneapi/properties/property_utils.hpp>
15+
#include <sycl/ext/oneapi/properties/property_value.hpp>
1616

1717
#include <tuple>
1818
#include <type_traits>
@@ -112,7 +112,7 @@ struct ExtractProperties<std::tuple<PropertyT, PropertiesTs...>> {
112112

113113
} // namespace detail
114114

115-
template <typename PropertiesT> class property_list {
115+
template <typename PropertiesT> class properties {
116116
static_assert(detail::IsTuple<PropertiesT>::value,
117117
"Properties must be in a tuple.");
118118
static_assert(detail::AllPropertyValues<PropertiesT>::value,
@@ -124,7 +124,7 @@ template <typename PropertiesT> class property_list {
124124

125125
public:
126126
template <typename... PropertyValueTs>
127-
property_list(PropertyValueTs... props)
127+
properties(PropertyValueTs... props)
128128
: Storage(detail::ExtractProperties<StorageT>::Extract(
129129
std::tuple<PropertyValueTs...>{props...})) {}
130130

@@ -163,25 +163,21 @@ template <typename PropertiesT> class property_list {
163163
#ifdef __cpp_deduction_guides
164164
// Deduction guides
165165
template <typename... PropertyValueTs>
166-
property_list(PropertyValueTs... props)
167-
-> property_list<typename detail::Sorted<PropertyValueTs...>::type>;
166+
properties(PropertyValueTs... props)
167+
-> properties<typename detail::Sorted<PropertyValueTs...>::type>;
168168
#endif
169169

170-
template <typename... PropertyValueTs>
171-
using property_list_t =
172-
property_list<typename detail::Sorted<PropertyValueTs...>::type>;
173-
174170
// Property list traits
175-
template <typename propertyListT> struct is_property_list : std::false_type {};
171+
template <typename propertiesT> struct is_property_list : std::false_type {};
176172
template <typename... PropertyValueTs>
177-
struct is_property_list<property_list<std::tuple<PropertyValueTs...>>>
178-
: std::is_same<property_list<std::tuple<PropertyValueTs...>>,
179-
property_list_t<PropertyValueTs...>> {};
173+
struct is_property_list<properties<std::tuple<PropertyValueTs...>>>
174+
: std::is_same<
175+
properties<std::tuple<PropertyValueTs...>>,
176+
properties<typename detail::Sorted<PropertyValueTs...>::type>> {};
180177

181178
#if __cplusplus > 201402L
182-
template <typename propertyListT>
183-
inline constexpr bool is_property_list_v =
184-
is_property_list<propertyListT>::value;
179+
template <typename propertiesT>
180+
inline constexpr bool is_property_list_v = is_property_list<propertiesT>::value;
185181
#endif
186182

187183
} // namespace experimental
@@ -192,9 +188,9 @@ inline constexpr bool is_property_list_v =
192188
// is_device_copyable
193189
template <typename PropertiesT>
194190
struct is_device_copyable<
195-
ext::oneapi::experimental::property_list<PropertiesT>,
191+
ext::oneapi::experimental::properties<PropertiesT>,
196192
std::enable_if_t<!std::is_trivially_copyable<
197-
ext::oneapi::experimental::property_list<PropertiesT>>::value>>
193+
ext::oneapi::experimental::properties<PropertiesT>>::value>>
198194
: is_device_copyable<PropertiesT> {};
199195

200196
} // namespace sycl

sycl/include/sycl/ext/oneapi/property_list/properties.hpp renamed to sycl/include/sycl/ext/oneapi/properties/property.hpp

Lines changed: 67 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -7,128 +7,129 @@
77
//===----------------------------------------------------------------------===//
88

99
// HOW-TO: Add new compile-time property
10-
// 1. Add a new enumerator to `sycl::ext::oneapi::detail::PropKind`
11-
// representing the new property. Increment
12-
// `sycl::ext::oneapi::detail::PropKind::PropKindSize`
13-
// 2. Define property class with `value_t` that must be `property_value` with
14-
// the first template argument being the property class itself.
15-
// 3. Add an `inline constexpr` variable in the same namespace as the property.
16-
// The variable should have the same type as `value_t` of the property class
17-
// and should be named as the property class with `_v` appended, e.g. for a
18-
// property `foo`, there should be a definition
19-
// `inline constexpr foo::value_t foo_v`.
20-
// 4. Specialize `sycl::ext::oneapi::detail::PropertyToKind` for the new
21-
// property class. The specialization should have a `Kind` member with the
22-
// value equal to the enumerator added in 1.
23-
// 5. Specialize `sycl::ext::oneapi::detail::IsCompileTimeProperty` for the new
24-
// property class. This specialization should derive from `std::true_type`.
25-
// 6. Specialize `sycl::is_property` and `sycl::is_property_of` for the
26-
// property class.
10+
// 1. Add a new enumerator to
11+
// `sycl::ext::oneapi::experimental::detail::PropKind` representing the new
12+
// property. Increment
13+
// `sycl::ext::oneapi::experimental::detail::PropKind::PropKindSize`
14+
// 2. Define property key class with `value_t` that must be `property_value`
15+
// with the first template argument being the property class itself. The
16+
// name of the key class must be the property name suffixed by `_key`, i.e.
17+
// for a property `foo` the class should be named `foo_key`.
18+
// 3. Add an `inline constexpr` variable in the same namespace as the property
19+
// key. The variable should have the same type as `value_t` of the property
20+
// class, e.g. for a property `foo`, there should be a definition
21+
// `inline constexpr foo_key::value_t foo`.
22+
// 4. Specialize `sycl::ext::oneapi::experimental::is_property` and
23+
// `sycl::ext::oneapi::experimental::is_property_of` for the property key
24+
// class.
25+
// 5. Specialize `sycl::ext::oneapi::experimental::detail::PropertyToKind` for
26+
// the new property key class. The specialization should have a `Kind`
27+
// member with the value equal to the enumerator added in 1.
28+
// 6. Specialize
29+
// `sycl::ext::oneapi::experimental::detail::IsCompileTimeProperty` for the
30+
// new property key class. This specialization should derive from
31+
// `std::true_type`.
2732
/******************************** EXAMPLE **************************************
28-
---------- sycl/include/sycl/ext/oneapi/property_list/properties.hpp -----------
33+
------------- sycl/include/sycl/ext/oneapi/properties/property.hpp -------------
2934
// (1.)
3035
enum PropKind : uint32_t {
3136
...
3237
Bar,
3338
PropKindSize = N + 1, // N was the previous value
3439
};
3540
---------------------- path/to/new/property/file.hpp ---------------------------
36-
namespace sycl {
37-
namespace ext {
38-
namespace oneapi {
41+
namespace sycl::ext::oneapi::experimental {
3942
4043
// (2.)
41-
struct bar {
42-
using value_t = property_value<bar>;
44+
struct bar_key {
45+
using value_t = property_value<bar_key>;
4346
};
4447
4548
// (3.)
46-
inline constexpr bar::value_t bar_v;
49+
inline constexpr bar_key::value_t bar;
50+
51+
// (4.)
52+
template <> struct is_property<bar_key> : std::true_type {};
53+
// Replace SYCL_OBJ with the SYCL object to support the property.
54+
template <> struct is_property_of<bar_key, SYCL_OBJ> : std::true_type {};
4755
4856
namespace detail {
4957
50-
// (4.)
51-
template <> struct PropertyToKind<bar> {
58+
// (5.)
59+
template <> struct PropertyToKind<bar_key> {
5260
static constexpr PropKind Kind = PropKind::Bar;
5361
};
5462
55-
// (5.)
56-
template <> struct IsCompileTimeProperty<bar> : std::true_type {};
57-
58-
} // namespace detail
59-
} // namespace oneapi
60-
} // namespace ext
61-
6263
// (6.)
63-
template <> struct is_property<ext::oneapi::bar> : std::true_type {};
64-
// Replace SYCL_OBJ with the SYCL object to support the property.
65-
template <> struct is_property_of<ext::oneapi::bar, SYCL_OBJ>
66-
: std::true_type {};
64+
template <> struct IsCompileTimeProperty<bar_key> : std::true_type {};
6765
68-
} // namespace sycl
66+
} // namespace detail
67+
} // namespace sycl::ext::oneapi::experimental
6968
*******************************************************************************/
7069

7170
// HOW-TO: Add new runtime property
7271
// 1. Add a new enumerator to `sycl::ext::oneapi::detail::PropKind`
7372
// representing the new property. Increment
74-
// `sycl::ext::oneapi::detail::PropKind::PropKindSize`
73+
// `sycl::ext::oneapi::experimental::detail::PropKind::PropKindSize`
7574
// 2. Define property class.
76-
// 3. Overload the `==` and `!=` operators for the new property class. The
75+
// 3. Declare the property key as an alias to the property class. The name of
76+
// the key class must be the property name suffixed by `_key`, i.e. for a
77+
// property `foo` the class should be named `foo_key`.
78+
// 4. Overload the `==` and `!=` operators for the new property class. The
7779
// comparison should compare all data members of the property class.
78-
// 4. Specialize `sycl::ext::oneapi::detail::PropertyToKind` for the new
80+
// 5. Specialize `sycl::ext::oneapi::experimental::is_property` and
81+
// `sycl::ext::oneapi::experimental::is_property_of` for the property class.
82+
// 6. Specialize `sycl::ext::oneapi::detail::PropertyToKind` for the new
7983
// property class. The specialization should have a `Kind` member with the
8084
// value equal to the enumerator added in 1.
81-
// 5. Specialize `sycl::ext::oneapi::detail::IsRuntimeProperty` for the new
82-
// property class. This specialization should derive from `std::true_type`.
83-
// 6. Specialize `sycl::is_property` and `sycl::is_property_of` for the
84-
// property class.
85+
// 7. Specialize `sycl::ext::oneapi::experimental::detail::IsRuntimeProperty`
86+
// for the new property class. This specialization should derive from
87+
// `std::true_type`.
8588
/******************************* EXAMPLE ***************************************
86-
---------- sycl/include/sycl/ext/oneapi/property_list/properties.hpp -----------
89+
------------- sycl/include/sycl/ext/oneapi/properties/property.hpp -------------
8790
// (1.)
8891
enum PropKind : uint32_t {
8992
...
9093
Foo,
9194
PropKindSize = N + 1, // N was the previous value
9295
};
9396
---------------------- path/to/new/property/file.hpp ---------------------------
94-
namespace sycl {
95-
namespace ext {
96-
namespace oneapi {
97+
namespace sycl::ext::oneapi::experimental {
9798
9899
// (2.)
99100
struct foo {
100101
foo(int v) : value(v) {}
101102
int value;
102103
};
103104
104-
// (3.)
105+
// 3.
106+
using foo_key = foo;
107+
108+
// (4.)
105109
inline bool operator==(const foo &lhs, const foo &rhs) {
106110
return lhs.value == rhs.value;
107111
}
108112
inline bool operator!=(const foo &lhs, const foo &rhs) {
109113
return !(lhs == rhs);
110114
}
111115
116+
// (5.)
117+
template <> struct is_property_key<foo> : std::true_type {};
118+
// Replace SYCL_OBJ with the SYCL object to support the property.
119+
template <> struct is_property_key_of<foo, SYCL_OBJ> : std::true_type {};
120+
112121
namespace detail {
113122
114-
// (4.)
123+
// (6.)
115124
template <> struct PropertyToKind<foo> {
116125
static constexpr PropKind Kind = PropKind::Foo;
117126
};
118127
119-
// (5.)
128+
// (7.)
120129
template <> struct IsRuntimeProperty<foo> : std::true_type {};
121-
} // namespace detail
122-
} // namespace oneapi
123-
} // namespace ext
124-
125-
// (6.)
126-
template <> struct is_property<ext::oneapi::foo> : std::true_type {};
127-
// Replace SYCL_OBJ with the SYCL object to support the property.
128-
template <> struct is_property_of<ext::oneapi::foo, SYCL_OBJ>
129-
: std::true_type {};
130130
131-
} // namespace sycl
131+
} // namespace detail
132+
} // namespace sycl::ext::oneapi::experimental
132133
*******************************************************************************/
133134

134135
#pragma once
@@ -162,6 +163,10 @@ template <typename PropertyT> struct IsRuntimeProperty : std::false_type {};
162163
template <typename PropertyT> struct IsCompileTimeProperty : std::false_type {};
163164

164165
} // namespace detail
166+
167+
template <typename> struct is_property_key : std::false_type {};
168+
template <typename, typename> struct is_property_key_of : std::false_type {};
169+
165170
} // namespace experimental
166171
} // namespace oneapi
167172
} // namespace ext

sycl/include/sycl/ext/oneapi/property_list/property_utils.hpp renamed to sycl/include/sycl/ext/oneapi/properties/property_utils.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#pragma once
1010

1111
#include <CL/sycl/detail/property_helper.hpp>
12-
#include <sycl/ext/oneapi/property_list/properties.hpp>
12+
#include <sycl/ext/oneapi/properties/property.hpp>
1313

1414
#include <tuple>
1515

@@ -20,7 +20,7 @@ namespace oneapi {
2020
namespace experimental {
2121

2222
// Forward declaration
23-
template <class PropertyT, class T, class... Ts> struct property_value;
23+
template <typename PropertyT, typename T, typename... Ts> struct property_value;
2424

2525
namespace detail {
2626

sycl/include/sycl/ext/oneapi/property_list/property_value.hpp renamed to sycl/include/sycl/ext/oneapi/properties/property_value.hpp

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
#pragma once
1010

11-
#include <sycl/ext/oneapi/property_list/properties.hpp>
12-
#include <sycl/ext/oneapi/property_list/property_utils.hpp>
11+
#include <sycl/ext/oneapi/properties/property.hpp>
12+
#include <sycl/ext/oneapi/properties/property_utils.hpp>
1313

1414
__SYCL_INLINE_NAMESPACE(cl) {
1515
namespace sycl {
@@ -25,12 +25,12 @@ struct SingleTypePropertyValueBase {};
2525
struct EmptyPropertyValueBase {};
2626

2727
// Base class for property values with a single non-type value
28-
template <class T> struct SingleNontypePropertyValueBase {
28+
template <typename T> struct SingleNontypePropertyValueBase {
2929
static constexpr auto value = T::value;
3030
};
3131

3232
// Helper class for property values with a single value
33-
template <class T>
33+
template <typename T>
3434
struct SinglePropertyValue
3535
: public sycl::detail::conditional_t<HasValue<T>::value,
3636
SingleNontypePropertyValueBase<T>,
@@ -40,28 +40,46 @@ struct SinglePropertyValue
4040

4141
} // namespace detail
4242

43-
template <class PropertyT, class T = void, class... Ts>
43+
template <typename PropertyT, typename T = void, typename... Ts>
4444
struct property_value
4545
: public sycl::detail::conditional_t<
4646
sizeof...(Ts) == 0 && !std::is_same<T, void>::value,
47-
detail::SinglePropertyValue<T>, detail::EmptyPropertyValueBase> {};
47+
detail::SinglePropertyValue<T>, detail::EmptyPropertyValueBase> {
48+
using key_t = PropertyT;
49+
};
4850

49-
template <class PropertyT, class... A, class... B>
51+
template <typename PropertyT, typename... A, typename... B>
5052
constexpr std::enable_if_t<detail::IsCompileTimeProperty<PropertyT>::value,
5153
bool>
5254
operator==(const property_value<PropertyT, A...> &LHS,
5355
const property_value<PropertyT, B...> &RHS) {
5456
return (std::is_same<A, B>::value && ...);
5557
}
5658

57-
template <class PropertyT, class... A, class... B>
59+
template <typename PropertyT, typename... A, typename... B>
5860
constexpr std::enable_if_t<detail::IsCompileTimeProperty<PropertyT>::value,
5961
bool>
6062
operator!=(const property_value<PropertyT, A...> &LHS,
6163
const property_value<PropertyT, B...> &RHS) {
6264
return (!std::is_same<A, B>::value || ...);
6365
}
6466

67+
template <typename V, typename = void> struct is_property_value {
68+
static constexpr bool value =
69+
detail::IsRuntimeProperty<V>::value && is_property_key<V>::value;
70+
};
71+
template <typename V, typename O, typename = void> struct is_property_value_of {
72+
static constexpr bool value =
73+
detail::IsRuntimeProperty<V>::value && is_property_key_of<V, O>::value;
74+
};
75+
// Specialization for compile-time-constant properties
76+
template <typename V>
77+
struct is_property_value<V, sycl::detail::void_t<typename V::key_t>>
78+
: is_property_key<typename V::key_t> {};
79+
template <typename V, typename O>
80+
struct is_property_value_of<V, O, sycl::detail::void_t<typename V::key_t>>
81+
: is_property_key_of<typename V::key_t, O> {};
82+
6583
namespace detail {
6684

6785
// Specialization of PropertyID for propagating IDs through property_value.

0 commit comments

Comments
 (0)