Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
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