Skip to content

Commit 85fd62c

Browse files
committed
try update cmake for rocm hipblas (not sure if working)
1 parent 89a3742 commit 85fd62c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,13 @@ endif()
152152

153153
if (LLAMA_HIPBLAS)
154154
if (MSVC)
155-
list(APPEND CMAKE_PREFIX_PATH "C:/Program Files/AMD/ROCm/5.5")
155+
execute_process(COMMAND powershell.exe -Command "Get-ChildItem 'C:/Program Files/AMD/ROCm/' | Sort-Object {$_.Version} | Select-Object -Last 1 | ForEach-Object { Write-Output $_.FullName }"
156+
OUTPUT_VARIABLE ROCM_PATH
157+
OUTPUT_STRIP_TRAILING_WHITESPACE
158+
)
159+
list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH})
160+
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-xhip>")
161+
message(STATUS "ROCM_PATH: ${ROCM_PATH}")
156162
else()
157163
list(APPEND CMAKE_PREFIX_PATH /opt/rocm)
158164
endif()
@@ -177,7 +183,7 @@ if (LLAMA_HIPBLAS)
177183
list(APPEND GGML_SOURCES_ROCM ${SRCS})
178184
file(GLOB SRCS "ggml/src/ggml-cuda/template-instances/mmq*.cu")
179185
list(APPEND GGML_SOURCES_ROCM ${SRCS})
180-
add_compile_definitions(GGML_USE_HIP GGML_USE_CUDA SD_USE_CUDA)
186+
add_compile_definitions(GGML_USE_HIP GGML_USE_CUDA SD_USE_CUDA GGML_HIP_NO_VMM)
181187
add_library(ggml-rocm ${GGML_SOURCES_CUDA})
182188

183189
file(GLOB SRCS "ggml/src/ggml-cuda/template-instances/fattn-vec*q4_0-q4_0.cu")
@@ -206,7 +212,7 @@ if (LLAMA_HIPBLAS)
206212
if (LLAMA_STATIC)
207213
message(FATAL_ERROR "Static linking not supported for HIP/ROCm")
208214
endif()
209-
set(LLAMA_EXTRA_LIBS ${LLAMA_EXTRA_LIBS} ggml-rocm ggml-v2-rocm ggml-v2-legacy-rocm)
215+
set(LLAMA_EXTRA_LIBS ${LLAMA_EXTRA_LIBS} ggml-rocm ggml-v2-rocm ggml-v3-rocm ggml-v2-legacy-rocm)
210216
else()
211217
message(WARNING "hipBLAS or HIP not found. Try setting CMAKE_PREFIX_PATH=/opt/rocm")
212218
endif()

0 commit comments

Comments
 (0)