Package: cmake-data Version: 3.25.1-1 Severity: normal X-Debbugs-Cc: c...@slerp.xyz, debian...@lists.debian.org
Dear Maintainer, It is not possible to use CMake's HIP language support together with the Debian package for HIP. Consider this sample project: CMakeLists.txt: cmake_minimum_required(VERSION 3.22) project(example LANGUAGES HIP) add_executable(ex main.hip) main.hip: #include <stdio.h> #include <stdlib.h> #include <hip/hip_runtime.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: # apt install hipcc cmake # HIPFLAGS="--rocm-path=/usr --rocm-device-lib-path=/usr/lib/x86_64-linux-gnu/amdgcn/bitcode" \ HIPCXX=clang++-15 cmake -S. -Bbuild --debug-output \ -DCMAKE_LIBRARY_ARCHITECTURE=x86_64-linux-gnu Running with debug output on. -- The HIP compiler identification is Clang 15.0.7 Called from: [3] /usr/share/cmake-3.25/Modules/CMakeDetermineCompilerId.cmake [2] /usr/share/cmake-3.25/Modules/CMakeDetermineHIPCompiler.cmake [1] /root/CMakeLists.txt 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) Called from: [2] /usr/share/cmake-3.25/Modules/CMakeDetermineHIPCompiler.cmake [1] /root/CMakeLists.txt -- Configuring incomplete, errors occurred! This error is because when provided as part of the libamdhip64-dev package, the HIP runtime CMake package is installed to /usr/lib/$(DEB_HOST_MULTIARCH)/cmake/hip-lang/hip-lang-config.cmake CMake should probably check both locations to ensure compatibility with the layout of both the upstream ROCm project and the Debian HIP package. In total, this path appears in three places: /usr/share/cmake-3.25/Modules/CMakeDetermineHIPCompiler.cmake:105 /usr/share/cmake-3.25/Modules/CMakeDetermineHIPCompiler.cmake:110 /usr/share/cmake-3.25/Modules/CMakeHIPInformation.cmake:145 Sincerely, Cory Bloor -- 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 -- no debconf information