[MUSA][4/N] Add common device utilities, distributed backend, and custom op wiring (#17246)

Signed-off-by: Xiaodong Ye <xiaodong.ye@mthreads.com>
This commit is contained in:
R0CKSTAR
2026-01-29 15:13:24 +08:00
committed by GitHub
parent 9409c43593
commit d3cdee0a04
7 changed files with 109 additions and 11 deletions

View File

@@ -53,6 +53,12 @@ class CustomOp(nn.Module):
# NOTE(woosuk): This is a placeholder for future extensions.
return self.forward_native(*args, **kwargs)
def forward_musa(self, *args, **kwargs) -> Any:
# XXX (MUSA): MUSA kernels follow the CUDA path by default.
# At this stage, sgl-kernel support for MUSA is still under active
# development, so we fall back to the PyTorch-native implementation.
return self.forward_native(*args, **kwargs)
def forward_oot(self, *args, **kwargs) -> Any:
# By default, we assume that OOT ops are compatible with the
# PyTorch-native implementation.
@@ -67,6 +73,8 @@ class CustomOp(nn.Module):
return self.forward_npu
elif current_platform.is_xpu():
return self.forward_xpu
elif current_platform.is_musa():
return self.forward_musa
else:
return self.forward_native