Skip to content

Wire up the NVIDIA/CUDA backend export (untested)#397

Open
amontoison wants to merge 1 commit into
ROCm:experimentalfrom
amontoison:wire-nvidia-backend
Open

Wire up the NVIDIA/CUDA backend export (untested)#397
amontoison wants to merge 1 commit into
ROCm:experimentalfrom
amontoison:wire-nvidia-backend

Conversation

@amontoison

@amontoison amontoison commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

⚠️ Untested on NVIDIA. No CUDA toolkit or NVIDIA GPU was available to validate the NVIDIA path; it needs testing on an NVIDIA system / in CI before it can be relied on. The AMD path is unchanged and was re-verified. Opening for review.

hipfort builds two static libraries, hipfort-amdgcn and hipfort-nvptx (the latter with USE_CUDA_NAMES). However, the hipfort::* component targets and the package config were generated only under if(HIP_PLATFORM STREQUAL "amd") — this was made deliberate in d43153d ("Restrict CMake target export to amd platform"). As a result hipfort-nvptx was compiled but never exported, and a downstream find_package(hipfort) found nothing on NVIDIA.

This PR wires up the NVIDIA export:

  • Parameterize hipfort_add_component to link ${HIPFORT_BASE_LIB} instead of the hard-coded hipfort-amdgcn.
  • Export hipfort-nvptx (add the EXPORT clause + install its targets file) and give it an INSTALL_INTERFACE include directory, mirroring hipfort-amdgcn.
  • Add an elseif(HIP_PLATFORM STREQUAL "nvidia") branch that wires the HIP-based components (hip, hipblas, hipfft/hipfftw, hiprand, hipsolver, hipsparse) against hipfort-nvptx. The roc* libraries and roctx are ROCm/AMD-only and are intentionally 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@.

Verification

  • AMD (verified, no regression): configure + package-config generation (hipfort-config.cmake correctly includes hipfort-amdgcn-targets.cmake) + build of hipfort-amdgcn + link of an f2003 test via hipfort::hipblas.
  • NVIDIA (NOT verified): requires a CUDA-configured HIP install and an NVIDIA GPU, which were not available. The target names used for NVIDIA (hip::host, roc::hipblas, hip::hipfft, hip::hiprand, roc::hipsolver, roc::hipsparse) should be double-checked against a real NVIDIA hipBLAS/hipFFT/... install.

@amontoison
amontoison requested a review from cgmb as a code owner July 25, 2026 03:12
@amontoison amontoison self-assigned this Jul 25, 2026
@amontoison
amontoison changed the base branch from develop to experimental July 25, 2026 05:02
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
amontoison force-pushed the wire-nvidia-backend branch from b4dcbed to 26e954c Compare July 25, 2026 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant