Fix MUSA detection in compiled prefill path (#39061)

This commit is contained in:
Jan Bernlöhr
2026-09-13 21:23:51 -07:00
committed by GitHub
parent f2111715cd
commit 60f6f03409
4 changed files with 45 additions and 7 deletions
@@ -115,13 +115,14 @@ def should_use_dsa_fused_topk(seed_dsa_topk_from_draft_extend: bool) -> bool:
def is_dsa_enable_prefill_cp():
if get_parallel().attn_cp_size <= 1:
return False
if is_hip() or is_npu() or is_musa():
return False
# Generic prefill CP derives activation from the runtime topology and model
# architecture.
if get_parallel().attn_cp_size <= 1:
return False
from sglang.srt.configs.model_config import is_deepseek_dsa, is_deepseek_v4
hf_config = process_model_config().hf_config
+9 -5
View File
@@ -221,13 +221,17 @@ def is_cpu() -> bool:
return os.getenv("SGLANG_USE_CPU_ENGINE", "0") == "1" and is_host_cpu_supported
try:
import torchada # noqa: F401
except ImportError:
_IS_MUSA = False
else:
_IS_MUSA = hasattr(torch.version, "musa") and torch.version.musa is not None
@lru_cache(maxsize=1)
def is_musa() -> bool:
try:
import torchada # noqa: F401
except ImportError:
return False
return hasattr(torch.version, "musa") and torch.version.musa is not None
return _IS_MUSA
@lru_cache(maxsize=1)