Skip to content

Commit

Permalink
return execution_info by value in scoped rocfft plan
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuuichi Asahi committed Dec 19, 2024
1 parent 5e81354 commit 0d9119d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
32 changes: 17 additions & 15 deletions fft/src/KokkosFFT_ROCM_transform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace KokkosFFT {
namespace Impl {
inline void exec_plan(ScopedRocfftPlan<float>& scoped_plan, float* idata,
inline void exec_plan(const ScopedRocfftPlan<float>& scoped_plan, float* idata,
std::complex<float>* odata, int /*direction*/) {
rocfft_status status =
rocfft_execute(scoped_plan.plan(), (void**)&idata, (void**)&odata,
Expand All @@ -20,48 +20,50 @@ inline void exec_plan(ScopedRocfftPlan<float>& scoped_plan, float* idata,
"rocfft_execute for R2C failed");
}

inline void exec_plan(ScopedRocfftPlan<double>& scoped_plan, double* idata,
std::complex<double>* odata, int /*direction*/) {
inline void exec_plan(const ScopedRocfftPlan<double>& scoped_plan,
double* idata, std::complex<double>* odata,
int /*direction*/) {
rocfft_status status =
rocfft_execute(scoped_plan.plan(), (void**)&idata, (void**)&odata,
scoped_plan.execution_info());
KOKKOSFFT_THROW_IF(status != rocfft_status_success,
"rocfft_execute for D2Z failed");
}

inline void exec_plan(ScopedRocfftPlan<Kokkos::complex<float>>& scoped_plan,
std::complex<float>* idata, float* odata,
int /*direction*/) {
inline void exec_plan(
const ScopedRocfftPlan<Kokkos::complex<float>>& scoped_plan,
std::complex<float>* idata, float* odata, int /*direction*/) {
rocfft_status status =
rocfft_execute(scoped_plan.plan(), (void**)&idata, (void**)&odata,
scoped_plan.execution_info());
KOKKOSFFT_THROW_IF(status != rocfft_status_success,
"rocfft_execute for C2R failed");
}

inline void exec_plan(ScopedRocfftPlan<Kokkos::complex<double>>& scoped_plan,
std::complex<double>* idata, double* odata,
int /*direction*/) {
inline void exec_plan(
const ScopedRocfftPlan<Kokkos::complex<double>>& scoped_plan,
std::complex<double>* idata, double* odata, int /*direction*/) {
rocfft_status status =
rocfft_execute(scoped_plan.plan(), (void**)&idata, (void**)&odata,
scoped_plan.execution_info());
KOKKOSFFT_THROW_IF(status != rocfft_status_success,
"rocfft_execute for Z2D failed");
}

inline void exec_plan(ScopedRocfftPlan<Kokkos::complex<float>>& scoped_plan,
std::complex<float>* idata, std::complex<float>* odata,
int /*direction*/) {
inline void exec_plan(
const ScopedRocfftPlan<Kokkos::complex<float>>& scoped_plan,
std::complex<float>* idata, std::complex<float>* odata, int /*direction*/) {
rocfft_status status =
rocfft_execute(scoped_plan.plan(), (void**)&idata, (void**)&odata,
scoped_plan.execution_info());
KOKKOSFFT_THROW_IF(status != rocfft_status_success,
"rocfft_execute for C2C failed");
}

inline void exec_plan(ScopedRocfftPlan<Kokkos::complex<double>>& scoped_plan,
std::complex<double>* idata, std::complex<double>* odata,
int /*direction*/) {
inline void exec_plan(
const ScopedRocfftPlan<Kokkos::complex<double>>& scoped_plan,
std::complex<double>* idata, std::complex<double>* odata,
int /*direction*/) {
rocfft_status status =
rocfft_execute(scoped_plan.plan(), (void**)&idata, (void**)&odata,
scoped_plan.execution_info());
Expand Down
6 changes: 4 additions & 2 deletions fft/src/KokkosFFT_ROCM_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct ScopedRocfftPlanDescription {
Kokkos::abort("rocfft_plan_description_destroy failed");
}

rocfft_plan_description &description() { return m_description; }
rocfft_plan_description description() const noexcept { return m_description; }
};

/// \brief A class that wraps rocfft for RAII
Expand Down Expand Up @@ -172,7 +172,9 @@ struct ScopedRocfftPlan {
ScopedRocfftPlan(ScopedRocfftPlan &&) = delete;

rocfft_plan plan() const noexcept { return m_plan; }
rocfft_execution_info &execution_info() { return m_execution_info; }
rocfft_execution_info execution_info() const noexcept {
return m_execution_info;
}

private:
void cleanup() {
Expand Down

0 comments on commit 0d9119d

Please sign in to comment.