Skip to content

Commit

Permalink
Remove unused lines (#139)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
yasahi-hpc and Yuuichi Asahi authored Sep 27, 2024
1 parent eaf9e85 commit d406037
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 58 deletions.
56 changes: 37 additions & 19 deletions fft/src/KokkosFFT_Cuda_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <numeric>
#include "KokkosFFT_Cuda_types.hpp"
#include "KokkosFFT_layouts.hpp"
#include "KokkosFFT_traits.hpp"
#include "KokkosFFT_asserts.hpp"

namespace KokkosFFT {
Expand All @@ -22,10 +23,14 @@ auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<1> axes, shape_type<1> s) {
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: InViewType is not a Kokkos::View.");
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: OutViewType is not a Kokkos::View.");
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
"create_plan: InViewType and OutViewType must have the same base "
"floating point type (float/double), the same layout "
"(LayoutLeft/LayoutRight), "
"and the same rank. ExecutionSpace must be accessible to the data in "
"InViewType and OutViewType.");
using in_value_type = typename InViewType::non_const_value_type;
using out_value_type = typename OutViewType::non_const_value_type;

Expand Down Expand Up @@ -60,10 +65,14 @@ auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<2> axes, shape_type<2> s) {
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: InViewType is not a Kokkos::View.");
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: OutViewType is not a Kokkos::View.");
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
"create_plan: InViewType and OutViewType must have the same base "
"floating point type (float/double), the same layout "
"(LayoutLeft/LayoutRight), "
"and the same rank. ExecutionSpace must be accessible to the data in "
"InViewType and OutViewType.");
using in_value_type = typename InViewType::non_const_value_type;
using out_value_type = typename OutViewType::non_const_value_type;

Expand Down Expand Up @@ -98,10 +107,14 @@ auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<3> axes, shape_type<3> s) {
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: InViewType is not a Kokkos::View.");
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: OutViewType is not a Kokkos::View.");
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
"create_plan: InViewType and OutViewType must have the same base "
"floating point type (float/double), the same layout "
"(LayoutLeft/LayoutRight), "
"and the same rank. ExecutionSpace must be accessible to the data in "
"InViewType and OutViewType.");
using in_value_type = typename InViewType::non_const_value_type;
using out_value_type = typename OutViewType::non_const_value_type;

Expand Down Expand Up @@ -139,17 +152,22 @@ auto create_plan(const ExecutionSpace& exec_space,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<fft_rank> axes,
shape_type<fft_rank> s) {
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: InViewType is not a Kokkos::View.");
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: OutViewType is not a Kokkos::View.");
using in_value_type = typename InViewType::non_const_value_type;
using out_value_type = typename OutViewType::non_const_value_type;
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
"create_plan: InViewType and OutViewType must have the same base "
"floating point type (float/double), the same layout "
"(LayoutLeft/LayoutRight), "
"and the same rank. ExecutionSpace must be accessible to the data in "
"InViewType and OutViewType.");

static_assert(
InViewType::rank() >= fft_rank,
"KokkosFFT::_create: Rank of View must be larger than Rank of FFT.");
const int rank = fft_rank;

using in_value_type = typename InViewType::non_const_value_type;
using out_value_type = typename OutViewType::non_const_value_type;
const int rank = fft_rank;
constexpr auto type =
KokkosFFT::Impl::transform_type<ExecutionSpace, in_value_type,
out_value_type>::type();
Expand Down
56 changes: 37 additions & 19 deletions fft/src/KokkosFFT_HIP_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <numeric>
#include "KokkosFFT_HIP_types.hpp"
#include "KokkosFFT_layouts.hpp"
#include "KokkosFFT_traits.hpp"
#include "KokkosFFT_asserts.hpp"

namespace KokkosFFT {
Expand All @@ -22,10 +23,14 @@ auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<1> axes, shape_type<1> s) {
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: InViewType is not a Kokkos::View.");
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: OutViewType is not a Kokkos::View.");
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
"create_plan: InViewType and OutViewType must have the same base "
"floating point type (float/double), the same layout "
"(LayoutLeft/LayoutRight), "
"and the same rank. ExecutionSpace must be accessible to the data in "
"InViewType and OutViewType.");
using in_value_type = typename InViewType::non_const_value_type;
using out_value_type = typename OutViewType::non_const_value_type;

Expand Down Expand Up @@ -60,10 +65,14 @@ auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<2> axes, shape_type<2> s) {
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: InViewType is not a Kokkos::View.");
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: OutViewType is not a Kokkos::View.");
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
"create_plan: InViewType and OutViewType must have the same base "
"floating point type (float/double), the same layout "
"(LayoutLeft/LayoutRight), "
"and the same rank. ExecutionSpace must be accessible to the data in "
"InViewType and OutViewType.");
using in_value_type = typename InViewType::non_const_value_type;
using out_value_type = typename OutViewType::non_const_value_type;

