From fc8c8ce6e70a952a8bab2fbebf105cc4dbb754b4 Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Tue, 19 May 2026 17:29:28 -0400 Subject: [PATCH] FFT HIP: use hipfftCreate+hipfftMakePlanMany instead of hipfftPlanMany --- Grid/algorithms/FFT.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Grid/algorithms/FFT.h b/Grid/algorithms/FFT.h index 7a61ad1a..406a49b6 100644 --- a/Grid/algorithms/FFT.h +++ b/Grid/algorithms/FFT.h @@ -74,11 +74,14 @@ public: FFTW_scalar *out, int *onembed, int ostride, int odist, int sign, unsigned flags) { + // hipfftPlanMany (one-step) triggers HIPFFT_PARSE_ERROR (12) on some + // ROCm versions. The two-step hipfftCreate + hipfftMakePlanMany is + // more robust across ROCm releases. FFTW_plan p; - // Pass nullptr for inembed/onembed: contiguous layout is the default and - // avoids HIPFFT_PARSE_ERROR (12) triggered by some rocFFT versions when - // inembed==n (non-null, no-padding case). - auto rv = hipfftPlanMany(&p,rank,n,nullptr,istride,idist,nullptr,ostride,odist,HIPFFT_Z2Z,howmany); + size_t workSize; + auto rc = hipfftCreate(&p); + GRID_ASSERT(rc==HIPFFT_SUCCESS); + auto rv = hipfftMakePlanMany(p,rank,n,nullptr,istride,idist,nullptr,ostride,odist,HIPFFT_Z2Z,howmany,&workSize); GRID_ASSERT(rv==HIPFFT_SUCCESS); return p; } @@ -104,7 +107,10 @@ public: int ostride, int odist, int sign, unsigned flags) { FFTW_plan p; - auto rv = hipfftPlanMany(&p,rank,n,nullptr,istride,idist,nullptr,ostride,odist,HIPFFT_C2C,howmany); + size_t workSize; + auto rc = hipfftCreate(&p); + GRID_ASSERT(rc==HIPFFT_SUCCESS); + auto rv = hipfftMakePlanMany(p,rank,n,nullptr,istride,idist,nullptr,ostride,odist,HIPFFT_C2C,howmany,&workSize); GRID_ASSERT(rv==HIPFFT_SUCCESS); return p; }