aldorof commited on
Commit
a90ae59
·
unverified ·
1 Parent(s): 933eb40

cmake : fix HIP/ROCm build (#2102)

Browse files
Files changed (1) hide show
  1. CMakeLists.txt +12 -7
CMakeLists.txt CHANGED
@@ -370,16 +370,18 @@ if (WHISPER_HIPBLAS)
370
 
371
  if (${hipblas_FOUND} AND ${hip_FOUND})
372
  message(STATUS "HIP and hipBLAS found")
 
 
 
 
 
373
  add_compile_definitions(GGML_USE_HIPBLAS GGML_USE_CUDA)
374
- add_library(ggml-rocm OBJECT ggml-cuda.cu ggml-cuda.h)
375
- set_property(TARGET ggml-rocm PROPERTY POSITION_INDEPENDENT_CODE ON)
376
- set_source_files_properties(ggml-cuda.cu PROPERTIES LANGUAGE CXX)
377
- target_link_libraries(ggml-rocm PRIVATE hip::device PUBLIC hip::host roc::rocblas roc::hipblas)
378
 
 
379
  if (WHISPER_STATIC)
380
  message(FATAL_ERROR "Static linking not supported for HIP/ROCm")
381
  endif()
382
- set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} ggml-rocm)
383
  else()
384
  message(FATAL_ERROR "hipBLAS or HIP not found. Try setting CMAKE_PREFIX_PATH=/opt/rocm")
385
  endif()
@@ -647,12 +649,15 @@ add_library(${TARGET}
647
  ${GGML_SOURCES_METAL}
648
  ${GGML_SOURCES_CUDA}
649
  ${GGML_SOURCES_OPENCL}
650
- ${GGML_SOURCES_SYCL}
651
- ${GGML_HEADERS_SYCL}
652
  whisper.h
653
  whisper.cpp
654
  )
655
 
 
 
 
656
  # Set the version numbers
657
  set_target_properties(whisper PROPERTIES
658
  VERSION ${PROJECT_VERSION}
 
370
 
371
  if (${hipblas_FOUND} AND ${hip_FOUND})
372
  message(STATUS "HIP and hipBLAS found")
373
+ set(GGML_HEADERS_ROCM "ggml-cuda.h")
374
+
375
+ file(GLOB GGML_SOURCES_ROCM "ggml-cuda/*.cu")
376
+ list(APPEND GGML_SOURCES_ROCM "ggml-cuda.cu")
377
+
378
  add_compile_definitions(GGML_USE_HIPBLAS GGML_USE_CUDA)
 
 
 
 
379
 
380
+ set_source_files_properties(${GGML_SOURCES_ROCM} PROPERTIES LANGUAGE CXX)
381
  if (WHISPER_STATIC)
382
  message(FATAL_ERROR "Static linking not supported for HIP/ROCm")
383
  endif()
384
+ set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} hip::device PUBLIC hip::host roc::rocblas roc::hipblas)
385
  else()
386
  message(FATAL_ERROR "hipBLAS or HIP not found. Try setting CMAKE_PREFIX_PATH=/opt/rocm")
387
  endif()
 
649
  ${GGML_SOURCES_METAL}
650
  ${GGML_SOURCES_CUDA}
651
  ${GGML_SOURCES_OPENCL}
652
+ ${GGML_SOURCES_SYCL} ${GGML_HEADERS_SYCL}
653
+ ${GGML_SOURCES_ROCM} ${GGML_HEADERS_ROCM}
654
  whisper.h
655
  whisper.cpp
656
  )
657
 
658
+ include_directories (
659
+ .
660
+ )
661
  # Set the version numbers
662
  set_target_properties(whisper PROPERTIES
663
  VERSION ${PROJECT_VERSION}