Repository navigation
Add minimal Moore Threads MUSA GPU support via torchada - #1809
Open
Destinykami wants to merge 1 commit into
Open
Destinykami wants to merge 1 commit into
Destinykami wants to merge 1 commit into
Conversation
Conditionally import torchada when a MUSA-enabled PyTorch build is detected, before initializing diffsynth.core. This enables supported CUDA API calls to be redirected to MUSA without duplicating adapter imports across models or examples. Document MUSA setup and usage in the English and Chinese guides, including: - torch_musa prerequisites and torchada installation - Installation from the official DiffSynth-Studio repository - TORCHADA_FORCE_CUDA_AVAILABLE for CUDA-based device detection - Optional MUSA FlashAttention-3, MATE, and MATE-MUBIN dependencies - Version compatibility and third-party CUDA extension limitations
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.
Summary
Add a minimal integration with torchada to enable DiffSynth-Studio to run supported CUDA-oriented code paths on Moore Threads MUSA GPUs.
The adapter is initialized once at the package entry point, avoiding repeated imports or device-specific changes across models, pipelines, and examples.
Changes
Conditional adapter initialization
getattr(torch.version, "musa", None).torchadabefore initializingdiffsynth.core, allowing its CUDA API redirection to take effect before device detection and other initialization.torchadais not added as a mandatory dependency.Installation and usage documentation
Add MUSA instructions to the English and Chinese
Setup.mdandGPU_support.mdguides, covering:torch_musaprerequisites.torchadaand DiffSynth-Studio from the official repository.TORCHADA_FORCE_CUDA_AVAILABLE=1before launch for code paths that rely ontorch.cuda.is_available(), including DiffSynth-Studio's automatic device detection.Scope
This PR is limited to adapter initialization and documentation.
It does not introduce model-specific patches, attention backend fixes, distributed checkpoint fixes, training optimizations, or changes to the project's dependency requirements. It also does not force environment variables or override attention backend selection in library code.
Validation
Conditional import tests
torchada.torchadabeforediffsynth.core.torchadaon a MUSA build produces an explicit import error.git diff --checkpass.MUSA hardware smoke test
Tested the PR source in an isolated directory on one Moore Threads MTT S5000 GPU, using:
2.7.1.post12.7.1.post10.1.102TORCHADA_FORCE_CUDA_AVAILABLE=1The test script did not manually import
torchada; it was loaded automatically byimport diffsynth.Verified:
device="cuda"were allocated on MUSA.attention_forwardcompleted BF16 forward and backward passes with finite outputs and Q/K/V gradients, using input shape[1, 4, 128, 64].flash_attention_2, was used without a backend override.Validation Limitations
0.1.102; the documented installation recommendation is>=0.1.106.