Expand Down Expand Up @@ -98,10 +107,14 @@ auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<3> axes, shape_type<3> s) {
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: InViewType is not a Kokkos::View.");
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: OutViewType is not a Kokkos::View.");
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
"create_plan: InViewType and OutViewType must have the same base "
"floating point type (float/double), the same layout "
"(LayoutLeft/LayoutRight), "
"and the same rank. ExecutionSpace must be accessible to the data in "
"InViewType and OutViewType.");
using in_value_type = typename InViewType::non_const_value_type;
using out_value_type = typename OutViewType::non_const_value_type;

Expand Down Expand Up @@ -139,17 +152,22 @@ auto create_plan(const ExecutionSpace& exec_space,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<fft_rank> axes,
shape_type<fft_rank> s) {
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: InViewType is not a Kokkos::View.");
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: OutViewType is not a Kokkos::View.");
using in_value_type = typename InViewType::non_const_value_type;
using out_value_type = typename OutViewType::non_const_value_type;
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
"create_plan: InViewType and OutViewType must have the same base "
"floating point type (float/double), the same layout "
"(LayoutLeft/LayoutRight), "
"and the same rank. ExecutionSpace must be accessible to the data in "
"InViewType and OutViewType.");

static_assert(
InViewType::rank() >= fft_rank,
"KokkosFFT::create_plan: Rank of View must be larger than Rank of FFT.");
const int rank = fft_rank;

using in_value_type = typename InViewType::non_const_value_type;
using out_value_type = typename OutViewType::non_const_value_type;
const int rank = fft_rank;
constexpr auto type =
KokkosFFT::Impl::transform_type<ExecutionSpace, in_value_type,
out_value_type>::type();
Expand Down
19 changes: 12 additions & 7 deletions fft/src/KokkosFFT_Host_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,22 @@ auto create_plan(const ExecutionSpace& exec_space,
const OutViewType& out, BufferViewType&, InfoType&,
[[maybe_unused]] Direction direction, axis_type<fft_rank> axes,
shape_type<fft_rank> s) {
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: InViewType is not a Kokkos::View.");
static_assert(Kokkos::is_view<InViewType>::value,
"KokkosFFT::create_plan: OutViewType is not a Kokkos::View.");
using in_value_type = typename InViewType::non_const_value_type;
using out_value_type = typename OutViewType::non_const_value_type;
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
"create_plan: InViewType and OutViewType must have the same base "
"floating point type (float/double), the same layout "
"(LayoutLeft/LayoutRight), "
"and the same rank. ExecutionSpace must be accessible to the data in "
"InViewType and OutViewType.");

static_assert(
InViewType::rank() >= fft_rank,
"KokkosFFT::create_plan: Rank of View must be larger than Rank of FFT.");
const int rank = fft_rank;

using in_value_type = typename InViewType::non_const_value_type;
using out_value_type = typename OutViewType::non_const_value_type;
const int rank = fft_rank;

init_threads<ExecutionSpace,
KokkosFFT::Impl::base_floating_point_type<in_value_type>>(
Expand Down
17 changes: 11 additions & 6 deletions fft/src/KokkosFFT_ROCM_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <algorithm>
#include "KokkosFFT_ROCM_types.hpp"
#include "KokkosFFT_layouts.hpp"
#include "KokkosFFT_traits.hpp"
#include "KokkosFFT_asserts.hpp"

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

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

using in_value_type = typename InViewType::non_const_value_type;
using out_value_type = typename OutViewType::non_const_value_type;
constexpr auto type =
KokkosFFT::Impl::transform_type<ExecutionSpace, in_value_type,
out_value_type>::type();
Expand Down
15 changes: 9 additions & 6 deletions fft/src/KokkosFFT_SYCL_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <algorithm>
#include "KokkosFFT_SYCL_types.hpp"
#include "KokkosFFT_layouts.hpp"
#include "KokkosFFT_traits.hpp"

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

static_assert(
InViewType::rank() >= fft_rank,
Expand Down
1 change: 0 additions & 1 deletion fft/src/KokkosFFT_Transform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ void exec_impl(
template <typename PlanType, typename InViewType, typename OutViewType>
void fft_exec_impl(
const PlanType& plan, const InViewType& in, OutViewType& out,
// KokkosFFT::Direction direction,
KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward) {
using ExecutionSpace = typename PlanType::execSpace;
static_assert(
Expand Down

0 comments on commit d406037

Please sign in to comment.