Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 945232 - cmake provides faulty location for rocm related builds
Summary: cmake provides faulty location for rocm related builds
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-28 11:58 UTC by Amit Ugol
Modified: 2024-12-02 07:10 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Amit Ugol 2024-11-28 11:58:24 UTC
This BOF is not happening with current packages, maybe keep this as a reference...

The build failure is for a non official package.
Even so, it is asking /usr/share/cmake/Modules/CMakeDetermineHIPCompiler.cmake that comes with cmake:

# equery b /usr/share/cmake/Modules/CMakeDetermineHIPCompiler.cmake
 * Searching for /usr/share/cmake/Modules/CMakeDetermineHIPCompiler.cmake ...
dev-build/cmake-3.31.0 (/usr/share/cmake/Modules/CMakeDetermineHIPCompiler.cmake)

The issue here is that for some reason, when trying to compile composable-kernel  it asks for CMAKE_HIP_COMPILER_ROCM_ROOT path and gets '/usr/lib' and then tries to build the root path /usr/lib/lib and /usr/lib/lib64.

That cmake file has a rule where if it fails to get the CMAKE_HIP_COMPILER_ROCM_ROOT, it will run `hipconfig --rocmpath` and get the value from it so I used that as a WA as it returns '/usr' as expected.

The actual error is:

"
CMake Error at /usr/share/cmake/Modules/CMakeDetermineHIPCompiler.cmake:217 (message):
  The ROCm root directory:

   /usr/lib

  does not contain the HIP runtime CMake package, expected at one of:

   /usr/lib/lib/cmake/hip-lang/hip-lang-config.cmake
   /usr/lib/lib64/cmake/hip-lang/hip-lang-config.cmake

Call Stack (most recent call first):
  CMakeLists.txt:26 (project)
"

The change I did in that file is to move this rule up from line 158 to the head of the rules that look for CMAKE_HIP_COMPILER_ROCM_ROOT.

if(NOT CMAKE_HIP_COMPILER_ROCM_ROOT)
  execute_process(
    COMMAND hipconfig --rocmpath
    OUTPUT_VARIABLE _CMAKE_HIPCONFIG_ROCMPATH
    RESULT_VARIABLE _CMAKE_HIPCONFIG_RESULT
    )
  if(_CMAKE_HIPCONFIG_RESULT EQUAL 0 AND EXISTS "${_CMAKE_HIPCONFIG_ROCMPATH}")
    set(CMAKE_HIP_COMPILER_ROCM_ROOT "${_CMAKE_HIPCONFIG_ROCMPATH}")
  endif()
endif()
if(NOT CMAKE_HIP_COMPILER_ROCM_ROOT)
  message(FATAL_ERROR "Failed to find ROCm root directory.")
endif()
Comment 1 Mike Gilbert gentoo-dev 2024-11-28 16:58:24 UTC
Not really sure what to do with this if you cannot provide the name of a failing Gentoo package.
Comment 2 Amit Ugol 2024-12-02 07:10:24 UTC
Hi,
The package is composable-kernel, however the provided 6.1.1 version does not have this issue, and I am trying to bring this version to a newer 6.2.4 version where it has a bunch of issues where this is one of them.
Again, I am also not sure that we have anything to do here, and I wanted to raise a flag at this point because the 6.1.1 package has a lot of bugs that are fixed in 6.2.x and we will need to move to it sooner or later.