I can reproduce this in containers started from the rocm/dev-ubuntu-24.04:6.3.2
base image.
After configuring the posted sample project, I re-ran cmake . --trace-expand 2>log
in the build tree.
On an AMD platform, the log shows the hip::host
target getting built, and the /opt/rocm/include
include directory added:
/opt/rocm/lib/cmake/hip/hip-targets.cmake(59): add_library(hip::amdhip64 SHARED IMPORTED )
...
/opt/rocm/lib/cmake/hip/hip-targets.cmake(66): add_library(hip::host INTERFACE IMPORTED )
/opt/rocm/lib/cmake/hip/hip-targets.cmake(68): set_target_properties(hip::host PROPERTIES INTERFACE_LINK_LIBRARIES hip::amdhip64 )
...
/opt/rocm/lib/cmake/hip/hip-config-amd.cmake(136): set_target_properties(hip::amdhip64 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES /opt/rocm/include INTERFACE_SYSTEM_INCLUDE_DIRECTORIES /opt/rocm/include )
The hip::host
target is created under an include()
in the HIP cmake package:
$ grep "^include" /opt/rocm/lib/cmake/hip/hip-config-amd.cmake
include( "${CMAKE_CURRENT_LIST_DIR}/hip-targets.cmake" )
On an NVIDIA platform, the log shows the hip::host
target being created but not populated:
/opt/rocm/lib/cmake/hip/hip-config-nvidia.cmake(22): add_library(hip::host INTERFACE IMPORTED )
...
The hip::host
target is created directly in the HIP cmake package, but not populated:
$ grep -v '^#' /opt/rocm/lib/cmake/hip/hip-config-nvidia.cmake
add_library(hip::device INTERFACE IMPORTED)
add_library(hip::host INTERFACE IMPORTED)
add_library(hip::amdhip64 INTERFACE IMPORTED)
I suspect that the NVIDIA-backed implementation of HIP’s cmake package is incomplete.