Skip to content

Commit

Permalink
remove unused variables for SYCL plan creatation
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuuichi Asahi committed Dec 3, 2024
1 parent e7ed6aa commit c25dd85
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 41 deletions.
16 changes: 4 additions & 12 deletions fft/src/KokkosFFT_SYCL_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,14 @@ auto compute_strides(std::vector<InType>& extents) -> std::vector<OutType> {
// batched transform, over ND Views
template <
typename ExecutionSpace, typename PlanType, typename InViewType,
typename OutViewType, typename BufferViewType, typename InfoType,
std::size_t fft_rank = 1,
typename OutViewType, std::size_t fft_rank = 1,
std::enable_if_t<std::is_same_v<ExecutionSpace, Kokkos::Experimental::SYCL>,
std::nullptr_t> = nullptr>
auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
Direction /*direction*/, axis_type<fft_rank> axes,
shape_type<fft_rank> s, bool is_inplace) {
const OutViewType& out, Direction /*direction*/,
axis_type<fft_rank> axes, shape_type<fft_rank> s,
bool is_inplace) {
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
OutViewType>,
Expand Down Expand Up @@ -110,13 +109,6 @@ auto create_plan(const ExecutionSpace& exec_space,
return fft_size;
}

template <
typename ExecutionSpace, typename PlanType, typename InfoType,
std::enable_if_t<std::is_same_v<ExecutionSpace, Kokkos::Experimental::SYCL>,
std::nullptr_t> = nullptr>
void destroy_plan_and_info(std::unique_ptr<PlanType>&, InfoType&) {
// In oneMKL, plans are destroybed by destructor
}
} // namespace Impl
} // namespace KokkosFFT

Expand Down
39 changes: 10 additions & 29 deletions fft/src/KokkosFFT_SYCL_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
#include "KokkosFFT_common_types.hpp"
#include "KokkosFFT_utils.hpp"

#if defined(ENABLE_HOST_AND_DEVICE)
#include "KokkosFFT_FFTW_Types.hpp"
#endif

// Check the size of complex type
// [TO DO] I guess this kind of test is already made by Kokkos itself
static_assert(sizeof(std::complex<float>) == sizeof(Kokkos::complex<float>));
Expand All @@ -21,26 +25,15 @@ static_assert(sizeof(std::complex<double>) == sizeof(Kokkos::complex<double>));
static_assert(alignof(std::complex<double>) <=
alignof(Kokkos::complex<double>));

#ifdef ENABLE_HOST_AND_DEVICE
#include <fftw3.h>
static_assert(sizeof(fftwf_complex) == sizeof(Kokkos::complex<float>));
static_assert(alignof(fftwf_complex) <= alignof(Kokkos::complex<float>));

static_assert(sizeof(fftw_complex) == sizeof(Kokkos::complex<double>));
static_assert(alignof(fftw_complex) <= alignof(Kokkos::complex<double>));
#endif

namespace KokkosFFT {
namespace Impl {
using FFTDirectionType = int;
constexpr FFTDirectionType MKL_FFT_FORWARD = 1;
constexpr FFTDirectionType MKL_FFT_BACKWARD = -1;

// Unused
template <typename ExecutionSpace>
using FFTInfoType = int;

#if !defined(ENABLE_HOST_AND_DEVICE)
enum class FFTWTransformType { R2C, D2Z, C2R, Z2D, C2C, Z2Z };
#endif

template <typename ExecutionSpace>
using TransformType = FFTWTransformType;
Expand Down Expand Up @@ -83,7 +76,7 @@ struct transform_type<ExecutionSpace, Kokkos::complex<T1>,
static constexpr FFTWTransformType type() { return m_type; };
};

#ifdef ENABLE_HOST_AND_DEVICE
#if defined(ENABLE_HOST_AND_DEVICE)

template <typename ExecutionSpace>
struct FFTDataType {
Expand Down Expand Up @@ -115,11 +108,7 @@ struct FFTPlanType<ExecutionSpace, T1, Kokkos::complex<T2>> {
static constexpr oneapi::mkl::dft::domain dom =
oneapi::mkl::dft::domain::REAL;

using fftwHandle = std::conditional_t<
std::is_same_v<KokkosFFT::Impl::base_floating_point_type<float_type>,
float>,
fftwf_plan, fftw_plan>;

using fftwHandle = ScopedFFTWPlanType<ExecutionSpace, T1, T2>;
using onemklHandle = oneapi::mkl::dft::descriptor<prec, dom>;
using type = std::conditional_t<
std::is_same_v<ExecutionSpace, Kokkos::Experimental::SYCL>, onemklHandle,
Expand All @@ -137,11 +126,7 @@ struct FFTPlanType<ExecutionSpace, Kokkos::complex<T1>, T2> {
static constexpr oneapi::mkl::dft::domain dom =
oneapi::mkl::dft::domain::REAL;

using fftwHandle = std::conditional_t<
std::is_same_v<KokkosFFT::Impl::base_floating_point_type<float_type>,
float>,
fftwf_plan, fftw_plan>;

using fftwHandle = ScopedFFTWPlanType<ExecutionSpace, T1, T2>;
using onemklHandle = oneapi::mkl::dft::descriptor<prec, dom>;
using type = std::conditional_t<
std::is_same_v<ExecutionSpace, Kokkos::Experimental::SYCL>, onemklHandle,
Expand All @@ -159,11 +144,7 @@ struct FFTPlanType<ExecutionSpace, Kokkos::complex<T1>, Kokkos::complex<T2>> {
static constexpr oneapi::mkl::dft::domain dom =
oneapi::mkl::dft::domain::COMPLEX;

using fftwHandle = std::conditional_t<
std::is_same_v<KokkosFFT::Impl::base_floating_point_type<float_type>,
float>,
fftwf_plan, fftw_plan>;

using fftwHandle = ScopedFFTWPlanType<ExecutionSpace, T1, T2>;
using onemklHandle = oneapi::mkl::dft::descriptor<prec, dom>;
using type = std::conditional_t<
std::is_same_v<ExecutionSpace, Kokkos::Experimental::SYCL>, onemklHandle,
Expand Down

0 comments on commit c25dd85

Please sign in to comment.