Skip to content

Commit d406037

Browse files
yasahi-hpcYuuichi Asahi
andauthored
Remove unused lines (#139)
* Remove unused argument from exec_impl function * update static assertions in create_plan for each backend * fix: includes in KokkosFFT_*_plans.hpp --------- Co-authored-by: Yuuichi Asahi <[email protected]>
1 parent eaf9e85 commit d406037

File tree

6 files changed

+106
-58
lines changed

6 files changed

+106
-58
lines changed

fft/src/KokkosFFT_Cuda_plans.hpp

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <numeric>
99
#include "KokkosFFT_Cuda_types.hpp"
1010
#include "KokkosFFT_layouts.hpp"
11+
#include "KokkosFFT_traits.hpp"
1112
#include "KokkosFFT_asserts.hpp"
1213

1314
namespace KokkosFFT {
@@ -22,10 +23,14 @@ auto create_plan(const ExecutionSpace& exec_space,
2223
std::unique_ptr<PlanType>& plan, const InViewType& in,
2324
const OutViewType& out, BufferViewType&, InfoType&,
2425
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.");
2934
using in_value_type = typename InViewType::non_const_value_type;
3035
using out_value_type = typename OutViewType::non_const_value_type;
3136

@@ -60,10 +65,14 @@ auto create_plan(const ExecutionSpace& exec_space,
6065
std::unique_ptr<PlanType>& plan, const InViewType& in,
6166
const OutViewType& out, BufferViewType&, InfoType&,
6267
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.");
6776
using in_value_type = typename InViewType::non_const_value_type;
6877
using out_value_type = typename OutViewType::non_const_value_type;
6978

@@ -98,10 +107,14 @@ auto create_plan(const ExecutionSpace& exec_space,
98107
std::unique_ptr<PlanType>& plan, const InViewType& in,
99108
const OutViewType& out, BufferViewType&, InfoType&,
100109
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.");
105118
using in_value_type = typename InViewType::non_const_value_type;
106119
using out_value_type = typename OutViewType::non_const_value_type;
107120

@@ -139,17 +152,22 @@ auto create_plan(const ExecutionSpace& exec_space,
139152
const OutViewType& out, BufferViewType&, InfoType&,
140153
Direction /*direction*/, axis_type<fft_rank> axes,
141154
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.");
148163

149164
static_assert(
150165
InViewType::rank() >= fft_rank,
151166
"KokkosFFT::_create: 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;
153171
constexpr auto type =
154172
KokkosFFT::Impl::transform_type<ExecutionSpace, in_value_type,
155173
out_value_type>::type();

fft/src/KokkosFFT_HIP_plans.hpp

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <numeric>
99
#include "KokkosFFT_HIP_types.hpp"
1010
#include "KokkosFFT_layouts.hpp"
11+
#include "KokkosFFT_traits.hpp"
1112
#include "KokkosFFT_asserts.hpp"
1213

1314
namespace KokkosFFT {
@@ -22,10 +23,14 @@ auto create_plan(const ExecutionSpace& exec_space,
2223
std::unique_ptr<PlanType>& plan, const InViewType& in,
2324
const OutViewType& out, BufferViewType&, InfoType&,
2425
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.");
2934
using in_value_type = typename InViewType::non_const_value_type;
3035
using out_value_type = typename OutViewType::non_const_value_type;
3136

@@ -60,10 +65,14 @@ auto create_plan(const ExecutionSpace& exec_space,
6065
std::unique_ptr<PlanType>& plan, const InViewType& in,
6166
const OutViewType& out, BufferViewType&, InfoType&,
6267
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.");
6776
using in_value_type = typename InViewType::non_const_value_type;
6877
using out_value_type = typename OutViewType::non_const_value_type;
6978

@@ -98,10 +107,14 @@ auto create_plan(const ExecutionSpace& exec_space,
98107
std::unique_ptr<PlanType>& plan, const InViewType& in,
99108
const OutViewType& out, BufferViewType&, InfoType&,
100109
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.");
105118
using in_value_type = typename InViewType::non_const_value_type;
106119
using out_value_type = typename OutViewType::non_const_value_type;
107120

@@ -139,17 +152,22 @@ auto create_plan(const ExecutionSpace& exec_space,
139152
const OutViewType& out, BufferViewType&, InfoType&,
140153
Direction /*direction*/, axis_type<fft_rank> axes,
141154
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.");
148163

149164
static_assert(
150165
InViewType::rank() >= fft_rank,
151166
"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;
153171
constexpr auto type =
154172
KokkosFFT::Impl::transform_type<ExecutionSpace, in_value_type,
155173
out_value_type>::type();

fft/src/KokkosFFT_Host_plans.hpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,22 @@ auto create_plan(const ExecutionSpace& exec_space,
3939
const OutViewType& out, BufferViewType&, InfoType&,
4040
[[maybe_unused]] Direction direction, axis_type<fft_rank> axes,
4141
shape_type<fft_rank> s) {
42-
static_assert(Kokkos::is_view<InViewType>::value,
43-
"KokkosFFT::create_plan: InViewType is not a Kokkos::View.");
44-
static_assert(Kokkos::is_view<InViewType>::value,
45-
"KokkosFFT::create_plan: OutViewType is not a Kokkos::View.");
46-
using in_value_type = typename InViewType::non_const_value_type;
47-
using out_value_type = typename OutViewType::non_const_value_type;
42+
static_assert(
43+
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
44+
OutViewType>,
45+
"create_plan: InViewType and OutViewType must have the same base "
46+
"floating point type (float/double), the same layout "
47+
"(LayoutLeft/LayoutRight), "
48+
"and the same rank. ExecutionSpace must be accessible to the data in "
49+
"InViewType and OutViewType.");
4850

4951
static_assert(
5052
InViewType::rank() >= fft_rank,
5153
"KokkosFFT::create_plan: Rank of View must be larger than Rank of FFT.");
52-
const int rank = fft_rank;
54+
55+
using in_value_type = typename InViewType::non_const_value_type;
56+
using out_value_type = typename OutViewType::non_const_value_type;
57+
const int rank = fft_rank;
5358

5459
init_threads<ExecutionSpace,
5560
KokkosFFT::Impl::base_floating_point_type<in_value_type>>(

fft/src/KokkosFFT_ROCM_plans.hpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <algorithm>
1010
#include "KokkosFFT_ROCM_types.hpp"
1111
#include "KokkosFFT_layouts.hpp"
12+
#include "KokkosFFT_traits.hpp"
1213
#include "KokkosFFT_asserts.hpp"
1314

1415
namespace KokkosFFT {
@@ -92,17 +93,21 @@ auto create_plan(const ExecutionSpace& exec_space,
9293
const OutViewType& out, BufferViewType& buffer,
9394
InfoType& execution_info, Direction direction,
9495
axis_type<fft_rank> axes, shape_type<fft_rank> s) {
95-
static_assert(Kokkos::is_view<InViewType>::value,
96-
"KokkosFFT::create_plan: InViewType is not a Kokkos::View.");
97-
static_assert(Kokkos::is_view<InViewType>::value,
98-
"KokkosFFT::create_plan: OutViewType is not a Kokkos::View.");
99-
using in_value_type = typename InViewType::non_const_value_type;
100-
using out_value_type = typename OutViewType::non_const_value_type;
96+
static_assert(
97+
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
98+
OutViewType>,
99+
"create_plan: InViewType and OutViewType must have the same base "
100+
"floating point type (float/double), the same layout "
101+
"(LayoutLeft/LayoutRight), "
102+
"and the same rank. ExecutionSpace must be accessible to the data in "
103+
"InViewType and OutViewType.");
101104

102105
static_assert(
103106
InViewType::rank() >= fft_rank,
104107
"KokkosFFT::create_plan: Rank of View must be larger than Rank of FFT.");
105108

109+
using in_value_type = typename InViewType::non_const_value_type;
110+
using out_value_type = typename OutViewType::non_const_value_type;
106111
constexpr auto type =
107112
KokkosFFT::Impl::transform_type<ExecutionSpace, in_value_type,
108113
out_value_type>::type();

fft/src/KokkosFFT_SYCL_plans.hpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <algorithm>
1010
#include "KokkosFFT_SYCL_types.hpp"
1111
#include "KokkosFFT_layouts.hpp"
12+
#include "KokkosFFT_traits.hpp"
1213

1314
namespace KokkosFFT {
1415
namespace Impl {
@@ -53,12 +54,14 @@ auto create_plan(const ExecutionSpace& exec_space,
5354
const OutViewType& out, BufferViewType&, InfoType&,
5455
Direction /*direction*/, axis_type<fft_rank> axes,
5556
shape_type<fft_rank> s) {
56-
static_assert(Kokkos::is_view<InViewType>::value,
57-
"KokkosFFT::create_plan: InViewType is not a Kokkos::View.");
58-
static_assert(Kokkos::is_view<InViewType>::value,
59-
"KokkosFFT::create_plan: OutViewType is not a Kokkos::View.");
60-
using in_value_type = typename InViewType::non_const_value_type;
61-
using out_value_type = typename OutViewType::non_const_value_type;
57+
static_assert(
58+
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
59+
OutViewType>,
60+
"create_plan: InViewType and OutViewType must have the same base "
61+
"floating point type (float/double), the same layout "
62+
"(LayoutLeft/LayoutRight), "
63+
"and the same rank. ExecutionSpace must be accessible to the data in "
64+
"InViewType and OutViewType.");
6265

6366
static_assert(
6467
InViewType::rank() >= fft_rank,

fft/src/KokkosFFT_Transform.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ void exec_impl(
7070
template <typename PlanType, typename InViewType, typename OutViewType>
7171
void fft_exec_impl(
7272
const PlanType& plan, const InViewType& in, OutViewType& out,
73-
// KokkosFFT::Direction direction,
7473
KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward) {
7574
using ExecutionSpace = typename PlanType::execSpace;
7675
static_assert(

0 commit comments

Comments
 (0)