HIP icon indicating copy to clipboard operation
HIP copied to clipboard

[Issue]: Windows HIP SDK CMake HIP language support not working

Open Engininja2 opened this issue 11 months ago • 1 comments

Problem Description

When using Visual Studio 2022 CMake to compile a project (llama.cpp PR#5966) that uses enable_language(HIP) with the HIP 5.7 SDK I get the following error:

CMake Error at C:/Program Files/AMD/ROCm/5.7/lib/cmake/hip-lang/hip-lang-targets.cmake:82 (message):
  The imported target "hip-lang::amdhip64" references the file
     "C:/constructicon/builds/gfx/two/23.30/drivers/compute/install/native/Release/x64/hip/lib/amdhip64.lib"
  but this file does not exist.

hip-lang-targets.cmake has this line:

# The installation prefix configured by this project.
set(_IMPORT_PREFIX "C:/constructicon/builds/gfx/two/23.10/drivers/compute/install/native/Release/x64/hip")`

Could you please fix this for future releases? There's also the path to amdhip64.dll that needs to be set in hip-lang-targets-release.cmake

Operating System

Windows 10.0.19045

CPU

AMD Ryzen 7 5700X 8-Core Processor

GPU

AMD Radeon VII

ROCm Version

ROCm 5.7.1

ROCm Component

HIP

Steps to Reproduce

Create a folder with a minimal CMakeLists.txt:

cmake_minimum_required(VERSION 3.21)
project(test)
enable_language(HIP)

Add the HIP 5.7 SDK \bin folder to your PATH if it isn't there already. Run the x64 Native Tools Command Prompt for VS 2022. in that folder, run cmake -B build . -G Ninja -DCMAKE_C_COMPILER=clang.exe -DCMAKE_CXX_COMPILER=clang++.exe

(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support

No response

Additional Information

C:\Program Files\AMD\ROCm\5.7\bin is in my PATH and compiling software for HIP using CMake but without using enable_language(HIP) works. The GPU selection isn't relevant but I had to pick one to submit this issue.

Engininja2 avatar Mar 20 '24 04:03 Engininja2

I found a similar problem #2996 in ROCm

Gardene-el avatar Apr 28 '24 01:04 Gardene-el

Hi @Engininja2, it is recommended to use find_package(hip) rather than enable_language(hip). I will close this ticket as it is a duplicate, please refer to https://github.com/ROCm/ROCm/issues/2996 to track this issue. Thanks!

harkgill-amd avatar Jun 26 '24 20:06 harkgill-amd