Skip to content

Commit fd81264

Browse files
[SYCL] Remove is_property_value/is_property_value_of
The only non-test use was in `syclcompat/traits.hpp` and we can use `detail::AllPropertyValues` that doesn't require each property to specialize the trait.
1 parent 7e2d615 commit fd81264

17 files changed

+13
-387
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_properties.asciidoc

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,10 @@ inline constexpr boo_key::value_t<Ts...> boo;
200200
=== Property traits
201201

202202
All runtime and compile-time-constant properties must have a specialization of
203-
`is_property_key` and `is_property_value` that inherits from
204-
`std::true_type`, and they must have a specialization of `is_property_key_of`
205-
and `is_property_value_of`
206-
that inherits from `std::true_type` for each SYCL runtime class that the
207-
property can be applied to. All have a base case which inherits from `std::false_type`.
203+
`is_property_key` that inherits from `std::true_type`, and they must have a
204+
specialization of `is_property_key_of` that inherits from `std::true_type` for
205+
each SYCL runtime class that the property can be applied to. All have a base
206+
case which inherits from `std::false_type`.
208207

209208
```c++
210209
namespace sycl::ext::oneapi::experimental {
@@ -221,18 +220,6 @@ struct is_property_key_of<foo_key, SyclObjectT> : std::true_type {};
221220
template<typename SyclObjectT>
222221
struct is_property_key_of<bar_key, SyclObjectT> : std::true_type {};
223222

224-
// is_property_value and is_property_value_of based on is_property_key(_of)
225-
template<typename V, typename=void> struct is_property_value;
226-
template<typename V, typename O, typename=void> struct is_property_value_of;
227-
// Specialization for runtime properties
228-
template<typename V> struct is_property_value<V, std::enable_if_t<(sizeof(V)>0)>> : is_property_key<V> {};
229-
template<typename V, typename O> struct is_property_value_of<V, O, std::enable_if_t<(sizeof(V)>0)>> : is_property_key_of<V,O> {};
230-
// Specialization for compile-time-constant properties
231-
template<typename V> struct is_property_value<V, std::void_t<typename V::key_t>> :
232-
is_property_key<typename V::key_t> {};
233-
template<typename V, typename O> struct is_property_value_of<V, O, std::void_t<typename V::key_t>> :
234-
is_property_key_of<typename V::key_t, O> {};
235-
236223
} // namespace experimental::oneapi::ext::sycl
237224
```
238225

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,28 +47,6 @@ struct is_property_key_of<cuda::cluster_size_key<2>, T> : std::true_type {};
4747
template <typename T>
4848
struct is_property_key_of<cuda::cluster_size_key<3>, T> : std::true_type {};
4949

