Skip to content

Commit

Permalink
Add mssing execution_space type check
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuuichi Asahi committed Jul 15, 2024
1 parent cd58de7 commit 0d675d4
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions common/src/KokkosFFT_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ struct is_admissible_value_type<

template <typename T>
struct is_admissible_value_type<
T, std::enable_if_t<Kokkos::is_view<T>::value &&
T, std::enable_if_t<Kokkos::is_view_v<T> &&
(is_real_v<typename T::non_const_value_type> ||
is_complex_v<typename T::non_const_value_type>)>>
: std::true_type {};

/// \brief Helper to check if a type is an acceptable value type
/// (float/double/Kokkos::complex<float>/Kokkos::complex<double>) for Kokkos-FFT
/// When applied to Kokkos::View, then check if a value type is an
/// acceptable real/complex type.
/// When applied to Kokkos::View, then check if a value type is an acceptable
/// real/complex type.
template <typename T>
inline constexpr bool is_admissible_value_type_v =
is_admissible_value_type<T>::value;
Expand All @@ -83,7 +83,7 @@ template <typename ViewType>
struct is_layout_left_or_right<
ViewType,
std::enable_if_t<
Kokkos::is_view<ViewType>::value &&
Kokkos::is_view_v<ViewType> &&
(std::is_same_v<typename ViewType::array_layout, Kokkos::LayoutLeft> ||
std::is_same_v<typename ViewType::array_layout, Kokkos::LayoutRight>)>>
: std::true_type {};
Expand All @@ -99,7 +99,7 @@ struct is_admissible_view : std::false_type {};

template <typename ViewType>
struct is_admissible_view<
ViewType, std::enable_if_t<Kokkos::is_view<ViewType>::value &&
ViewType, std::enable_if_t<Kokkos::is_view_v<ViewType> &&
is_layout_left_or_right_v<ViewType> &&
is_admissible_value_type_v<ViewType>>>
: std::true_type {};
Expand All @@ -117,14 +117,14 @@ template <typename ExecutionSpace, typename ViewType>
struct is_operatable_view<
ExecutionSpace, ViewType,
std::enable_if_t<
Kokkos::is_execution_space_v<ExecutionSpace> &&
is_admissible_view_v<ViewType> &&
Kokkos::SpaceAccessibility<
ExecutionSpace, typename ViewType::memory_space>::accessible>>
: std::true_type {};

/// \brief Helper to check if a View is an acceptable View for Kokkos-FFT and
/// memory space
/// is accessible from the ExecutionSpace
/// memory space is accessible from the ExecutionSpace
template <typename ExecutionSpace, typename ViewType>
inline constexpr bool is_operatable_view_v =
is_operatable_view<ExecutionSpace, ViewType>::value;
Expand All @@ -136,8 +136,7 @@ struct have_same_precision : std::false_type {};
template <typename T1, typename T2>
struct have_same_precision<
T1, T2,
std::enable_if_t<!Kokkos::is_view<T1>::value &&
!Kokkos::is_view<T2>::value &&
std::enable_if_t<!Kokkos::is_view_v<T1> && !Kokkos::is_view_v<T2> &&
std::is_same_v<base_floating_point_type<T1>,
base_floating_point_type<T2>>>>
: std::true_type {};
Expand All @@ -146,17 +145,16 @@ template <typename InViewType, typename OutViewType>
struct have_same_precision<
InViewType, OutViewType,
std::enable_if_t<
Kokkos::is_view<InViewType>::value &&
Kokkos::is_view<OutViewType>::value &&
Kokkos::is_view_v<InViewType> && Kokkos::is_view_v<OutViewType> &&
std::is_same_v<
base_floating_point_type<typename InViewType::non_const_value_type>,
base_floating_point_type<
typename OutViewType::non_const_value_type>>>>
: std::true_type {};

/// \brief Helper to check if two value have the same base precision type.
/// When applied to Kokkos::View, then check if values of views have the
/// same base precision type.
/// When applied to Kokkos::View, then check if values of views have the same
/// base precision type.
template <typename T1, typename T2>
inline constexpr bool have_same_precision_v =
have_same_precision<T1, T2>::value;
Expand All @@ -167,8 +165,8 @@ struct have_same_layout : std::false_type {};
template <typename InViewType, typename OutViewType>
struct have_same_layout<
InViewType, OutViewType,
std::enable_if_t<Kokkos::is_view<InViewType>::value &&
Kokkos::is_view<OutViewType>::value &&
std::enable_if_t<Kokkos::is_view_v<InViewType> &&
Kokkos::is_view_v<OutViewType> &&
std::is_same_v<typename InViewType::array_layout,
typename OutViewType::array_layout>>>
: std::true_type {};
Expand All @@ -184,8 +182,8 @@ struct have_same_rank : std::false_type {};
template <typename InViewType, typename OutViewType>
struct have_same_rank<
InViewType, OutViewType,
std::enable_if_t<Kokkos::is_view<InViewType>::value &&
Kokkos::is_view<OutViewType>::value &&
std::enable_if_t<Kokkos::is_view_v<InViewType> &&
Kokkos::is_view_v<OutViewType> &&
InViewType::rank() == OutViewType::rank()>>
: std::true_type {};

Expand Down

0 comments on commit 0d675d4

Please sign in to comment.