Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MUSA support #172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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