ROCm / HIP

HIP: C++ Heterogeneous-Compute Interface for Portability
https://rocmdocs.amd.com/projects/HIP/
MIT License
3.54k stars 518 forks source link

unrobust CMake search logic #2433

Open ye-luo opened 2 years ago

ye-luo commented 2 years ago

ROCM 4.5 and hip-lang package assume hip is installed as <ROCM_ROOT>/hip and tries to access paths outside <ROCM_ROOT>/hip and inside `<ROCM_ROOT> for example https://github.com/ROCm-Developer-Tools/HIP/blob/cddb52549b4f4fce9165cac8b2ccf25173ba3157/hip-lang-config.cmake.in#L108

reproducer

cmake_minimum_required(VERSION 3.21.0)

project(test_hip CXX)
enable_language(HIP)

When using AOMP where hip is installed inside /usr/lib/aomp_14.0-0

$ cmake ..
-- The CXX compiler identification is Clang 14.0.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/mpicxx - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The HIP compiler identification is Clang 14.0.0
-- Detecting HIP compiler ABI info
CMake Error in /home/yeluo/opt/cleanup/qmcpack/build_R7_aompbuild_offload_cuda2hip_real_check/test/build/CMakeFiles/CMakeTmp/CMakeLists.txt:
  Imported target "hip-lang::device" includes non-existent path

    "/home/yeluo/rocm/aomp_14.0-0/../include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.

CMake Error in /home/yeluo/opt/cleanup/qmcpack/build_R7_aompbuild_offload_cuda2hip_real_check/test/build/CMakeFiles/CMakeTmp/CMakeLists.txt:
  Imported target "hip-lang::device" includes non-existent path

    "/home/yeluo/rocm/aomp_14.0-0/../include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.

CMake Error at /home/packages/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.3.0/cmake-3.21.4-t47xgwhz7ql3mvemzhzc7zwsrly6na3s/share/cmake-3.21/Modules/CMakeDetermineCompilerABI.cmake:49 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  /home/packages/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.3.0/cmake-3.21.4-t47xgwhz7ql3mvemzhzc7zwsrly6na3s/share/cmake-3.21/Modules/CMakeTestHIPCompiler.cmake:29 (CMAKE_DETERMINE_COMPILER_ABI)
  CMakeLists.txt:4 (enable_language)

-- Configuring incomplete, errors occurred!

issue 1. When looking for __clang_cuda_math.h, the path should be derived on where clang is not where hip libraries are issue 2. Should not add path blindly ${_IMPORT_PREFIX}/../include without verification.

Maxzor commented 2 years ago

Have the exact same problem with hip-config.cmake for target hip::device.

ppanchad-amd commented 2 months ago

@ye-luo Apologies for the lack of response. Can you please test with latest ROCm 6.0.2 (HIP 6.0.32831)? If resolved, please close ticket. Thanks!