From 987d743d6bc4cee4bde6820733ea33a2abc0afac Mon Sep 17 00:00:00 2001 From: Daniele <57776841+daniandtheweb@users.noreply.github.com> Date: Tue, 4 Jun 2024 12:09:15 +0000 Subject: [PATCH] Improve hipBLAS support in CMake (#7696) * Improve hipBLAS support in CMake This improves the detection of the correct CMAKE_PREFIX_PATH when using different distributions or a self-built ROCm SDK. * Set ROCM_PATH correctly --- CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 620305ca7..76ea27412 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -557,12 +557,17 @@ if (LLAMA_VULKAN) endif() if (LLAMA_HIPBLAS) - if ($ENV{ROCM_PATH}) - set(ROCM_PATH $ENV{ROCM_PATH}) + if (NOT EXISTS $ENV{ROCM_PATH}) + if (NOT EXISTS /opt/rocm) + set(ROCM_PATH /usr) + else() + set(ROCM_PATH /opt/rocm) + endif() else() - set(ROCM_PATH /opt/rocm) + set(ROCM_PATH $ENV{ROCM_PATH}) endif() list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}) + list(APPEND CMAKE_PREFIX_PATH "${ROCM_PATH}/lib64/cmake") # CMake on Windows doesn't support the HIP language yet if(WIN32)