Repository navigation
feat(hipfft): bind the hipFFT Xt API - #611
Merged
Merged
Conversation
Collaborator
Author
|
@malcolmroberts Is it fine for you? |
Regenerate hipfort_hipfft from hipfftXt.h instead of hipfft.h alone. The module gains the 18 hipfftXt* routines as bind(C) interfaces: the multi-GPU descriptor API (hipfftXtSetGPUs, hipfftXtMalloc, hipfftXtMemcpy, hipfftXtFree, hipfftXtExecDescriptor*), hipfftXtMakePlanMany, hipfftXtGetSizeMany and hipfftXtExec on hipDataType, and the callback routines. hipXtDesc and hipLibXtDesc go in a new hipfort_hipfft_types module, the Xt enums in hipfort_hipfft_enums. hipfftMp.h is not bound: its routines exist only in a hipFFT built with HIPFFT_MPI_ENABLE. On the CUDA backend the Xt routines stay out, like any routine without a verified cufft twin. Add two tests: hipfft_xt_makeplanmany_c runs an Xt plan on one GPU, and hipfft_xt_descriptor_z does a 2D round trip through the descriptor API, which hipFFT allows only on two or more GPUs (it passes trivially with fewer). The symbol test links every new routine.
Regenerate hipfort_hipfft with hipfftMp.h as well: hipfftMpAttachComm, hipfftXtSetDistribution and hipfftXtSetSubformatDefault, and the HIPFFT_COMM_* constants. These routines exist only in a hipFFT built with HIPFFT_MPI_ENABLE, which the ROCm packages are not; an interface adds no reference until a program calls one, and the symbol test leaves them out. Document the Xt API in the hipFFT examples: hipfftXtMakePlanMany on hipDataType, the multi-GPU descriptor workflow (who owns the descriptor, one work size per GPU, the AMD limits), and attaching an MPI communicator, which takes a pointer to a C MPI_Comm that has to outlive the plan.
Doxygen cannot resolve ::hipfftXtMalloc, ::hipfftXtFree, ::hipLibXtDesc, ::hipfftXtMakePlanMany and ::hipfftXtSubFormat in the hipfort_hipfft docstrings, which failed the Read the Docs build under WARN_AS_ERROR. The generator now writes them as inline code, like the other unresolvable targets.
rocfft_field_brick_z and hipfft_xt_descriptor_z need two visible GPUs. Without them they stopped with status 0, so CTest counted them as passed although they checked nothing, and the CI, which shows one GPU to each test, never ran them. They now stop with 77 and declare SKIP_RETURN_CODE 77, so CTest reports them as skipped. The two hipFFT Xt tests are also listed as ROCm-only: the Xt routines have no cufftXt twin mapped yet, so they are not bound under USE_CUDA_NAMES.
Abuudiii
approved these changes
Oct 20, 2026
Abuudiii
left a comment
Contributor
There was a problem hiding this comment.
Tested on 2 GPUs (gfx1201, ROCm 7.2.4): hipfft_xt_descriptor_z passes, and all 33 hipFFT tests pass.
amontoison
added a commit
that referenced
this pull request
Oct 21, 2026
hipfort_hipfft_types (hipXtDesc, hipLibXtDesc) came with the hipFFT Xt API (#611); the migration table lists it beside _enums, as it does for hipFFTW and rocRAND.
amontoison
added a commit
that referenced
this pull request
Nov 3, 2026
hipfort_hipfft_types (hipXtDesc, hipLibXtDesc) came with the hipFFT Xt API (#611); the migration table lists it beside _enums, as it does for hipFFTW and rocRAND.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Binds the hipFFT Xt API in
hipfort_hipfft, as plainbind(C)interfaces, regenerated fromhipfftXt.handhipfftMp.h(which includehipfft.h):hipfftXtSetGPUs,hipfftXtMalloc,hipfftXtMemcpy,hipfftXtFree,hipfftXtExecDescriptor{,C2C,R2C,C2R,Z2Z,D2Z,Z2D};hipfftXtMakePlanMany,hipfftXtGetSizeManyandhipfftXtExeconhipDataType;hipfftXtSetCallback,hipfftXtClearCallback,hipfftXtSetCallbackSharedSize,hipfftXtSetJITCallback);hipfftMp.h:hipfftMpAttachComm,hipfftXtSetDistribution,hipfftXtSetSubformatDefault.hipXtDescandhipLibXtDescarebind(C)derived types in a newhipfort_hipfft_typesmodule; the Xt enums are inhipfort_hipfft_enums.rocFFT and hipFFTW need no change: rocFFT has no Xt routines (its multi-GPU API,
rocfft_field_*/rocfft_brick_*, is already bound), andhipfftw.hhas no Xt API.Notes
hipfftMp.hroutines need an MPI-enabled hipFFT. They are compiled only withHIPFFT_MPI_ENABLE, and the ROCm packages do not export them. Abind(C)interface adds no reference until a program calls it, so other programs link as before; the symbol test skips these three.hipfftMpAttachCommtakes a pointer to a CMPI_Comm(build it withMPI_Comm_f2c), which hipFFT keeps, so it has to outlive the plan.type(c_ptr)thathipfftXtMallocreturns,c_f_pointerit to atype(hipLibXtDesc), pointer, and pass that pointer tohipfftXtExecDescriptor*/hipfftXtFree, never a copy of the type.#ifndef USE_CUDA_NAMES), like every routine without a verified cufft twin.Documentation
docs/tutorials/hipfft-examples.rstgains three sections: Xt plans onhipDataType, multi-GPU transforms (the descriptor workflow, ownership, one work size per GPU, the AMD limits, with the descriptor test as the example), and multi-process transforms with MPI (the CMPI_Commhelper and the lifetime rule).Tests
hipfft_xt_makeplanmany_c:hipfftXtGetSizeMany+hipfftXtMakePlanMany+hipfftXtExec, batched C2C round trip on one GPU.hipfft_xt_descriptor_z: 2D Z2Z round trip throughXtSetGPUs/XtMalloc/XtMemcpy/XtExecDescriptorZ2Z/XtFreeon two GPUs; it passes trivially with fewer than two.test_hipfft(symbol test) links every new routine.