[Intel GPU] Enable DeepSeek R1 inference on XPU (#18461)
Signed-off-by: P V R K Jyothendra Varma <polisetty.v.r.k.jyothendra.varma@intel.com>
This commit is contained in:
@@ -30,7 +30,12 @@ from sglang.srt.layers.moe.utils import (
|
||||
get_moe_runner_backend,
|
||||
should_use_flashinfer_cutlass_moe_fp4_allgather,
|
||||
)
|
||||
from sglang.srt.utils.common import get_bool_env_var, is_hip, is_sm120_supported
|
||||
from sglang.srt.utils.common import (
|
||||
get_bool_env_var,
|
||||
get_device,
|
||||
is_hip,
|
||||
is_sm120_supported,
|
||||
)
|
||||
|
||||
_is_hip = is_hip()
|
||||
_use_aiter = get_bool_env_var("SGLANG_USE_AITER") and _is_hip
|
||||
@@ -149,15 +154,16 @@ class StandardDispatcher(BaseDispatcher):
|
||||
and TopKOutputChecker.format_is_standard(topk_output)
|
||||
):
|
||||
if self.local_expert_mapping is None:
|
||||
device = get_device()
|
||||
self.local_expert_mapping = torch.full(
|
||||
(self.num_experts,), -1, dtype=torch.int32, device="cuda"
|
||||
(self.num_experts,), -1, dtype=torch.int32, device=device
|
||||
)
|
||||
self.local_expert_mapping[
|
||||
self.moe_ep_rank
|
||||
* self.num_local_routed_experts : (self.moe_ep_rank + 1)
|
||||
* self.num_local_routed_experts
|
||||
] = torch.arange(
|
||||
0, self.num_local_routed_experts, dtype=torch.int32, device="cuda"
|
||||
0, self.num_local_routed_experts, dtype=torch.int32, device=device
|
||||
)
|
||||
|
||||
if self.num_local_shared_experts > 0:
|
||||
|
||||
@@ -50,6 +50,7 @@ from sglang.srt.models.deepseek_common.utils import (
|
||||
_is_fp8_fnuz,
|
||||
_is_hip,
|
||||
_is_npu,
|
||||
_is_xpu,
|
||||
_use_aiter_gfx95,
|
||||
awq_dequantize_func,
|
||||
enable_nextn_moe_bf16_cast_to_fp8,
|
||||
@@ -497,7 +498,7 @@ class DeepseekV2WeightLoaderMixin:
|
||||
)
|
||||
|
||||
if (
|
||||
_is_cuda
|
||||
(_is_cuda or _is_xpu)
|
||||
and weight_block_size[0] == 128
|
||||
and weight_block_size[1] == 128
|
||||
):
|
||||
|
||||
@@ -31,6 +31,7 @@ from sglang.srt.utils import (
|
||||
is_hip,
|
||||
is_npu,
|
||||
is_nvidia_cublas_version_ge_12_9,
|
||||
is_xpu,
|
||||
)
|
||||
|
||||
_is_hip = is_hip()
|
||||
@@ -40,6 +41,7 @@ _is_fp8_fnuz = is_fp8_fnuz()
|
||||
_use_aiter = get_bool_env_var("SGLANG_USE_AITER") and _is_hip
|
||||
_is_cpu_amx_available = cpu_has_amx_support()
|
||||
_is_cpu = is_cpu()
|
||||
_is_xpu = is_xpu()
|
||||
_device_sm = get_device_sm()
|
||||
_is_gfx95_supported = is_gfx95_supported()
|
||||
_use_aiter_gfx95 = _use_aiter and _is_gfx95_supported
|
||||
|
||||
@@ -137,6 +137,7 @@ from sglang.srt.models.deepseek_common.utils import (
|
||||
_is_gfx95_supported,
|
||||
_is_hip,
|
||||
_is_npu,
|
||||
_is_xpu,
|
||||
_use_aiter,
|
||||
_use_aiter_gfx95,
|
||||
)
|
||||
@@ -677,6 +678,7 @@ class DeepseekV2MoE(nn.Module):
|
||||
)
|
||||
if (
|
||||
not _is_cuda
|
||||
and not _is_xpu
|
||||
and not _use_aiter
|
||||
or isinstance(self.experts.quant_method, KTEPWrapperMethod)
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user