8
8
#include < numeric>
9
9
#include " KokkosFFT_HIP_types.hpp"
10
10
#include " KokkosFFT_layouts.hpp"
11
+ #include " KokkosFFT_traits.hpp"
11
12
#include " KokkosFFT_asserts.hpp"
12
13
13
14
namespace KokkosFFT {
@@ -22,10 +23,14 @@ auto create_plan(const ExecutionSpace& exec_space,
22
23
std::unique_ptr<PlanType>& plan, const InViewType& in,
23
24
const OutViewType& out, BufferViewType&, InfoType&,
24
25
Direction /* direction*/ , axis_type<1 > axes, shape_type<1 > s) {
25
- static_assert (Kokkos::is_view<InViewType>::value,
26
- " KokkosFFT::create_plan: InViewType is not a Kokkos::View." );
27
- static_assert (Kokkos::is_view<InViewType>::value,
28
- " KokkosFFT::create_plan: OutViewType is not a Kokkos::View." );
26
+ static_assert (
27
+ KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
28
+ OutViewType>,
29
+ " create_plan: InViewType and OutViewType must have the same base "
30
+ " floating point type (float/double), the same layout "
31
+ " (LayoutLeft/LayoutRight), "
32
+ " and the same rank. ExecutionSpace must be accessible to the data in "
33
+ " InViewType and OutViewType." );
29
34
using in_value_type = typename InViewType::non_const_value_type;
30
35
using out_value_type = typename OutViewType::non_const_value_type;
31
36
@@ -60,10 +65,14 @@ auto create_plan(const ExecutionSpace& exec_space,
60
65
std::unique_ptr<PlanType>& plan, const InViewType& in,
61
66
const OutViewType& out, BufferViewType&, InfoType&,
62
67
Direction /* direction*/ , axis_type<2 > axes, shape_type<2 > s) {
63
- static_assert (Kokkos::is_view<InViewType>::value,
64
- " KokkosFFT::create_plan: InViewType is not a Kokkos::View." );
65
- static_assert (Kokkos::is_view<InViewType>::value,
66
- " KokkosFFT::create_plan: OutViewType is not a Kokkos::View." );
68
+ static_assert (
69
+ KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
70
+ OutViewType>,
71
+ " create_plan: InViewType and OutViewType must have the same base "
72
+ " floating point type (float/double), the same layout "
73
+ " (LayoutLeft/LayoutRight), "
74
+ " and the same rank. ExecutionSpace must be accessible to the data in "
75
+ " InViewType and OutViewType." );
67
76
using in_value_type = typename InViewType::non_const_value_type;
68
77
using out_value_type = typename OutViewType::non_const_value_type;
69
78
@@ -98,10 +107,14 @@ auto create_plan(const ExecutionSpace& exec_space,
98
107
std::unique_ptr<PlanType>& plan, const InViewType& in,
99
108
const OutViewType& out, BufferViewType&, InfoType&,
100
109
Direction /* direction*/ , axis_type<3 > axes, shape_type<3 > s) {
101
- static_assert (Kokkos::is_view<InViewType>::value,
102
- " KokkosFFT::create_plan: InViewType is not a Kokkos::View." );
103
- static_assert (Kokkos::is_view<InViewType>::value,
104
- " KokkosFFT::create_plan: OutViewType is not a Kokkos::View." );
110
+ static_assert (
111
+ KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
112
+ OutViewType>,
113
+ " create_plan: InViewType and OutViewType must have the same base "
114
+ " floating point type (float/double), the same layout "
115
+ " (LayoutLeft/LayoutRight), "
116
+ " and the same rank. ExecutionSpace must be accessible to the data in "
117
+ " InViewType and OutViewType." );
105
118
using in_value_type = typename InViewType::non_const_value_type;
106
119
using out_value_type = typename OutViewType::non_const_value_type;
107
120
@@ -139,17 +152,22 @@ auto create_plan(const ExecutionSpace& exec_space,
139
152
const OutViewType& out, BufferViewType&, InfoType&,
140
153
Direction /* direction*/ , axis_type<fft_rank> axes,
141
154
shape_type<fft_rank> s) {
142
- static_assert (Kokkos::is_view<InViewType>::value,
143
- " KokkosFFT::create_plan: InViewType is not a Kokkos::View." );
144
- static_assert (Kokkos::is_view<InViewType>::value,
145
- " KokkosFFT::create_plan: OutViewType is not a Kokkos::View." );
146
- using in_value_type = typename InViewType::non_const_value_type;
147
- using out_value_type = typename OutViewType::non_const_value_type;
155
+ static_assert (
156
+ KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
157
+ OutViewType>,
158
+ " create_plan: InViewType and OutViewType must have the same base "
159
+ " floating point type (float/double), the same layout "
160
+ " (LayoutLeft/LayoutRight), "
161
+ " and the same rank. ExecutionSpace must be accessible to the data in "
162
+ " InViewType and OutViewType." );
148
163
149
164
static_assert (
150
165
InViewType::rank () >= fft_rank,
151
166
" KokkosFFT::create_plan: Rank of View must be larger than Rank of FFT." );
152
- const int rank = fft_rank;
167
+
168
+ using in_value_type = typename InViewType::non_const_value_type;
169
+ using out_value_type = typename OutViewType::non_const_value_type;
170
+ const int rank = fft_rank;
153
171
constexpr auto type =
154
172
KokkosFFT::Impl::transform_type<ExecutionSpace, in_value_type,
155
173
out_value_type>::type ();
0 commit comments