diff --git a/fft/src/KokkosFFT_Cuda_plans.hpp b/fft/src/KokkosFFT_Cuda_plans.hpp index 3b532673..3b84bed3 100644 --- a/fft/src/KokkosFFT_Cuda_plans.hpp +++ b/fft/src/KokkosFFT_Cuda_plans.hpp @@ -8,6 +8,7 @@ #include #include "KokkosFFT_Cuda_types.hpp" #include "KokkosFFT_layouts.hpp" +#include "KokkosFFT_traits.hpp" #include "KokkosFFT_asserts.hpp" namespace KokkosFFT { @@ -22,10 +23,14 @@ auto create_plan(const ExecutionSpace& exec_space, std::unique_ptr& plan, const InViewType& in, const OutViewType& out, BufferViewType&, InfoType&, Direction /*direction*/, axis_type<1> axes, shape_type<1> s) { - static_assert(Kokkos::is_view::value, - "KokkosFFT::create_plan: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "KokkosFFT::create_plan: OutViewType is not a Kokkos::View."); + static_assert( + KokkosFFT::Impl::are_operatable_views_v, + "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; @@ -60,10 +65,14 @@ auto create_plan(const ExecutionSpace& exec_space, std::unique_ptr& plan, const InViewType& in, const OutViewType& out, BufferViewType&, InfoType&, Direction /*direction*/, axis_type<2> axes, shape_type<2> s) { - static_assert(Kokkos::is_view::value, - "KokkosFFT::create_plan: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "KokkosFFT::create_plan: OutViewType is not a Kokkos::View."); + static_assert( + KokkosFFT::Impl::are_operatable_views_v, + "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; @@ -98,10 +107,14 @@ auto create_plan(const ExecutionSpace& exec_space, std::unique_ptr& plan, const InViewType& in, const OutViewType& out, BufferViewType&, InfoType&, Direction /*direction*/, axis_type<3> axes, shape_type<3> s) { - static_assert(Kokkos::is_view::value, - "KokkosFFT::create_plan: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "KokkosFFT::create_plan: OutViewType is not a Kokkos::View."); + static_assert( + KokkosFFT::Impl::are_operatable_views_v, + "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; @@ -139,17 +152,22 @@ auto create_plan(const ExecutionSpace& exec_space, const OutViewType& out, BufferViewType&, InfoType&, Direction /*direction*/, axis_type axes, shape_type s) { - static_assert(Kokkos::is_view::value, - "KokkosFFT::create_plan: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::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, + "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::type(); diff --git a/fft/src/KokkosFFT_HIP_plans.hpp b/fft/src/KokkosFFT_HIP_plans.hpp index 3c781ec4..77cfe3e4 100644 --- a/fft/src/KokkosFFT_HIP_plans.hpp +++ b/fft/src/KokkosFFT_HIP_plans.hpp @@ -8,6 +8,7 @@ #include #include "KokkosFFT_HIP_types.hpp" #include "KokkosFFT_layouts.hpp" +#include "KokkosFFT_traits.hpp" #include "KokkosFFT_asserts.hpp" namespace KokkosFFT { @@ -22,10 +23,14 @@ auto create_plan(const ExecutionSpace& exec_space, std::unique_ptr& plan, const InViewType& in, const OutViewType& out, BufferViewType&, InfoType&, Direction /*direction*/, axis_type<1> axes, shape_type<1> s) { - static_assert(Kokkos::is_view::value, - "KokkosFFT::create_plan: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "KokkosFFT::create_plan: OutViewType is not a Kokkos::View."); + static_assert( + KokkosFFT::Impl::are_operatable_views_v, + "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; @@ -60,10 +65,14 @@ auto create_plan(const ExecutionSpace& exec_space, std::unique_ptr& plan, const InViewType& in, const OutViewType& out, BufferViewType&, InfoType&, Direction /*direction*/, axis_type<2> axes, shape_type<2> s) { - static_assert(Kokkos::is_view::value, - "KokkosFFT::create_plan: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "KokkosFFT::create_plan: OutViewType is not a Kokkos::View."); + static_assert( + KokkosFFT::Impl::are_operatable_views_v, + "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; @@ -98,10 +107,14 @@ auto create_plan(const ExecutionSpace& exec_space, std::unique_ptr& plan, const InViewType& in, const OutViewType& out, BufferViewType&, InfoType&, Direction /*direction*/, axis_type<3> axes, shape_type<3> s) { - static_assert(Kokkos::is_view::value, - "KokkosFFT::create_plan: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::value, - "KokkosFFT::create_plan: OutViewType is not a Kokkos::View."); + static_assert( + KokkosFFT::Impl::are_operatable_views_v, + "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; @@ -139,17 +152,22 @@ auto create_plan(const ExecutionSpace& exec_space, const OutViewType& out, BufferViewType&, InfoType&, Direction /*direction*/, axis_type axes, shape_type s) { - static_assert(Kokkos::is_view::value, - "KokkosFFT::create_plan: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::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, + "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::type(); diff --git a/fft/src/KokkosFFT_Host_plans.hpp b/fft/src/KokkosFFT_Host_plans.hpp index 44070993..a18c21bd 100644 --- a/fft/src/KokkosFFT_Host_plans.hpp +++ b/fft/src/KokkosFFT_Host_plans.hpp @@ -39,17 +39,22 @@ auto create_plan(const ExecutionSpace& exec_space, const OutViewType& out, BufferViewType&, InfoType&, [[maybe_unused]] Direction direction, axis_type axes, shape_type s) { - static_assert(Kokkos::is_view::value, - "KokkosFFT::create_plan: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::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, + "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>( diff --git a/fft/src/KokkosFFT_ROCM_plans.hpp b/fft/src/KokkosFFT_ROCM_plans.hpp index fec5141d..e26cbd22 100644 --- a/fft/src/KokkosFFT_ROCM_plans.hpp +++ b/fft/src/KokkosFFT_ROCM_plans.hpp @@ -9,6 +9,7 @@ #include #include "KokkosFFT_ROCM_types.hpp" #include "KokkosFFT_layouts.hpp" +#include "KokkosFFT_traits.hpp" #include "KokkosFFT_asserts.hpp" namespace KokkosFFT { @@ -92,17 +93,21 @@ auto create_plan(const ExecutionSpace& exec_space, const OutViewType& out, BufferViewType& buffer, InfoType& execution_info, Direction direction, axis_type axes, shape_type s) { - static_assert(Kokkos::is_view::value, - "KokkosFFT::create_plan: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::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, + "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::type(); diff --git a/fft/src/KokkosFFT_SYCL_plans.hpp b/fft/src/KokkosFFT_SYCL_plans.hpp index 8e9fdcd6..2c9b3a91 100644 --- a/fft/src/KokkosFFT_SYCL_plans.hpp +++ b/fft/src/KokkosFFT_SYCL_plans.hpp @@ -9,6 +9,7 @@ #include #include "KokkosFFT_SYCL_types.hpp" #include "KokkosFFT_layouts.hpp" +#include "KokkosFFT_traits.hpp" namespace KokkosFFT { namespace Impl { @@ -53,12 +54,14 @@ auto create_plan(const ExecutionSpace& exec_space, const OutViewType& out, BufferViewType&, InfoType&, Direction /*direction*/, axis_type axes, shape_type s) { - static_assert(Kokkos::is_view::value, - "KokkosFFT::create_plan: InViewType is not a Kokkos::View."); - static_assert(Kokkos::is_view::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, + "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, diff --git a/fft/src/KokkosFFT_Transform.hpp b/fft/src/KokkosFFT_Transform.hpp index 38fa12a6..a3224acb 100644 --- a/fft/src/KokkosFFT_Transform.hpp +++ b/fft/src/KokkosFFT_Transform.hpp @@ -70,7 +70,6 @@ void exec_impl( template 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(