feat: add MUSA support for FlexKV#126
Open
superleo wants to merge 1 commit into
Open
Conversation
- Add GPU backend abstraction layer (gpu_backend.py, gpu_runtime.py) for dispatching between CUDA and MUSA - Implement MUSA C++ extension (csrc/musa/): transfer kernels, GDS manager, layout transform, thread groups - Add build_config.py and extend setup.py for conditional MUSA build (FLEXKV_USE_MUSA=1) - Modify memory_handle.py, worker.py, allocator.py to use gpu_runtime for backend-agnostic stream/device/memory operations - Update vLLM and TensorRT-LLM adapters for backend dispatch - Add requirements-musa.txt and MUSA build/test documentation - Add tests: gpu_backend_dispatch, gpu_runtime, musa_build, transfer_musa
Collaborator
|
Hi @superleo. We appreciate your contribution :) Please wait for a moment. We are designing official abstraction and API for integrating variaous AI accelerators. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds support for MUSA as an alternative backend to CUDA in FlexKV.
Summary
Backend abstraction: Introduces
gpu_backend.pyandgpu_runtime.pyso Python code uses a single dispatch layer instead of scatteredtorch.cudacalls. This keeps the CUDA path unchanged and allows MUSA to be added without#ifdefin existing CUDA sources.MUSA C++ extension: Adds a parallel MUSA implementation under
csrc/musa/:transfer_musa.mu)bindings_musa.cpp)Build system: Adds
build_config.pyand updatessetup.pyto support conditional MUSA builds viaFLEXKV_USE_MUSA=1. CUDA and MUSA extensions can be built independently.Integration: Updates
memory_handle.py,worker.py,allocator.py, and the vLLM/TensorRT-LLM adapters to use the GPU runtime abstraction.Documentation: Adds
docs/musa/musa_support_system_design.mdanddocs/musa/musa_test_plan.md.Tests: Adds tests for backend dispatch, GPU runtime, MUSA build, and MUSA transfer.
Design principles
Testing
tests/test_gpu_backend_dispatch.py– backend selectiontests/test_gpu_runtime.py– runtime abstractiontests/test_musa_build.py– MUSA build (whenFLEXKV_USE_MUSA=1)tests/test_transfer_musa.py– MUSA transfer behavior