mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2024-12-20 05:07:52 +00:00
cmake : fix HIP/ROCm build (#2102)
This commit is contained in:
parent
30f73109b8
commit
2ced6f0742
@ -370,16 +370,18 @@ if (WHISPER_HIPBLAS)
|
|||||||
|
|
||||||
if (${hipblas_FOUND} AND ${hip_FOUND})
|
if (${hipblas_FOUND} AND ${hip_FOUND})
|
||||||
message(STATUS "HIP and hipBLAS found")
|
message(STATUS "HIP and hipBLAS found")
|
||||||
add_compile_definitions(GGML_USE_HIPBLAS GGML_USE_CUDA)
|
set(GGML_HEADERS_ROCM "ggml-cuda.h")
|
||||||
add_library(ggml-rocm OBJECT ggml-cuda.cu ggml-cuda.h)
|
|
||||||
set_property(TARGET ggml-rocm PROPERTY POSITION_INDEPENDENT_CODE ON)
|
|
||||||
set_source_files_properties(ggml-cuda.cu PROPERTIES LANGUAGE CXX)
|
|
||||||
target_link_libraries(ggml-rocm PRIVATE hip::device PUBLIC hip::host roc::rocblas roc::hipblas)
|
|
||||||
|
|
||||||
|
file(GLOB GGML_SOURCES_ROCM "ggml-cuda/*.cu")
|
||||||
|
list(APPEND GGML_SOURCES_ROCM "ggml-cuda.cu")
|
||||||
|
|
||||||
|
add_compile_definitions(GGML_USE_HIPBLAS GGML_USE_CUDA)
|
||||||
|
|
||||||
|
set_source_files_properties(${GGML_SOURCES_ROCM} PROPERTIES LANGUAGE CXX)
|
||||||
if (WHISPER_STATIC)
|
if (WHISPER_STATIC)
|
||||||
message(FATAL_ERROR "Static linking not supported for HIP/ROCm")
|
message(FATAL_ERROR "Static linking not supported for HIP/ROCm")
|
||||||
endif()
|
endif()
|
||||||
set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} ggml-rocm)
|
set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} hip::device PUBLIC hip::host roc::rocblas roc::hipblas)
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "hipBLAS or HIP not found. Try setting CMAKE_PREFIX_PATH=/opt/rocm")
|
message(FATAL_ERROR "hipBLAS or HIP not found. Try setting CMAKE_PREFIX_PATH=/opt/rocm")
|
||||||
endif()
|
endif()
|
||||||
@ -647,12 +649,15 @@ add_library(${TARGET}
|
|||||||
${GGML_SOURCES_METAL}
|
${GGML_SOURCES_METAL}
|
||||||
${GGML_SOURCES_CUDA}
|
${GGML_SOURCES_CUDA}
|
||||||
${GGML_SOURCES_OPENCL}
|
${GGML_SOURCES_OPENCL}
|
||||||
${GGML_SOURCES_SYCL}
|
${GGML_SOURCES_SYCL} ${GGML_HEADERS_SYCL}
|
||||||
${GGML_HEADERS_SYCL}
|
${GGML_SOURCES_ROCM} ${GGML_HEADERS_ROCM}
|
||||||
whisper.h
|
whisper.h
|
||||||
whisper.cpp
|
whisper.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
include_directories (
|
||||||
|
.
|
||||||
|
)
|
||||||
# Set the version numbers
|
# Set the version numbers
|
||||||
set_target_properties(whisper PROPERTIES
|
set_target_properties(whisper PROPERTIES
|
||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
|
Loading…
Reference in New Issue
Block a user