diff --git a/fft/src/KokkosFFT_Cuda_plans.hpp b/fft/src/KokkosFFT_Cuda_plans.hpp index 3b532673..4b49ac44 100644 --- a/fft/src/KokkosFFT_Cuda_plans.hpp +++ b/fft/src/KokkosFFT_Cuda_plans.hpp @@ -22,10 +22,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 +64,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 +106,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 +151,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..e2d0a294 100644 --- a/fft/src/KokkosFFT_HIP_plans.hpp +++ b/fft/src/KokkosFFT_HIP_plans.hpp @@ -22,10 +22,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 +64,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 +106,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 +151,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..e18aae8d 100644 --- a/fft/src/KokkosFFT_Host_plans.hpp +++ b/fft/src/KokkosFFT_Host_plans.hpp @@ -9,6 +9,7 @@ #include "KokkosFFT_default_types.hpp" #include "KokkosFFT_layouts.hpp" #include "KokkosFFT_traits.hpp" +#include "KokkosFFT_asserts.hpp" namespace KokkosFFT { namespace Impl { @@ -39,17 +40,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..d44a0512 100644 --- a/fft/src/KokkosFFT_ROCM_plans.hpp +++ b/fft/src/KokkosFFT_ROCM_plans.hpp @@ -92,17 +92,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..3abbb2c5 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_asserts.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,