Skip to content

Commit

Permalink
Add MUSA support
Browse files Browse the repository at this point in the history
  • Loading branch information
dixyes committed Apr 16, 2024
1 parent d8f13ff commit b672975
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions CMakeLists.txt
Expand Up @@ -42,6 +42,7 @@ option(RWKV_OPENBLAS "rwkv: use OpenBLAS"
option(RWKV_CUBLAS "rwkv: use cuBLAS" OFF)
option(RWKV_CLBLAST "rwkv: use CLBlast" OFF)
option(RWKV_HIPBLAS "rwkv: use hipBLAS" OFF)
option(RWKV_MUSA "rwkv: use MUSA" OFF)

# Build only shared library without building tests and extras
option(RWKV_STANDALONE "rwkv: build only RWKV library" OFF)
Expand Down Expand Up @@ -232,6 +233,30 @@ if (RWKV_HIPBLAS)
endif()
endif()

if (RWKV_MUSA)
option(MUSA_ARCH "MUSA architecture" "21")

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/ggml/cmake")

find_package(MUSA REQUIRED)

message(STATUS "MUSA found")

enable_language(MUSA)

add_compile_definitions(GGML_USE_MUSA GGML_USE_CUDA GGML_USE_CUBLAS)

add_library(ggml-musa OBJECT
${CMAKE_SOURCE_DIR}/ggml/src/ggml-cuda.cu
${CMAKE_SOURCE_DIR}/ggml/src/ggml-cuda.h)

target_include_directories(ggml-musa PUBLIC ${CMAKE_SOURCE_DIR}/ggml/include/ggml)
set_source_files_properties(${CMAKE_SOURCE_DIR}/ggml/src/ggml-cuda.cu PROPERTIES LANGUAGE MUSA)
target_link_libraries(ggml-musa PRIVATE MUSA::musa MUSA::mublas MUSA::musart)

set(RWKV_EXTRA_LIBS ${RWKV_EXTRA_LIBS} ggml-musa)
endif()

if (RWKV_ALL_WARNINGS)
if (NOT MSVC)
set(c_flags
Expand Down
2 changes: 1 addition & 1 deletion ggml
Submodule ggml updated from 46f083 to 355e45

0 comments on commit b672975

Please sign in to comment.