Skip to content
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
7 changes: 7 additions & 0 deletions sycl/include/sycl/ext/oneapi/properties/property.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@ struct IsCompileTimeProperty
std::is_base_of_v<property_key_base_tag, PropertyT> &&
std::is_base_of_v<compile_time_property_key_base_tag, PropertyT>> {};

// Checks if a type is either a runtime property or if it is a compile-time
// property
template <typename T> struct IsProperty {
static constexpr bool value =
IsRuntimeProperty<T>::value || IsCompileTimeProperty<T>::value;
};

// Trait for property compile-time meta names and values.
template <typename PropertyT> struct PropertyMetaInfo {
// Some properties don't have meaningful compile-time values.
Expand Down
27 changes: 2 additions & 25 deletions sycl/include/sycl/ext/oneapi/properties/property_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#include <sycl/detail/boost/mp11/detail/mp_list.hpp> // for mp_list
#include <sycl/detail/boost/mp11/detail/mp_rename.hpp> // for mp_rename
#include <sycl/detail/boost/mp11/integral.hpp> // for mp_bool
#include <sycl/ext/oneapi/properties/property.hpp> // for PropertyID, IsRun...
#include <sycl/ext/oneapi/properties/property.hpp>
#include <sycl/ext/oneapi/properties/property_value.hpp>

#include <array> // for tuple_element
#include <stddef.h> // for size_t
Expand Down Expand Up @@ -48,34 +49,10 @@ struct PrependTuple<T, std::tuple<Ts...>> {
using type = std::tuple<T, Ts...>;
};

// Checks if a type T has a static value member variable.
template <typename T, typename U = int> struct HasValue : std::false_type {};
template <typename T>
struct HasValue<T, decltype((void)T::value, 0)> : std::true_type {};

//******************************************************************************
// Property identification
//******************************************************************************

// Checks if a type is a compile-time property values.
// Note: This is specialized for property_value elsewhere.
template <typename PropertyT>
struct IsCompileTimePropertyValue : std::false_type {};

// Checks if a type is either a runtime property or if it is a compile-time
// property
template <typename T> struct IsProperty {
static constexpr bool value =
IsRuntimeProperty<T>::value || IsCompileTimeProperty<T>::value;
};

// Checks if a type is a valid property value, i.e either runtime property or
// property_value with a valid compile-time property
template <typename T> struct IsPropertyValue {
static constexpr bool value =
IsRuntimeProperty<T>::value || IsCompileTimePropertyValue<T>::value;
};

// Checks that all types in a tuple are valid properties.
template <typename T> struct AllPropertyValues {};
template <typename... Ts>
Expand Down
18 changes: 15 additions & 3 deletions sycl/include/sycl/ext/oneapi/properties/property_value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

#pragma once

#include <sycl/ext/oneapi/properties/property.hpp> // for IsCompileTi...
#include <sycl/ext/oneapi/properties/property_utils.hpp> // for HasValue
#include <sycl/ext/oneapi/properties/property.hpp>

#include <type_traits> // for enable_if_t

Expand All @@ -18,6 +17,11 @@ inline namespace _V1 {
namespace ext::oneapi::experimental {
namespace detail {

// Checks if a type T has a static value member variable.
template <typename T, typename U = int> struct HasValue : std::false_type {};
template <typename T>
struct HasValue<T, decltype((void)T::value, 0)> : std::true_type {};

// Base class for property values with a single non-type value
template <typename T, typename = void> struct SingleNontypePropertyValueBase {};

Expand Down Expand Up @@ -80,11 +84,19 @@ template <typename PropertyT, typename... PropertyValueTs>
struct PropertyID<property_value<PropertyT, PropertyValueTs...>>
: PropertyID<PropertyT> {};

// Specialization of IsCompileTimePropertyValue for property values.
// Checks if a type is a compile-time property values.
template <typename PropertyT>
struct IsCompileTimePropertyValue : std::false_type {};
template <typename PropertyT, typename... PropertyValueTs>
struct IsCompileTimePropertyValue<property_value<PropertyT, PropertyValueTs...>>
: IsCompileTimeProperty<PropertyT> {};

// Checks if a type is a valid property value, i.e either runtime property or
// property_value with a valid compile-time property
template <typename T> struct IsPropertyValue {
static constexpr bool value =
IsRuntimeProperty<T>::value || IsCompileTimePropertyValue<T>::value;
};
} // namespace detail
} // namespace ext::oneapi::experimental
} // namespace _V1
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/include_deps/sycl_detail_core.hpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@
// CHECK-NEXT: ext/oneapi/device_global/properties.hpp
// CHECK-NEXT: ext/oneapi/properties/property.hpp
// CHECK-NEXT: ext/oneapi/properties/property_value.hpp
// CHECK-NEXT: ext/oneapi/properties/property_utils.hpp
// CHECK-NEXT: ext/oneapi/properties/properties.hpp
// CHECK-NEXT: ext/oneapi/properties/property_utils.hpp
// CHECK-NEXT: ext/oneapi/experimental/graph.hpp
// CHECK-NEXT: handler.hpp
// CHECK-NEXT: detail/cl.h
Expand Down
Loading