Wire up the NVIDIA/CUDA backend export (untested)#397
Open
amontoison wants to merge 1 commit into
Open
Conversation
Previously the hipfort::* component targets and the package config were generated only for HIP_PLATFORM=amd (see "Restrict CMake target export to amd platform", d43153d); the hipfort-nvptx library was built but never exported, so a downstream find_package(hipfort) found nothing on NVIDIA. - Parameterize hipfort_add_component to link ${HIPFORT_BASE_LIB} instead of the hard-coded hipfort-amdgcn. - Export hipfort-nvptx (EXPORT clause + install of the targets file) and give it an INSTALL_INTERFACE include directory, mirroring amdgcn. - Add an HIP_PLATFORM=nvidia branch that wires the HIP-based components (hip, hipblas, hipfft/hipfftw, hiprand, hipsolver, hipsparse) against hipfort-nvptx. The roc* libraries and roctx are AMD-only and are not wired there. - Generate/install the package config for whichever platform was selected, and make hipfort-config.cmake.in include the arch-specific targets file via @HIPFORT_ARCH_EXPORT@. The AMD path is unchanged and was re-verified (configure, config generation, library and test build). The NVIDIA path is UNTESTED: no CUDA toolkit or NVIDIA GPU was available, so it needs validation on an NVIDIA system / in CI before relying on it.
amontoison
force-pushed
the
wire-nvidia-backend
branch
from
July 25, 2026 05:44
b4dcbed to
26e954c
Compare
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
hipfort builds two static libraries,
hipfort-amdgcnandhipfort-nvptx(the latter withUSE_CUDA_NAMES). However, thehipfort::*component targets and the package config were generated only underif(HIP_PLATFORM STREQUAL "amd")— this was made deliberate in d43153d ("Restrict CMake target export to amd platform"). As a resulthipfort-nvptxwas compiled but never exported, and a downstreamfind_package(hipfort)found nothing on NVIDIA.This PR wires up the NVIDIA export:
hipfort_add_componentto link${HIPFORT_BASE_LIB}instead of the hard-codedhipfort-amdgcn.hipfort-nvptx(add theEXPORTclause + install its targets file) and give it anINSTALL_INTERFACEinclude directory, mirroringhipfort-amdgcn.elseif(HIP_PLATFORM STREQUAL "nvidia")branch that wires the HIP-based components (hip,hipblas,hipfft/hipfftw,hiprand,hipsolver,hipsparse) againsthipfort-nvptx. Theroc*libraries androctxare ROCm/AMD-only and are intentionally not wired there.hipfort-config.cmake.ininclude the arch-specific targets file via@HIPFORT_ARCH_EXPORT@.Verification
hipfort-config.cmakecorrectly includeshipfort-amdgcn-targets.cmake) + build ofhipfort-amdgcn+ link of an f2003 test viahipfort::hipblas.hip::host,roc::hipblas,hip::hipfft,hip::hiprand,roc::hipsolver,roc::hipsparse) should be double-checked against a real NVIDIA hipBLAS/hipFFT/... install.