[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1031540: marked as done (libamdhip64-dev: hip-lang cmake support is broken)



Your message dated Fri, 2 Jun 2023 19:53:06 -0600
with message-id <924cb93a-b7ff-c206-e897-f7da82ce0e6f@slerp.xyz>
and subject line FIXED: libamdhip64-dev: hip-lang cmake support is broken
has caused the Debian Bug report #1031540,
regarding libamdhip64-dev: hip-lang cmake support is broken
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
1031540: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1031540
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: libamdhip64-dev
Version: 5.2.3-4
Severity: normal
X-Debbugs-Cc: cgmb@slerp.xyz

Dear Maintainer,

The CMake support for the HIP language is badly broken. Consider a
sample project:

CMakeLists.txt

    CMakeLists.txt 
    cmake_minimum_required(VERSION 3.22)
    project(example LANGUAGES HIP)
    add_executable(ex main.hip)

main.hip:

    #include <hip/hip_runtime.h>
    #include <stdio.h>
    
    #define CHECK_HIP(expr) do {              \
      hipError_t result = (expr);             \
      if (result != hipSuccess) {             \
        fprintf(stderr, "%s:%d: %s (%d)\n",   \
          __FILE__, __LINE__,                 \
          hipGetErrorString(result), result); \
        exit(EXIT_FAILURE);                   \
      }                                       \
    } while(0)
    
    __global__ void sq_arr(float *arr, int n) {
      int tid = blockDim.x*blockIdx.x + threadIdx.x;
      if (tid < n) {
        arr[tid] = arr[tid] * arr[tid];
      }
    }
    
    int main() {
      enum { N = 5 };
      float hArr[N] = { 1, 2, 3, 4, 5 };
      float *dArr;
      CHECK_HIP(hipMalloc(&dArr, sizeof(float) * N));
      CHECK_HIP(hipMemcpy(dArr, hArr, sizeof(float) * N, hipMemcpyHostToDevice));
      sq_arr<<<dim3(1), dim3(32,1,1), 0, 0>>>(dArr, N);
      CHECK_HIP(hipMemcpy(hArr, dArr, sizeof(float) * N, hipMemcpyDeviceToHost));
      for (int i = 0; i < N; ++i) {
        printf("%f\n", hArr[i]);
      }
      CHECK_HIP(hipFree(dArr));
      return 0;
    }

Build log:

    # HIPCXX=clang++-15 cmake -S. -Bbuild
    -- The HIP compiler identification is unknown
    CMake Error at /usr/share/cmake-3.25/Modules/CMakeDetermineHIPCompiler.cmake:106 (message):
      The ROCm root directory:
    
       /usr
    
      does not contain the HIP runtime CMake package, expected at:
    
       /usr/lib/cmake/hip-lang/hip-lang-config.cmake
    
    Call Stack (most recent call first):
      CMakeLists.txt:2 (project)
    
    
    -- Configuring incomplete, errors occurred!
    See also "/root/hipsample/build/CMakeFiles/CMakeOutput.log".
    See also "/root/hipsample/build/CMakeFiles/CMakeError.log".

With a lot of patches, extra flags and environment variables, I was
able to get cmake support for the HIP langauge working, but it required
changes to both the libamdhip64-dev and cmake-data packages. Ideally,
there would also be changes to clang++-15 to search the Debian paths
by default for libamdhip64 and the rocm-device-libs.

-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-3-amd64 (SMP w/32 CPU threads; PREEMPT)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect

Versions of packages libamdhip64-dev depends on:
ii  libamdhip64-5        5.2.3-4
ii  libhiprtc-builtins5  5.2.3-4

libamdhip64-dev recommends no packages.

libamdhip64-dev suggests no packages.

-- no debconf information

--- End Message ---
--- Begin Message ---
Package: rocm-hipamd
Version: 5.2.3-5

The incorrect paths within the hip-lang cmake files were fixed in rocm-hipamd 5.2.3-5, and the incorrect paths within cmake itself were fixed in 3.26.4-3. Together those two changes fix this bug.

Sincerely,
Cory Bloor

--- End Message ---

Reply to: