Skip to content

Commit

Permalink
Remove non-default constructors from rocfft wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuuichi Asahi committed Dec 5, 2024
1 parent 1388228 commit 5e0969f
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions fft/src/KokkosFFT_ROCM_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ using TransformType = FFTWTransformType;

/// \brief A class that wraps rocfft for RAII
template <typename ExecutionSpace, typename T>
struct ScopedRocfftPlanType {
struct ScopedRocfftPlan {
private:
using floating_point_type = KokkosFFT::Impl::base_floating_point_type<T>;
rocfft_plan m_plan;
Expand All @@ -54,8 +54,8 @@ struct ScopedRocfftPlanType {
BufferViewType m_buffer;

public:
ScopedRocfftPlanType() {}
~ScopedRocfftPlanType() {
ScopedRocfftPlan() {}
~ScopedRocfftPlan() noexcept {
if (m_is_info_created) {
rocfft_status status = rocfft_execution_info_destroy(m_execution_info);
if (status != rocfft_status_success)
Expand All @@ -68,11 +68,16 @@ struct ScopedRocfftPlanType {
}
}

ScopedRocfftPlan(const ScopedRocfftPlan &) = delete;
ScopedRocfftPlan &operator=(const ScopedRocfftPlan &) = delete;
ScopedRocfftPlan &operator=(ScopedRocfftPlan &&) = delete;
ScopedRocfftPlan(ScopedRocfftPlan &&) = delete;

void set_is_plan_created() { m_is_plan_created = true; }
void set_is_info_created() { m_is_info_created = true; }

void allocate_work_buffer(std::size_t workbuffersize) {
m_buffer = BufferViewType("work buffer", workbuffersize);
m_buffer = BufferViewType("workbuffer", workbuffersize);
}
rocfft_plan &plan() { return m_plan; }
rocfft_execution_info &execution_info() { return m_execution_info; }
Expand Down Expand Up @@ -134,7 +139,7 @@ struct FFTDataType {
template <typename ExecutionSpace, typename T1, typename T2>
struct FFTPlanType {
using fftw_plan_type = ScopedFFTWPlanType<ExecutionSpace, T1, T2>;
using rocfft_plan_type = ScopedRocfftPlanType<ExecutionSpace, T1>;
using rocfft_plan_type = ScopedRocfftPlan<ExecutionSpace, T1>;
using type = std::conditional_t<std::is_same_v<ExecutionSpace, Kokkos::HIP>,
rocfft_plan_type, fftw_plan_type>;
};
Expand All @@ -161,7 +166,7 @@ struct FFTDataType {

template <typename ExecutionSpace, typename T1, typename T2>
struct FFTPlanType {
using type = ScopedRocfftPlanType<ExecutionSpace, T1>;
using type = ScopedRocfftPlan<ExecutionSpace, T1>;
};

template <typename ExecutionSpace>
Expand Down

0 comments on commit 5e0969f

Please sign in to comment.