| 1 | # SPDX-License-Identifier: Apache-2.0 |
| 2 | # SPDX-FileCopyrightText: Copyright contributors to the vLLM project |
| 3 | """DeepSeek V3.2 (``deepseek_v32``) platform entry point. |
| 4 | |
| 5 | DeepSeek V3.2 introduced the DeepSeek Sparse Attention (DSA) architecture: |
| 6 | MLA + a "lightning indexer" that selects the top-k tokens for a sparse MLA |
| 7 | attend. The same model code serves any DSA checkpoint, including GLM-5.2 |
| 8 | (``glm_moe_dsa``), which reuses this architecture. |
| 9 | |
| 10 | The CUDA and ROCm implementations select capability-specific kernels |
| 11 | internally and fall back when an optimization is unavailable. Other platforms |
| 12 | use the generic implementation by default. |
| 13 | """ |
| 14 | |
| 15 | from vllm.platforms import current_platform |
| 16 | |
| 17 | if current_platform.is_cuda(): |
| 18 | # GLM-5.2 (glm_moe_dsa) reuses the CUDA DSA module. Individual optimized |
| 19 | # kernels remain gated on the device capabilities they support. |
| 20 | from .nvidia.model import DeepseekV32ForCausalLM |
| 21 | from .nvidia.model import DeepseekV32ForCausalLM as GlmMoeDsaForCausalLM |
| 22 | from .nvidia.mtp import DeepseekV32MTP |
| 23 | elif current_platform.is_rocm(): |
| 24 | from .amd.model import DeepseekV32ForCausalLM |
| 25 | from .amd.model import DeepseekV32ForCausalLM as GlmMoeDsaForCausalLM |
| 26 | from .amd.mtp import DeepseekV32MTP |
| 27 | else: |
| 28 | # XPU and CPU keep the generic implementation. |
| 29 | from vllm.model_executor.models.deepseek_mtp import DeepSeekMTP as DeepseekV32MTP |
| 30 | from vllm.model_executor.models.deepseek_v2 import ( |
| 31 | DeepseekV3ForCausalLM as DeepseekV32ForCausalLM, |
| 32 | ) |
| 33 | from vllm.model_executor.models.deepseek_v2 import GlmMoeDsaForCausalLM |
| 34 | |
| 35 | __all__ = [ |
| 36 | "DeepseekV32ForCausalLM", |
| 37 | "DeepseekV32MTP", |
| 38 | "GlmMoeDsaForCausalLM", |
| 39 | ] |