Repository navigation
feat(hipsolver): add the generated Fortran binding in bindings/fortran/hipsolver - #12581
Draft
amontoison wants to merge 10 commits into
Draft
amontoison wants to merge 10 commits into
amontoison wants to merge 10 commits into
Conversation
✅ All Checks Passed — Ready for Review
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🎉 All checks passed! This PR is ready for review. |
This was referenced Sep 25, 2026
amontoison
force-pushed
the
users/amontoison/hipsolver-fortran-bindings
branch
from
September 28, 2026 03:49
0cfe3f3 to
7b8bfc7
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #12581 +/- ##
========================================
Coverage 75.95% 75.95%
========================================
Files 2880 2880
Lines 479025 479025
Branches 71958 71958
========================================
Hits 363828 363828
Misses 90338 90338
Partials 24859 24859
*This pull request uses carry forward flags. Click here to find out more. 🚀 New features to boost your workflow:
|
amontoison
force-pushed
the
users/amontoison/hipsolver-fortran-bindings
branch
2 times, most recently
from
October 4, 2026 03:45
4b027b5 to
ab0c960
Compare
amontoison
force-pushed
the
users/amontoison/hipsolver-fortran-bindings
branch
from
October 5, 2026 05:13
ab0c960 to
627aef9
Compare
Add fortran/hipsolver.F90, the hipsolver module generated from the C headers by the rocm-fortran generator under RFC0019 (ROCm/TheRock#8122). It is committed next to the headers, is not edited by hand, and .gitattributes marks it linguist-generated.
amontoison
force-pushed
the
users/amontoison/hipsolver-fortran-bindings
branch
3 times, most recently
from
October 22, 2026 15:31
8a46dc7 to
fca1b72
Compare
…rated one
Build fortran/hipsolver.F90 as roc::hipsolver_fortran from fortran/, a
CMake project of its own that the root adds. BUILD_FORTRAN_BINDINGS
(default ${UNIX}, OFF on the CUDA backend) and BUILD_FORTRAN_CLIENTS
(default ON) control it, and HIPSOLVER_BUILD_FORTRAN_* override both per
library; FORTRAN_ARRAY_INTERFACES selects nothing here. The .mod and the
archive install per compiler under <includedir>/fortran/<compiler> and
<libdir>/fortran/<compiler>, beside a hipsolver-fortran config package.
Remove library/src/hipsolver_module.f90, deprecated since hipSOLVER
2.3.0, and EXPORT_FORTRAN_BINDINGS. Its hipsolver_enums module is folded
into hipsolver, so use hipsolver_enums becomes use hipsolver, and
outputs are passed by reference. fortran/test/ adds 51 CTest tests
labelled gpu; they use hip and skip until ROCm/rocm-systems#11923 lands.
Refs: ROCm/TheRock#8122 (RFC0019)
…bindings are missing A standalone clients build with BUILD_FORTRAN_BINDINGS=ON (the default on Linux) stopped with a FATAL_ERROR when hipsolver-fortran was not installed for the Fortran compiler in use. Build the clients without the Fortran tests and say so in a STATUS line, as every other project does when the bindings are unavailable.
amontoison
force-pushed
the
users/amontoison/hipsolver-fortran-bindings
branch
from
October 22, 2026 18:13
fca1b72 to
11d4bca
Compare
…solver The hipSOLVER Fortran binding consumes hipSOLVER's public API and builds standalone against an installed hipSOLVER, so it moves out of the library into bindings/fortran/hipsolver, the tree every monorepo and TheRock use for the Fortran bindings (RFC0015). Nothing is wired into the library build any more: the library is back to its state on develop. Its hand-written Fortran module stays for now: its deprecation and removal, with the Fortran clients that use it, follow in separate pull requests. - bindings/fortran/hipsolver reads hipSOLVER's version from projects/hipsolver - the binding has its own .gitattributes and CHANGELOG.md - CODEOWNERS: /bindings/fortran/hipsolver/, same owners - repos-config.json: register bindings/fortran/hipsolver so CI detects changes
Regenerate bindings/fortran/hipsolver with rocm-fortran-generator 9c8b3e4, and commit its metadata in bindings/fortran/hipsolver/metadata/, where the generator reads it from a checkout, instead of the copy kept in the generator.
Install the test executables in bin/, and a CTestTestfile.cmake in bin/hipsolver-fortran/ with the same tests and properties as the build tree, so that ctest --test-dir runs them from an install, as TheRock's test jobs do for the libraries.
An installed hipSOLVER built with EXPORT_FORTRAN_BINDINGS=ON exports its own roc::hipsolver_fortran, so the alias defined first made find_package(hipsolver) fail with "Some (but not all) targets in this export set were already defined". Find hipSOLVER first and stop with a clear message when it still exports that target. The tests reuse the parent's find_package result.
The binding is built against an installed hipSOLVER and is never added to the library's build, so drop what only served that: the per-library BUILD_FORTRAN_* overrides, the PARENT_SCOPE results, the ROCM_HAVE_FORTRAN shortcut, the gating on the library's client and test options, and the comments about the root. Find the Fortran compiler through the cmake/ROCmFortranCompiler.cmake shared by all the bindings, and require CMake 3.19. The binding targets the ROCm backend only, so BUILD_FORTRAN_BINDINGS no longer defaults to OFF on the CUDA backend.
…lver-fortran The package files went to lib/cmake/hipsolver, the C library's directory, with a forwarder in lib/cmake/hipsolver-fortran. rocRAND and hipRAND install their own legacy <lib>-fortran-config.cmake there, so the files overlapped. Install the config, targets and version files directly where find_package(<package>) looks, as the HIP and ROCTx bindings do, and drop the forwarder.
…ithout recursion rocm-cmake's generated hipsolver-config.cmake is to include lib/cmake/hipsolver-fortran/hipsolver-fortran-config.cmake after its targets (ROCm/rocm-cmake#303). Skip find_dependency(hipsolver) when hipsolver is the package being found, not only when roc::hipsolver is already imported, so that include never re-enters hipsolver-config.cmake.
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.
Implements RFC0015, Fortran Bindings Split (update) for hipSOLVER:
bindings/fortran/hipsolver/is a standalone CMake project that builds the generated Fortran binding against an installed hipSOLVER. The library is untouched: no option, noadd_subdirectory, no change toprojects/hipsolver/.What lands
bindings/fortran/hipsolver/hipsolver.F90(77 511 lines, generated with ROCm/rocm-fortran-generator 9c8b3e4 from the hipSOLVER headers, markedlinguist-generated): one modulehipsolverwith thebind(C)interfaces, the enum constants, thehipsolverCheckhelper and array overloads for the routines the generator supports.metadata/hipsolver.toml: the generator metadata it was generated with.test/: 106 CTest tests, 51.f03tests of the C interfaces and 55.f08tests of the array overloads (registered as<name>_f2008). They also install: the executables inbin/, and aCTestTestfile.cmakewith the same tests and properties inbin/hipsolver-fortran/, forctest --test-dir.roc::hipsolver_fortran, the name hipSOLVER's own Fortran target is exported under when the library is built withEXPORT_FORTRAN_BINDINGS=ON(its default). Configure finds hipSOLVER first and stops with a clear error in that case: build hipSOLVER with-DEXPORT_FORTRAN_BINDINGS=OFF. ROCm 10.1 does not export it.CMakeLists.txt, thehipsolver-fortranconfig template,cmake/ROCmFortranCompiler.cmake(the same in every binding: ROCm'samdflangis preferred over the first compiler onPATHunlessCMAKE_Fortran_COMPILERorFCis set),cmake/toolchains/and the binding'sCHANGELOG.md..github/CODEOWNERS:/bindings/fortran/hipsolver/ @ROCm/rocm-fortran-maintainers @ROCm/solvers-reviewers..github/repos-config.json: abindings/fortranentry, so CI detects changes to the binding. Each binding PR appends its entry at the end of the list, so all but the first to merge need a trivial rebase.A consumer uses
find_package(hipsolver-fortran)and linksroc::hipsolver_fortran. The archive and.modfiles install per compiler underlib/fortran/<compiler>/andinclude/fortran/<compiler>/;HIPSOLVER_FORTRAN_COMPILER_DIRnames that directory. The archive has one section per procedure, so a program linked with-Wl,--gc-sectionskeeps only the wrappers it calls.Options
BUILD_FORTRAN_BINDINGS${UNIX}BUILD_FORTRAN_CLIENTSONtest/; off underBUILD_ADDRESS_SANITIZERFORTRAN_ARRAY_INTERFACESassumed-shapenone/assumed-shape/assumed-rankarray overloadsIn TheRock
ROCm/TheRock#9446 builds
bindings/fortran/hipsolveras thehipsolver-fortransubproject against the hipSOLVER it built, with-DBUILD_FORTRAN_BINDINGS=ON -DBUILD_FORTRAN_CLIENTS=${THEROCK_BUILD_TESTING}, ships it in thesolver-fortranartifact and runs the installed tests in itshipsolver-fortranGPU test job.Follow-ups
This binding replaces the hand-written
library/src/hipsolver_module.f90(deprecated since hipSOLVER 2.3.0) and theEXPORT_FORTRAN_BINDINGSoption, which stay for now. Removing them and moving the library's Fortran clients and tests to this binding come in separate pull requests.Build and test
From the repository root, with
$PREFIXthe install prefix:$HIP_FORTRAN_PREFIXholds the HIP Fortran binding (hip-fortran) built with the same compiler; without it the tests are skipped.Verification
Standalone against ROCm 10.1 with amdflang on one GPU: 106 tests, 106 pass. Against a stand-in hipSOLVER package that exports
roc::hipsolver_fortran, configure stops with the error above.JIRA ID: ROCM-31390