diff --git a/fft/src/KokkosFFT_Cuda_plans.hpp b/fft/src/KokkosFFT_Cuda_plans.hpp index 935be540..f868a659 100644 --- a/fft/src/KokkosFFT_Cuda_plans.hpp +++ b/fft/src/KokkosFFT_Cuda_plans.hpp @@ -177,12 +177,19 @@ auto create_plan(const ExecutionSpace& exec_space, return fft_size; } -template , std::nullptr_t> = nullptr> -void destroy_plan_and_info(std::unique_ptr& plan, InfoType&) { +void destroy_plan(std::unique_ptr& plan) { cufftDestroy(*plan); } + +template , + std::nullptr_t> = nullptr> +void destroy_info(InfoType&) { + // not used, no finalization is required +} } // namespace Impl } // namespace KokkosFFT diff --git a/fft/src/KokkosFFT_HIP_plans.hpp b/fft/src/KokkosFFT_HIP_plans.hpp index bc2b3386..a910ffaf 100644 --- a/fft/src/KokkosFFT_HIP_plans.hpp +++ b/fft/src/KokkosFFT_HIP_plans.hpp @@ -184,12 +184,19 @@ auto create_plan(const ExecutionSpace& exec_space, return fft_size; } -template , std::nullptr_t> = nullptr> -void destroy_plan_and_info(std::unique_ptr& plan, InfoType&) { +void destroy_plan(std::unique_ptr& plan) { hipfftDestroy(*plan); } + +template , + std::nullptr_t> = nullptr> +void destroy_info(InfoType&) { + // not used, no finalization is required +} } // namespace Impl } // namespace KokkosFFT diff --git a/fft/src/KokkosFFT_Host_plans.hpp b/fft/src/KokkosFFT_Host_plans.hpp index 94169386..3ab86d77 100644 --- a/fft/src/KokkosFFT_Host_plans.hpp +++ b/fft/src/KokkosFFT_Host_plans.hpp @@ -105,11 +105,11 @@ auto create_plan(const ExecutionSpace& exec_space, return fft_size; } -template , std::nullptr_t> = nullptr> -void destroy_plan_and_info(std::unique_ptr& plan, InfoType&) { +void destroy_plan(std::unique_ptr& plan) { if constexpr (std::is_same_v) { fftwf_destroy_plan(*plan); } else { @@ -117,6 +117,13 @@ void destroy_plan_and_info(std::unique_ptr& plan, InfoType&) { } } +template , + std::nullptr_t> = nullptr> +void destroy_info(InfoType&) { + // not used, no finalization is required +} } // namespace Impl } // namespace KokkosFFT diff --git a/fft/src/KokkosFFT_Plans.hpp b/fft/src/KokkosFFT_Plans.hpp index 641fa006..532f5bb8 100644 --- a/fft/src/KokkosFFT_Plans.hpp +++ b/fft/src/KokkosFFT_Plans.hpp @@ -285,8 +285,8 @@ class Plan { } ~Plan() { - destroy_plan_and_info(m_plan, - m_info); + destroy_info(m_info); + destroy_plan(m_plan); } Plan(const Plan&) = delete; diff --git a/fft/src/KokkosFFT_ROCM_plans.hpp b/fft/src/KokkosFFT_ROCM_plans.hpp index b1ea115d..7fbb2636 100644 --- a/fft/src/KokkosFFT_ROCM_plans.hpp +++ b/fft/src/KokkosFFT_ROCM_plans.hpp @@ -192,14 +192,19 @@ auto create_plan(const ExecutionSpace& exec_space, return fft_size; } -template , std::nullptr_t> = nullptr> -void destroy_plan_and_info(std::unique_ptr& plan, - InfoType& execution_info) { - rocfft_execution_info_destroy(execution_info); +void destroy_plan(std::unique_ptr& plan) { rocfft_plan_destroy(*plan); } + +template , + std::nullptr_t> = nullptr> +void destroy_info(InfoType& execution_info) { + rocfft_execution_info_destroy(execution_info); +} } // namespace Impl } // namespace KokkosFFT diff --git a/fft/src/KokkosFFT_SYCL_plans.hpp b/fft/src/KokkosFFT_SYCL_plans.hpp index 8e9fdcd6..e62f6b27 100644 --- a/fft/src/KokkosFFT_SYCL_plans.hpp +++ b/fft/src/KokkosFFT_SYCL_plans.hpp @@ -106,12 +106,20 @@ auto create_plan(const ExecutionSpace& exec_space, } template < - typename ExecutionSpace, typename PlanType, typename InfoType, + typename ExecutionSpace, typename PlanType, std::enable_if_t, std::nullptr_t> = nullptr> -void destroy_plan_and_info(std::unique_ptr&, InfoType&) { +void destroy_plan(std::unique_ptr&) { // In oneMKL, plans are destroybed by destructor } + +template < + typename ExecutionSpace, typename InfoType, + std::enable_if_t, + std::nullptr_t> = nullptr> +void destroy_info(InfoType&) { + // not used, no finalization is required +} } // namespace Impl } // namespace KokkosFFT