Skip to content

Compile bug: Using the latest llama.cpp code in github, having trouble compiling with rocm-6.3.0 release. #11498

@rlee3030

Description

@rlee3030

Git commit

Using the latest llama.cpp code in github, having trouble compiling with rocm-6.3.0 release.
Getting HIP compilation errors shown below. rocm-6.3.0 is configured correctly and the HIP compiler and tools are there but still getting these errors below. Specifically the below errors.

-- The HIP compiler identification is unknown
-- Detecting HIP compiler ABI info - failed
-- Check for working HIP compiler: /opt/rocm-6.3.0/lib/llvm/bin/clang - broken

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04
Codename: jammy

Kernel: 5.15.0-130-generic

Is there a way to verify if HIP is installed or working correctly so that cmake will work ?
Any help will be appreciated

Operating systems

Linux

GGML backends

HIP

Problem description & steps to reproduce

Using the instructions in llama.cpp for HIP compilation.
rocm-6.3.0 installed in /opt/rocm-6.3.0

Installed the latest llama.cpp /root/llama.cpp

All instructions in llama.cpp documentation was followed.

First Bad Commit

No response

Compile command

HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)"     cmake -S . -B build -DGGML_HIP=ON -DAMDGPU_TARGETS=gfx90a -DCMAKE_BUILD_TYPE=Release     && cmake --build build --config Release -- -j 16

Relevant log output

-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/local/bin/git (found version "2.17.1")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- ccache found, compilation results will be cached. Disable with GGML_CCACHE=OFF.
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- Including CPU backend
-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- x86 detected
-- Adding CPU backend variant ggml-cpu: -march=native
-- The HIP compiler identification is unknown
-- Detecting HIP compiler ABI info
-- Detecting HIP compiler ABI info - failed
-- Check for working HIP compiler: /opt/rocm-6.3.0/lib/llvm/bin/clang
-- Check for working HIP compiler: /opt/rocm-6.3.0/lib/llvm/bin/clang - broken
CMake Error at /usr/local/lib/python3.10/dist-packages/cmake/data/share/cmake-3.25/Modules/CMakeTestHIPCompiler.cmake:66 (message):
  The HIP compiler

    "/opt/rocm-6.3.0/lib/llvm/bin/clang"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /root/llama.cpp/build/CMakeFiles/CMakeScratch/TryCompile-Vqt9nx

    Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_6e9f2/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_6e9f2.dir/build.make CMakeFiles/cmTC_6e9f2.dir/build
    gmake[1]: Entering directory '/root/llama.cpp/build/CMakeFiles/CMakeScratch/TryCompile-Vqt9nx'
    Building HIP object CMakeFiles/cmTC_6e9f2.dir/testHIPCompiler.hip.o
    /opt/rocm-6.3.0/lib/llvm/bin/clang -D__HIP_ROCclr__=1 -I/opt/rocm-6.3.0/include --cuda-host-only  --offload-arch=gfx90a -o CMakeFiles/cmTC_6e9f2.dir/testHIPCompiler.hip.o  -c /root/llama.cpp/build/CMakeFiles/CMakeScratch/TryCompile-Vqt9nx/testHIPCompiler.hip
    In file included from <built-in>:1:
    In file included from /opt/rocm-6.3.0/lib/llvm/lib/clang/18/include/__clang_hip_runtime_wrapper.h:111:
    /opt/rocm-6.3.0/lib/llvm/lib/clang/18/include/cuda_wrappers/cmath:27:15: fatal error: 'cmath' file not found
       27 | #include_next <cmath>
          |               ^~~~~~~
    1 error generated when compiling for host.
    gmake[1]: *** [CMakeFiles/cmTC_6e9f2.dir/build.make:78: CMakeFiles/cmTC_6e9f2.dir/testHIPCompiler.hip.o] Error 1
    gmake[1]: Leaving directory '/root/llama.cpp/build/CMakeFiles/CMakeScratch/TryCompile-Vqt9nx'
    gmake: *** [Makefile:127: cmTC_6e9f2/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  ggml/src/ggml-hip/CMakeLists.txt:36 (enable_language)


-- Configuring incomplete, errors occurred!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions