Repository navigation
[Sandbox] Move the Fortran bindings to per-library modules, with hipfftxt beside hipfft (ROCm only) - #540
Open
amontoison wants to merge 6 commits into
Open
[Sandbox] Move the Fortran bindings to per-library modules, with hipfftxt beside hipfft (ROCm only)#540amontoison wants to merge 6 commits into
amontoison wants to merge 6 commits into
Conversation
amontoison
force-pushed
the
rocm-fortran
branch
2 times, most recently
from
September 20, 2026 16:04
7794245 to
ab3686f
Compare
amontoison
force-pushed
the
rocm-fortran
branch
2 times, most recently
from
September 20, 2026 22:55
bf7a1d1 to
fd2fee6
Compare
amontoison
force-pushed
the
rocm-fortran
branch
2 times, most recently
from
September 21, 2026 01:24
6e02bff to
c0c5a93
Compare
amontoison
force-pushed
the
rocm-fortran
branch
3 times, most recently
from
September 27, 2026 16:37
3a12e1f to
da31ee7
Compare
This was referenced Sep 28, 2026
feat(rocfft): add the generated Fortran binding in bindings/fortran/rocfft
ROCm/rocm-libraries#12366
Draft
amontoison
added a commit
that referenced
this pull request
Sep 29, 2026
Document the move from hipFORT to the bindings that ship inside ROCm (rocm-systems and rocm-libraries), in the spirit of the layout previewed in #540: one self-contained module per library, ROCm only. The guide covers the two edits a consumer has to make (the `use` statement rename, with a sed recipe and the cases it deliberately leaves to review; and the per-library Fortran archive and CMake target), the build options, the per-compiler install layout and how to rebuild a binding for a non-amdflang compiler, what does not change, and an FAQ covering the old/new coexistence. Wire the page into the docs index and the Sphinx TOC.
amontoison
force-pushed
the
rocm-fortran
branch
5 times, most recently
from
September 30, 2026 03:23
8299c6d to
2fbf0f6
Compare
amontoison
added a commit
to amontoison/rocm-systems
that referenced
this pull request
Sep 30, 2026
Every file the bindings commit added carried either no licence header at all or hipfort's older "[MITx11 License]" banner, which names no SPDX identifier. The review on rocm-systems#11923 flagged the one C++ source, projects/hip/fortran/test/vecadd_kernel.hip.cpp, but the same gap ran through the whole directory, so it is closed everywhere rather than on the single file that happened to be noticed. The Fortran sources take the MIT block hipfort now emits, byte-identical to the one in ROCm/hipfort#540, so that regenerating hip.F90 does not re-churn the header it just gained. The CMake and C++ files take the three-line form already used across projects/hip: hip_profile.h, FindHIP/run_make2cmake.cmake and hipamd/CMakeLists.txt all open that way. No code changes. The diff is 699 comment lines added and the six lines of the old hipfort banner in hip.F90 removed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
amontoison
force-pushed
the
rocm-fortran
branch
2 times, most recently
from
October 2, 2026 02:57
dbdff10 to
3cb9c27
Compare
amontoison
added a commit
to amontoison/rocm-systems
that referenced
this pull request
Oct 2, 2026
Every file the bindings commit added carried either no licence header at all or hipfort's older "[MITx11 License]" banner, which names no SPDX identifier. The review on rocm-systems#11923 flagged the one C++ source, projects/hip/fortran/test/vecadd_kernel.hip.cpp, but the same gap ran through the whole directory, so it is closed everywhere rather than on the single file that happened to be noticed. The Fortran sources take the MIT block hipfort now emits, byte-identical to the one in ROCm/hipfort#540, so that regenerating hip.F90 does not re-churn the header it just gained. The CMake and C++ files take the three-line form already used across projects/hip: hip_profile.h, FindHIP/run_make2cmake.cmake and hipamd/CMakeLists.txt all open that way. No code changes. The diff is 699 comment lines added and the six lines of the old hipfort banner in hip.F90 removed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
amontoison
force-pushed
the
rocm-fortran
branch
from
October 2, 2026 20:35
a40e781 to
13ba922
Compare
amontoison
added a commit
that referenced
this pull request
Oct 17, 2026
Document the move from hipFORT to the bindings that ship inside ROCm (rocm-systems and rocm-libraries), in the spirit of the layout previewed in #540: one self-contained module per library, ROCm only. The guide covers the two edits a consumer has to make (the `use` statement rename, with a sed recipe and the cases it deliberately leaves to review; and the per-library Fortran archive and CMake target), the build options, the per-compiler install layout and how to rebuild a binding for a non-amdflang compiler, what does not change, and an FAQ covering the old/new coexistence. Wire the page into the docs index and the Sphinx TOC.
amontoison
force-pushed
the
rocm-fortran
branch
from
October 17, 2026 22:02
13ba922 to
08e9155
Compare
amontoison
added a commit
that referenced
this pull request
Oct 20, 2026
Document the move from hipFORT to the bindings that ship inside ROCm (rocm-systems and rocm-libraries), in the spirit of the layout previewed in #540: one self-contained module per library, ROCm only. The guide covers the two edits a consumer has to make (the `use` statement rename, with a sed recipe and the cases it deliberately leaves to review; and the per-library Fortran archive and CMake target), the build options, the per-compiler install layout and how to rebuild a binding for a non-amdflang compiler, what does not change, and an FAQ covering the old/new coexistence. Wire the page into the docs index and the Sphinx TOC.
amontoison
force-pushed
the
rocm-fortran
branch
2 times, most recently
from
October 20, 2026 22:19
6bb0a12 to
abb688f
Compare
amontoison
force-pushed
the
rocm-fortran
branch
3 times, most recently
from
October 21, 2026 18:25
5b5f636 to
5ecef27
Compare
amontoison
added a commit
that referenced
this pull request
Oct 21, 2026
Document the move from hipFORT to the bindings that ship inside ROCm (rocm-systems and rocm-libraries), in the spirit of the layout previewed in #540: one self-contained module per library, ROCm only. The guide covers the two edits a consumer has to make (the `use` statement rename, with a sed recipe and the cases it deliberately leaves to review; and the per-library Fortran archive and CMake target), the build options, the per-compiler install layout and how to rebuild a binding for a non-amdflang compiler, what does not change, and an FAQ covering the old/new coexistence. Wire the page into the docs index and the Sphinx TOC.
…nly)
lib/hipfort becomes one directory per library, grouped by the repository
each binding will be committed to: lib/rocm-systems/{hip,roctx} and
lib/rocm-libraries/<lib>. Each is a single module named after its
library (use rocblas), with the enums, types, handles and the <lib>Check
helper folded in, and builds its own archive and CMake package
(roc::rocblas_fortran, find_package(rocblas-fortran)), installed under
include/fortran/<compiler> and lib/fortran/<compiler>.
The array tiers are selected by FORTRAN_ARRAY_INTERFACES (none,
assumed-shape, assumed-rank). find_package(hipfort), the single
libhipfort-amdgcn archive and the CUDA backend are gone, as they are
after the split. The tests use the new modules, and the docs describe
the per-library packages.
Each archive is compiled with one section per procedure, and the tests
link with -Wl,--gc-sections, so a test keeps only the wrappers it calls
and still links against a library older than the headers the bindings
were generated from.
Regenerated with rocm-fortran-generator public 625cb01 from the headers of ROCm 10.2, as hipfort develop: the metadata is now one TOML file per library, with defaults derived from the C signature, so the modules gain the same forms as develop (the _devptr twins, the _strided_rank overloads, the nullable scalars, the routines added in 10.2) and use each module once, with IMPORT in the interface bodies.
amontoison
force-pushed
the
rocm-fortran
branch
from
November 3, 2026 04:07
5ecef27 to
9d1ac92
Compare
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
Security scan found no critical or high findings on lines changed by this pull request2 medium, low, or unrated finding(s) are not listed; the scan run has them. View the security scan run for complete reports. “New” means the finding is located in a changed file on an added or modified line; it is not a base-versus-head findings delta. |
amontoison
added a commit
that referenced
this pull request
Nov 3, 2026
Document the move from hipFORT to the bindings that ship inside ROCm (rocm-systems and rocm-libraries), in the spirit of the layout previewed in #540: one self-contained module per library, ROCm only. The guide covers the two edits a consumer has to make (the `use` statement rename, with a sed recipe and the cases it deliberately leaves to review; and the per-library Fortran archive and CMake target), the build options, the per-compiler install layout and how to rebuild a binding for a non-amdflang compiler, what does not change, and an FAQ covering the old/new coexistence. Wire the page into the docs index and the Sphinx TOC.
The bindings moved out of the library projects into a top-level bindings/fortran tree in rocm-systems and rocm-libraries. Mirror it: lib/rocm-<repo>/<lib>/fortran becomes lib/rocm-<repo>/bindings/fortran/<lib>, with the module path, the docs globs and the comments that named the old location. The sandbox keeps one project per module, so HIP and ROCTx, and hipFFT and hipFFTW, stay in separate directories where the monorepos build each pair from one.
…dings/fortran layout
Abuudiii
approved these changes
Nov 5, 2026
Mirror rocm-libraries#12367: hipfft.F90 and the new hipfftxt.F90 are the files of its branch, generated by rocm-fortran-generator#17. As CUDA Fortran's cufft and cufftXt, every hipfftXt* and hipfftMp* function, hipfftXtSetWorkArea included, is in hipfftxt, which uses and re-exports hipfft. Both modules build into libhipfft_fortran.a and install with the hipfft-fortran package: rocm_add_fortran_binding takes several SOURCE files and installs one .mod per source. The Xt tests and the hipFFT examples use hipfftxt.
This branch has not been deployed
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.
A sandbox preview, not for merge. It shows what the Fortran bindings look like once they move into the
bindings/fortran/tree ofrocm-systemsandrocm-libraries, apart from the libraries they wrap, so the shape can be tried before anything lands.lib/rocm-systems/bindings/fortran/andlib/rocm-libraries/bindings/fortran/mirror those trees, with one project per library (the monorepos build HIP with ROCTx, and hipFFT with hipFFTW, from one project). The bindings are generated from the ROCm 10.2 headers with rocm-fortran-generatormain, and are byte-identical to those of the per-library pull requests below. The HIP module of rocm-systems#11923 is generated from the headers of rocm-systemsdevelop(HIP 7.18), so it also hashipExtMemcpyBatchAsyncandhipKernelSetCacheConfig, which ROCm 10.2 does not export; the sandbox keeps the ROCm 10.2 one.The real pull requests are one per library. This branch is where you can build the whole set at once.
Status (2026-11-07)
All the binding pull requests are up to date and green, locally and in TheRock CI (rocm-libraries#15008, a test-only PR that merges the ten rocm-libraries bindings with ROCm/TheRock#9446: 1271 binding tests pass on MI300). The ten rocm-libraries PRs are still drafts until the RFC is approved.
fortran-bindingsstage, one GPU test job per binding)find_package(<lib>)also loads<lib>-fortranwhen installedEach binding installs its CMake package in
<libdir>/cmake/<lib>-fortran/and is ready for the rocm-cmake hook (hipfft-fortranalso loadshipfftw-fortran).Merge order: rocm-systems#11923, then #14024, then the ten rocm-libraries PRs (each appends its entry to
.github/repos-config.json, so they rebase in turn, regenerating the bindings), then ROCm/TheRock#9446.After the merge:
amdrocm-<family>-fortran-develpackage per family and theamdrocm-fortranmetapackage, which also removes the*-fortranentries fromKNOWN_UNCOVERED_COMPONENTS;<lib>-fortran-config.cmake, whose removal enables the rocm-cmake hook for them), hipSOLVER (EXPORT_FORTRAN_BINDINGSOFF by default), rocSPARSE docs;c_null_ptr(hipStreamBeginCaptureToGraph,hipModuleLaunchKernel/hipDrvLaunchKernelEx,hipGraphAddMemFreeNode);What changes
lib/hipfort, a flat directory of 35 files, becomes 13 directories, one per library, laid out as in the repository each will be committed to:Each is one self-contained module named after its library, with the enums, types, handles and the
<lib>Checkhelper folded in.use hipfort_rocblasbecomesuse rocblas. hipFFT is the one library with two modules, see below: 14 modules in all.hipFFT:
hipfftandhipfftxtAs CUDA Fortran's
cufftandcufftXt, the hipFFT binding has two modules, built into the samelibhipfft_fortran.a(hip::hipfft_fortran,find_package(hipfft-fortran)):hipfftlib/rocm-libraries/bindings/fortran/hipfft/hipfft.F90hipfftExec*, the work area and stream routineshipfftxtlib/rocm-libraries/bindings/fortran/hipfft/hipfftxt.F90hipfftXt*andhipfftMp*function,hipfftXtSetWorkAreaincluded, with thehipXtDesc/hipLibXtDesctypes and the Xt enums; it uses and re-exportshipfftA program calling the Xt or multi-process API writes
use hipfftxt(the Xt tests do); any other keepsuse hipfft.rocm_add_fortran_bindingtakes severalSOURCEfiles for this and installs one.modper source. The files are byte-identical to rocm-libraries#12367. hipFORT itself has the same split (hipfort_hipfftxt).Each also builds its own archive and config package, the way its binding project will:
roc::rocblas_fortran,hip::hipfft_fortranlibrocblas_fortran.arocblas.mod(hipFFT:hipfft.mod,hipfftxt.mod)find_package(rocblas-fortran)The
.modand the archive install underinclude/fortran/<compiler>andlib/fortran/<compiler>, because a.modis not portable across compilers.find_package(hipfort)and the singlelibhipfort-amdgcn.aare gone, as they are after the split. So is the CUDA backend.Try it
1296 tests, on by default, the same set as
develop(fewer withFORTRAN_ARRAY_INTERFACES=noneorassumed-rank, which skip the f2008 tests). They need a GPU to pass.Build one binding on its own, against the installed library, as TheRock and a user with another compiler do:
Install and consume it, which is what a user does:
cmake -S your-app -B build-app -DCMAKE_PREFIX_PATH="/tmp/rocm-fortran;/opt/rocm"Without CMake:
Options
BUILD_FORTRAN_BINDINGSBUILD_FORTRAN_CLIENTStest/;BUILD_TESTINGis honoured once, with a warningFORTRAN_ARRAY_INTERFACESassumed-shapenone/assumed-shape/assumed-rankBUILD_FORTRAN_CLIENT_SAMPLESThe libraries' own samples
test/rocm-libraries/holds the 18 Fortran samples rocBLAS and rocSPARSE ship inclients/samples/, copied verbatim and compiled unedited. They open withuse rocblasanduse rocsparse, the names the generated bindings provide, so building them is what shows the generated module is a drop-in for the hand-written one it replaces.cmake -S . -B build -DBUILD_FORTRAN_CLIENTS=ON -DBUILD_FORTRAN_CLIENT_SAMPLES=ON cmake --build build --target hipfort_sample_rocblas_example_fortran_axpyOFF by default because 16 of the 18 still need one line each: a
use <lib>_enumsto delete for two of them, and ac_loc()around the character buffer passed to the revision helpers for the fourteen rocSPARSE ones, each of which opens by printing the revision. Details intest/rocm-libraries/README.md.