50-
template <>
51-
struct is_property_value<cuda::cluster_size_key<1>>
52-
: is_property_key<cuda::cluster_size_key<1>> {};
53-
template <>
54-
struct is_property_value<cuda::cluster_size_key<2>>
55-
: is_property_key<cuda::cluster_size_key<2>> {};
56-
template <>
57-
struct is_property_value<cuda::cluster_size_key<3>>
58-
: is_property_key<cuda::cluster_size_key<3>> {};
59-
60-
template <typename O>
61-
struct is_property_value_of<cuda::cluster_size_key<1>, O>
62-
: is_property_key_of<cuda::cluster_size_key<1>, O> {};
63-
64-
template <typename O>
65-
struct is_property_value_of<cuda::cluster_size_key<2>, O>
66-
: is_property_key_of<cuda::cluster_size_key<2>, O> {};
67-
68-
template <typename O>
69-
struct is_property_value_of<cuda::cluster_size_key<3>, O>
70-
: is_property_key_of<cuda::cluster_size_key<3>, O> {};
71-
7250
namespace detail {
7351
template <typename PropertiesT> constexpr std::size_t getClusterDim() {
7452
if constexpr (PropertiesT::template has_property<

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,6 @@ operator!=(const property_value<PropertyT, A...> &,
5757
return (!std::is_same<A, B>::value || ...);
5858
}
5959

60-
template <typename V, typename = void> struct is_property_value {
61-
static constexpr bool value =
62-
detail::IsRuntimeProperty<V>::value && is_property_key<V>::value;
63-
};
64-
template <typename V, typename O, typename = void> struct is_property_value_of {
65-
static constexpr bool value =
66-
detail::IsRuntimeProperty<V>::value && is_property_key_of<V, O>::value;
67-
};
68-
// Specialization for compile-time-constant properties
69-
template <typename V>
70-
struct is_property_value<V, std::void_t<typename V::key_t>>
71-
: is_property_key<typename V::key_t> {};
72-
template <typename V, typename O>
73-
struct is_property_value_of<V, O, std::void_t<typename V::key_t>>
74-
: is_property_key_of<typename V::key_t, O> {};
75-
7660
namespace detail {
7761

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

sycl/include/syclcompat/traits.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,9 @@ inline constexpr bool is_launch_policy_v = is_launch_policy<T>::value;
249249

250250
// Trait to detect if all args are sycl_exp property types
251251
template <typename... Args>
252-
using are_all_props = std::conjunction<
253-
sycl::ext::oneapi::experimental::is_property_value<Args>...>;
252+
using are_all_props =
253+
sycl::ext::oneapi::experimental::detail::AllPropertyValues<
254+
std::tuple<Args...>>;
254255

255256
} // namespace experimental::detail
256257

sycl/test/extensions/annotated_arg/annotated_arg_properties.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static annotated_arg<int *, decltype(properties(buffer_location<1>,
1818

1919
struct A {};
2020

21-
// Checks is_property_key_of and is_property_value_of for T.
21+
// Checks is_property_key_of for T.
2222
template <typename T> void checkIsPropertyOf() {
2323
static_assert(is_property_key_of<register_map_key, T>::value);
2424
static_assert(is_property_key_of<conduit_key, T>::value);
@@ -31,19 +31,6 @@ template <typename T> void checkIsPropertyOf() {
3131
static_assert(is_property_key_of<read_write_mode_key, T>::value);
3232
static_assert(is_property_key_of<maxburst_key, T>::value);
3333
static_assert(is_property_key_of<wait_request_key, T>::value);
34-
35-
static_assert(is_property_value_of<decltype(register_map), T>::value);
36-
static_assert(is_property_value_of<decltype(conduit), T>::value);
37-
static_assert(is_property_value_of<decltype(stable), T>::value);
38-
39-
static_assert(is_property_value_of<decltype(buffer_location<1>), T>::value);
40-
static_assert(is_property_value_of<decltype(awidth<2>), T>::value);
41-
static_assert(is_property_value_of<decltype(dwidth<8>), T>::value);
42-
static_assert(is_property_value_of<decltype(latency<0>), T>::value);
43-
static_assert(is_property_value_of<decltype(read_write_mode_read), T>::value);
44-
static_assert(is_property_value_of<decltype(maxburst<1>), T>::value);
45-
static_assert(
46-
is_property_value_of<decltype(wait_request_requested), T>::value);
4734
}
4835

4936
int main() {

sycl/test/extensions/annotated_ptr/annotated_ptr_properties.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ static annotated_ptr<int, decltype(properties(buffer_location<1>,
1616

1717
struct A {};
1818

19-
// Checks is_property_key_of and is_property_value_of for T.
19+
// Checks is_property_key_of for T.
2020
template <typename T> void checkIsPropertyOf() {
2121
static_assert(is_property_key_of<register_map_key, T>::value);
2222
static_assert(is_property_key_of<conduit_key, T>::value);
@@ -29,23 +29,9 @@ template <typename T> void checkIsPropertyOf() {
2929
static_assert(is_property_key_of<read_write_mode_key, T>::value);
3030
static_assert(is_property_key_of<maxburst_key, T>::value);
3131
static_assert(is_property_key_of<wait_request_key, T>::value);
32-
33-
static_assert(is_property_value_of<decltype(register_map), T>::value);
34-
static_assert(is_property_value_of<decltype(conduit), T>::value);
35-
static_assert(is_property_value_of<decltype(stable), T>::value);
36-
37-
static_assert(is_property_value_of<decltype(buffer_location<1>), T>::value);
38-
static_assert(is_property_value_of<decltype(awidth<2>), T>::value);
39-
static_assert(is_property_value_of<decltype(dwidth<8>), T>::value);
40-
static_assert(is_property_value_of<decltype(latency<0>), T>::value);
41-
static_assert(is_property_value_of<decltype(read_write_mode_read), T>::value);
42-
static_assert(is_property_value_of<decltype(maxburst<1>), T>::value);
43-
static_assert(
44-
is_property_value_of<decltype(wait_request_requested), T>::value);
4532
}
4633

47-
// Checks is_property_key_of and is_property_value_of are false for non-pointer
48-
// type T.
34+
// Checks is_property_key_of is false for non-pointer type T.
4935
template <typename T> void checkIsValidPropertyOfNonPtr() {
5036
static_assert(
5137
is_valid_property<T, decltype(wait_request_not_requested)>::value ==

sycl/test/extensions/device_global/device_global_properties.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,12 @@ static device_global<int, decltype(properties(
2525
device_image_scope, init_mode_reprogram))>
2626
DeviceGlobal5;
2727

28-
// Checks is_property_key_of and is_property_value_of for T.
28+
// Checks is_property_key_of for T.
2929
template <typename T> void checkIsPropertyOf() {
3030
static_assert(is_property_key_of<device_image_scope_key, T>::value);
3131
static_assert(is_property_key_of<host_access_key, T>::value);
3232
static_assert(is_property_key_of<init_mode_key, T>::value);
3333
static_assert(is_property_key_of<implement_in_csr_key, T>::value);
34-
35-
static_assert(is_property_value_of<decltype(device_image_scope), T>::value);
36-
static_assert(is_property_value_of<decltype(host_access_read), T>::value);
37-
static_assert(is_property_value_of<decltype(host_access_write), T>::value);
38-
static_assert(
39-
is_property_value_of<decltype(host_access_read_write), T>::value);
40-
static_assert(is_property_value_of<decltype(host_access_none), T>::value);
41-
static_assert(is_property_value_of<decltype(init_mode_reset), T>::value);
42-
static_assert(is_property_value_of<decltype(init_mode_reprogram), T>::value);
43-
static_assert(is_property_value_of<decltype(implement_in_csr_on), T>::value);
44-
static_assert(is_property_value_of<decltype(implement_in_csr_off), T>::value);
4534
}
4635

4736
int main() {
@@ -50,16 +39,6 @@ int main() {
5039
static_assert(is_property_key<init_mode_key>::value);
5140
static_assert(is_property_key<implement_in_csr_key>::value);
5241

53-
static_assert(is_property_value<decltype(device_image_scope)>::value);
54-
static_assert(is_property_value<decltype(host_access_read)>::value);
55-
static_assert(is_property_value<decltype(host_access_write)>::value);
56-
static_assert(is_property_value<decltype(host_access_read_write)>::value);
57-
static_assert(is_property_value<decltype(host_access_none)>::value);
58-
static_assert(is_property_value<decltype(init_mode_reset)>::value);
59-
static_assert(is_property_value<decltype(init_mode_reprogram)>::value);
60-
static_assert(is_property_value<decltype(implement_in_csr_on)>::value);
61-
static_assert(is_property_value<decltype(implement_in_csr_off)>::value);
62-
6342
checkIsPropertyOf<decltype(DeviceGlobal1)>();
6443
static_assert(DeviceGlobal1.has_property<device_image_scope_key>());
6544
static_assert(!DeviceGlobal1.has_property<host_access_key>());

sycl/test/extensions/fpga_mem/fpga_mem_properties.cpp

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static intel::fpga_mem<int, decltype(oneapi::properties(
2222
intel::bi_directional_ports_true))>
2323
mem_multi;
2424

25-
// Checks is_property_key_of and oneapi::is_property_value_of for T.
25+
// Checks is_property_key_of for T.
2626
template <typename T> void checkIsPropertyOf() {
2727
static_assert(oneapi::is_property_key_of<intel::resource_key, T>::value);
2828
static_assert(oneapi::is_property_key_of<intel::num_banks_key, T>::value);
@@ -51,34 +51,6 @@ int main() {
5151
static_assert(oneapi::is_property_key<intel::max_private_copies_key>::value);
5252
static_assert(oneapi::is_property_key<intel::num_replicates_key>::value);
5353

54-
// Are all common values usable
55-
static_assert(
56-
oneapi::is_property_value<decltype(intel::resource_mlab)>::value);
57-
static_assert(
58-
oneapi::is_property_value<decltype(intel::resource_block_ram)>::value);
59-
static_assert(
60-
oneapi::is_property_value<decltype(intel::num_banks<8>)>::value);
61-
static_assert(
62-
oneapi::is_property_value<decltype(intel::stride_size<8>)>::value);
63-
static_assert(
64-
oneapi::is_property_value<decltype(intel::word_size<32>)>::value);
65-
static_assert(oneapi::is_property_value<
66-
decltype(intel::bi_directional_ports_false)>::value);
67-
static_assert(oneapi::is_property_value<
68-
decltype(intel::bi_directional_ports_true)>::value);
69-
static_assert(
70-
oneapi::is_property_value<decltype(intel::clock_2x_false)>::value);
71-
static_assert(
72-
oneapi::is_property_value<decltype(intel::clock_2x_true)>::value);
73-
static_assert(
74-
oneapi::is_property_value<decltype(intel::ram_stitching_min_ram)>::value);
75-
static_assert(oneapi::is_property_value<
76-
decltype(intel::ram_stitching_max_fmax)>::value);
77-
static_assert(
78-
oneapi::is_property_value<decltype(intel::max_private_copies<8>)>::value);
79-
static_assert(
80-
oneapi::is_property_value<decltype(intel::num_replicates<8>)>::value);
81-
8254
// Check that only the property that are expected are associated with obj
8355
checkIsPropertyOf<decltype(mem_num)>();
8456
static_assert(mem_num.has_property<intel::num_banks_key>());

sycl/test/extensions/properties/properties_device_global.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,6 @@ int main() {
1717
static_assert(is_property_key<init_mode_key>::value);
1818
static_assert(is_property_key<implement_in_csr_key>::value);
1919

20-
// Check that is_property_value is correctly specialized.
21-
static_assert(is_property_value<decltype(device_image_scope)>::value);
22-
static_assert(is_property_value<decltype(host_access<TestAccess>)>::value);
23-
static_assert(is_property_value<decltype(host_access_read)>::value);
24-
static_assert(is_property_value<decltype(host_access_write)>::value);
25-
static_assert(is_property_value<decltype(host_access_read_write)>::value);
26-
static_assert(is_property_value<decltype(host_access_none)>::value);
27-
static_assert(is_property_value<decltype(init_mode<TestTrigger>)>::value);
28-
static_assert(is_property_value<decltype(init_mode_reprogram)>::value);
29-
static_assert(is_property_value<decltype(init_mode_reset)>::value);
30-
static_assert(is_property_value<decltype(implement_in_csr<true>)>::value);
31-
static_assert(is_property_value<decltype(implement_in_csr_on)>::value);
32-
static_assert(is_property_value<decltype(implement_in_csr_off)>::value);
33-
3420
// Checks that fully specialized properties are the same as the templated
3521
// variants.
3622
static_assert(std::is_same_v<decltype(host_access_read),

sycl/test/extensions/properties/properties_is_property_value.cpp

Lines changed: 0 additions & 90 deletions
This file was deleted.

0 commit comments

Comments
 (0)