Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCL] Remove sycl::ext::oneapi::experimental::is_property_key #16143

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@ inline constexpr read_hint_key::value_t<Cs...> read_hint;
namespace oneapi {
namespace experimental {

template <>
struct is_property_key<intel::experimental::read_hint_key> : std::true_type {};
template <typename T, typename PropertyListT>
struct is_property_key_of<intel::experimental::read_hint_key,
annotated_ptr<T, PropertyListT>> : std::true_type {};
Expand Down Expand Up @@ -261,8 +259,6 @@ inline constexpr write_hint_key::value_t<Cs...> write_hint;
namespace oneapi {
namespace experimental {

template <>
struct is_property_key<intel::experimental::write_hint_key> : std::true_type {};
template <typename T, typename PropertyListT>
struct is_property_key_of<intel::experimental::write_hint_key,
annotated_ptr<T, PropertyListT>> : std::true_type {};
Expand Down Expand Up @@ -336,9 +332,6 @@ inline constexpr read_assertion_key::value_t<Cs...> read_assertion;
namespace oneapi {
namespace experimental {

template <>
struct is_property_key<intel::experimental::read_assertion_key>
: std::true_type {};
template <typename T, typename PropertyListT>
struct is_property_key_of<intel::experimental::read_assertion_key,
annotated_ptr<T, PropertyListT>> : std::true_type {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,6 @@ inline constexpr invocation_capacity_key::value_t<Size> invocation_capacity;
template <uint32_t Size>
inline constexpr response_capacity_key::value_t<Size> response_capacity;

template <> struct is_property_key<balanced_key> : std::true_type {};
template <> struct is_property_key<invocation_capacity_key> : std::true_type {};
template <> struct is_property_key<response_capacity_key> : std::true_type {};

template <auto &f, typename PropertyListT>
struct is_property_key_of<balanced_key, task_sequence<f, PropertyListT>>
: std::true_type {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -688,11 +688,6 @@ inline constexpr implement_in_csr_key::value_t<Enable> implement_in_csr;
inline constexpr implement_in_csr_key::value_t<true> implement_in_csr_on;
inline constexpr implement_in_csr_key::value_t<false> implement_in_csr_off;

template <> struct is_property_key<device_image_scope_key> : std::true_type {};
template <> struct is_property_key<host_access_key> : std::true_type {};
template <> struct is_property_key<init_mode_key> : std::true_type {};
template <> struct is_property_key<implement_in_csr_key> : std::true_type {};

template <typename T, typename PropertyListT>
struct is_property_key_of<device_image_scope_key, device_global<T, PropertyListT>>
: std::true_type {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ struct restrict_key {

inline constexpr restrict_key::value_t restrict;

template<>
struct is_property_key<restrict_key> : std::true_type {};

template<typename T, typename PropertyListT>
struct is_property_key_of<
restrict_key, annotated_ptr<T, PropertyListT>> : std::true_type {};
Expand All @@ -132,9 +129,6 @@ struct alignment_key {
template<int K>
inline constexpr alignment_key::value_t<K> alignment;

template<> struct is_property_key<
sycl::ext::intel::experimental::alignment_key> : std::true_type {};

template<typename T, typename PropertyListT>
struct is_property_key_of<
alignment_key, annotated_ptr<T, PropertyListT>> : std::true_type {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,6 @@ struct build_options {
};
using build_options_key = build_options;

template<>
struct is_property_key<build_options_key> : std::true_type {};

} // namespace sycl::ext::oneapi::experimental
----
!====
Expand Down Expand Up @@ -345,9 +342,6 @@ struct save_log {
};
using save_log_key = save_log;

template<>
struct is_property_key<save_log_key> : std::true_type {};

} // namespace sycl::ext::oneapi::experimental
----
!====
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,6 @@ inline constexpr sub_group_size_key::value_t<Size> sub_group_size;
template <sycl::aspect... Aspects>
inline constexpr device_has_key::value_t<Aspects...> device_has;

template <> struct is_property_key<work_group_size_key> : std::true_type {};
template <> struct is_property_key<work_group_size_hint_key> : std::true_type {};
template <> struct is_property_key<sub_group_size_key> : std::true_type {};
template <> struct is_property_key<device_has_key> : std::true_type {};

} // namespace experimental
} // namespace oneapi
} // namespace ext
Expand Down Expand Up @@ -261,9 +256,6 @@ inline constexpr max_work_group_size_key::value_t<Dims...> max_work_group_size;
template <size_t Size>
inline constexpr max_linear_work_group_size_key::value_t<Size> max_linear_work_group_size;

template <> struct is_property_key<max_work_group_size_key> : std::true_type {};
template <> struct is_property_key<max_linear_work_group_size_key> : std::true_type {};

} // namespace experimental
} // namespace oneapi
} // namespace ext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,39 +199,26 @@ inline constexpr boo_key::value_t<Ts...> boo;

=== Property traits

All runtime and compile-time-constant properties must have a specialization of
`is_property_key` and `is_property_value` that inherits from
`std::true_type`, and they must have a specialization of `is_property_key_of`
and `is_property_value_of`
that inherits from `std::true_type` for each SYCL runtime class that the
property can be applied to. All have a base case which inherits from `std::false_type`.
Properties may add a specialization of `is_property_key_of` that inherits from
`std::true_type` for each SYCL runtime class that the property can be applied
to. All have a base case which inherits from `std::false_type`.

```c++
namespace sycl::ext::oneapi::experimental {
//Base case
template<typename> struct is_property_key : std::false_type {};
template<typename, typename> struct is_property_key_of : std::false_type {};

template<> struct is_property_key<foo_key> : std::true_type {};
template<> struct is_property_key<bar_key> : std::true_type {};

// These properties can be applied to any SYCL object.
template<typename SyclObjectT>
struct is_property_key_of<foo_key, SyclObjectT> : std::true_type {};
template<typename SyclObjectT>
struct is_property_key_of<bar_key, SyclObjectT> : std::true_type {};

// is_property_value and is_property_value_of based on is_property_key(_of)
template<typename V, typename=void> struct is_property_value;
template<typename V, typename O, typename=void> struct is_property_value_of;
// Specialization for runtime properties
template<typename V> struct is_property_value<V, std::enable_if_t<(sizeof(V)>0)>> : is_property_key<V> {};
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> {};
// Specialization for compile-time-constant properties
template<typename V> struct is_property_value<V, std::void_t<typename V::key_t>> :
is_property_key<typename V::key_t> {};
template<typename V, typename O> struct is_property_value_of<V, O, std::void_t<typename V::key_t>> :
is_property_key_of<typename V::key_t, O> {};

// is_property_value is provided by the properties infrastructure in implementation-defined way
template<typename V> struct is_property_value;
// is_property_value_of is based on is_property_key_of, implementation is provided by the properties infrastructure
template<typename V, typename O> struct is_property_value_of;

} // namespace experimental::oneapi::ext::sycl
```
Expand Down Expand Up @@ -636,7 +623,7 @@ This section provides more detailed information for implementers. It is non-norm
Adding a new compile-time constant property requires implementers to introduce the following:

* A new class representing the property key
* Specializations of `sycl::is_property_key` and `sycl::is_property_key_of` for the new property class
* Specialization of `sycl::is_property_key_of` for the new property class
* A global variable that represents an object of the property value

=== Example of a Compile-time Constant Property
Expand All @@ -657,10 +644,6 @@ struct foo_key {
template<int K>
inline constexpr foo::value_t<K> foo;

// foo is a property
template<>
struct is_property_key<foo_key> : std::true_type {};

// foo can be applied to any object
template<typename SyclObjectT>
struct is_property_key_of<foo_key, SyclObjectT> : std::true_type {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,27 +236,6 @@ inline constexpr wait_request_key::value_t<false>

// Type trait specializations
namespace sycl::ext::oneapi::experimental {
template<> struct is_property_key<
sycl::ext::intel::experimental::conduit_key> : std::true_type {};
template<> struct is_property_key<
sycl::ext::intel::experimental::register_map_key> : std::true_type {};
template<> struct is_property_key<
sycl::ext::intel::experimental::stable_key> : std::true_type {};
template<> struct is_property_key<
sycl::ext::intel::experimental::buffer_location_key> : std::true_type {};
template<> struct is_property_key<
sycl::ext::intel::experimental::awidth_key> : std::true_type {};
template<> struct is_property_key<
sycl::ext::intel::experimental::dwidth_key> : std::true_type {};
template<> struct is_property_key<
sycl::ext::intel::experimental::read_write_mode_key> : std::true_type {};
template<> struct is_property_key<
sycl::ext::intel::experimental::latency_key> : std::true_type {};
template<> struct is_property_key<
sycl::ext::intel::experimental::maxburst_key> : std::true_type {};
template<> struct is_property_key<
sycl::ext::intel::experimental::wait_request_key> : std::true_type {};

template <typename T, typename PropertyListT>
struct is_property_key_of<
sycl::ext::intel::experimental::conduit_key,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,6 @@ inline constexpr fpga_cluster_key::value_t<
inline constexpr fpga_cluster_key::value_t<
fpga_cluster_options_enum::stall_free_clusters> stall_free_clusters;

template <> struct is_property_key<streaming_interface_key> : std::true_type {};
template <> struct is_property_key<register_map_interface_key> : std::true_type {};
template <> struct is_property_key<fpga_cluster_key> : std::true_type {};

} // namespace sycl::ext::intel::experimental
```

Expand Down Expand Up @@ -347,4 +343,4 @@ q.single_task(KernelFunctor{a, b, c}).wait();
|1|2022-03-01|Abhishek Tiwari|*Initial public working draft*
|2|2022-12-05|Abhishek Tiwari|*Make pipelined property parameter a signed int*
|3|2024-01-05|Bowen Xue|*Add fpga_cluster property*
|========================================
|========================================
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,6 @@ inline constexpr sub_group_progress_key::value_t<Guarantee, CoordinationScope> s
template <forward_progress_guarantee Guarantee, execution_scope CoordinationScope>
inline constexpr work_item_progress_key::value_t<Guarantee, CoordinationScope> work_item_progress;

template <> struct is_property_key<work_group_progress_key> : std::true_type {};
template <> struct is_property_key<sub_group_progress_key> : std::true_type {};
template <> struct is_property_key<work_item_progress_key> : std::true_type {};

}
----

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@ struct nd_range_kernel_key {
template<int Dims>
inline constexpr nd_range_kernel_key::value_t<Dims> nd_range_kernel;

template<>
struct is_property_key<nd_range_kernel_key> : std::true_type {};

} // namespace sycl::ext::oneapi::experimental
----
!====
Expand Down Expand Up @@ -219,9 +216,6 @@ struct single_task_kernel_key {

inline constexpr single_task_kernel_key::value_t single_task_kernel;

template<>
struct is_property_key<single_task_kernel_key> : std::true_type {};

} // namespace sycl::ext::oneapi::experimental
----
!====
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,6 @@ struct work_group_static_size {

using work_group_static_size_key = work_group_static_size;

template <>struct is_property_key<work_group_static_size_key> : std::true_type {};

} // namespace sycl::ext::oneapi::experimental
----

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ template <int Dim> using cluster_size_key = cluster_size<Dim>;

} // namespace cuda

template <>
struct is_property_key<cuda::cluster_size_key<1>> : std::true_type {};
template <>
struct is_property_key<cuda::cluster_size_key<2>> : std::true_type {};
template <>
struct is_property_key<cuda::cluster_size_key<3>> : std::true_type {};

template <typename T>
struct is_property_key_of<cuda::cluster_size_key<1>, T> : std::true_type {};

Expand All @@ -48,16 +41,6 @@ struct is_property_key_of<cuda::cluster_size_key<2>, T> : std::true_type {};
template <typename T>
struct is_property_key_of<cuda::cluster_size_key<3>, T> : std::true_type {};

template <>
struct is_property_value<cuda::cluster_size_key<1>>
: is_property_key<cuda::cluster_size_key<1>> {};
template <>
struct is_property_value<cuda::cluster_size_key<2>>
: is_property_key<cuda::cluster_size_key<2>> {};
template <>
struct is_property_value<cuda::cluster_size_key<3>>
: is_property_key<cuda::cluster_size_key<3>> {};

template <typename O>
struct is_property_value_of<cuda::cluster_size_key<1>, O>
: is_property_key_of<cuda::cluster_size_key<1>, O> {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,6 @@ template <forward_progress_guarantee Guarantee,
inline constexpr work_item_progress_key::value_t<Guarantee, CoordinationScope>
work_item_progress;

template <> struct is_property_key<work_group_progress_key> : std::true_type {};
template <> struct is_property_key<sub_group_progress_key> : std::true_type {};
template <> struct is_property_key<work_item_progress_key> : std::true_type {};

namespace detail {

template <size_t... Dims>
Expand Down
5 changes: 0 additions & 5 deletions sycl/include/sycl/ext/oneapi/properties/property.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,6 @@ template <typename> struct HasCompileTimeEffect : std::false_type {};

} // namespace detail

template <typename T>
struct is_property_key
: std::bool_constant<!is_property_list_v<T> &&
std::is_base_of_v<detail::property_key_base_tag, T>> {
};
template <typename, typename> struct is_property_key_of : std::false_type {};

} // namespace experimental
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ template <typename T> void checkIsPropertyOf() {
}

int main() {
static_assert(is_property_key<register_map_key>::value);
static_assert(is_property_key<buffer_location_key>::value);

checkIsPropertyOf<decltype(AnnotatedArg1)>();
static_assert(!AnnotatedArg1.has_property<register_map_key>());
static_assert(!AnnotatedArg1.has_property<buffer_location_key>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ template <typename T> void checkIsValidPropertyOfNonPtr() {
}

int main() {
static_assert(is_property_key<register_map_key>::value);
static_assert(is_property_key<buffer_location_key>::value);

checkIsPropertyOf<decltype(AnnotatedPtr1)>();
static_assert(!AnnotatedPtr1.has_property<register_map_key>());
static_assert(!AnnotatedPtr1.has_property<buffer_location_key>());
Expand Down
34 changes: 0 additions & 34 deletions sycl/test/extensions/annotated_usm/fake_properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,40 +133,6 @@ using rt_prop31_key = rt_prop31;
using rt_prop32_key = rt_prop32;
using rt_prop33_key = rt_prop33;

template <> struct is_property_key<rt_prop1_key> : std::true_type {};
template <> struct is_property_key<rt_prop2_key> : std::true_type {};
template <> struct is_property_key<rt_prop3_key> : std::true_type {};
template <> struct is_property_key<rt_prop4_key> : std::true_type {};
template <> struct is_property_key<rt_prop5_key> : std::true_type {};
template <> struct is_property_key<rt_prop6_key> : std::true_type {};
template <> struct is_property_key<rt_prop7_key> : std::true_type {};
template <> struct is_property_key<rt_prop8_key> : std::true_type {};
template <> struct is_property_key<rt_prop9_key> : std::true_type {};
template <> struct is_property_key<rt_prop10_key> : std::true_type {};
template <> struct is_property_key<rt_prop11_key> : std::true_type {};
template <> struct is_property_key<rt_prop12_key> : std::true_type {};
template <> struct is_property_key<rt_prop13_key> : std::true_type {};
template <> struct is_property_key<rt_prop14_key> : std::true_type {};
template <> struct is_property_key<rt_prop15_key> : std::true_type {};
template <> struct is_property_key<rt_prop16_key> : std::true_type {};
template <> struct is_property_key<rt_prop17_key> : std::true_type {};
template <> struct is_property_key<rt_prop18_key> : std::true_type {};
template <> struct is_property_key<rt_prop19_key> : std::true_type {};
template <> struct is_property_key<rt_prop20_key> : std::true_type {};
template <> struct is_property_key<rt_prop21_key> : std::true_type {};
template <> struct is_property_key<rt_prop22_key> : std::true_type {};
template <> struct is_property_key<rt_prop23_key> : std::true_type {};
template <> struct is_property_key<rt_prop24_key> : std::true_type {};
template <> struct is_property_key<rt_prop25_key> : std::true_type {};
template <> struct is_property_key<rt_prop26_key> : std::true_type {};
template <> struct is_property_key<rt_prop27_key> : std::true_type {};
template <> struct is_property_key<rt_prop28_key> : std::true_type {};
template <> struct is_property_key<rt_prop29_key> : std::true_type {};
template <> struct is_property_key<rt_prop30_key> : std::true_type {};
template <> struct is_property_key<rt_prop31_key> : std::true_type {};
template <> struct is_property_key<rt_prop32_key> : std::true_type {};
template <> struct is_property_key<rt_prop33_key> : std::true_type {};

template <typename objectT>
struct is_property_key_of<foo_key, objectT> : std::true_type {};
template <typename objectT>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ template <typename T> void checkIsPropertyOf() {
}

int main() {
static_assert(is_property_key<device_image_scope_key>::value);
static_assert(is_property_key<host_access_key>::value);
static_assert(is_property_key<init_mode_key>::value);
static_assert(is_property_key<implement_in_csr_key>::value);

static_assert(is_property_value<decltype(device_image_scope)>::value);
static_assert(is_property_value<decltype(host_access_read)>::value);
static_assert(is_property_value<decltype(host_access_write)>::value);
Expand Down
Loading
Loading