[XPU] Fix/kimi linear xpu (#34546)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Singh <rohitsi2@iil-login.iind.intel.com>
Co-authored-by: Singh <rohitsi2@iil-gnrap02.iind.intel.com>
This commit is contained in:
Rohit Kumar Singh
2026-08-20 12:43:41 +08:00
committed by GitHub
co-authored by github-actions[bot] Singh Singh
parent db2eb47500
commit a5a9d66baf
3 changed files with 9 additions and 5 deletions
@@ -5,7 +5,7 @@ import torch
from sglang.srt.layers.attention.linear.kernels.kernel_backend import (
LinearAttnKernelBase,
)
from sglang.srt.utils import is_cpu, is_npu
from sglang.srt.utils import is_cpu, is_npu, is_xpu
if not is_cpu():
from sglang.kernels.ops.attention.fla.fused_recurrent import (
@@ -23,7 +23,10 @@ if not is_cpu():
class TritonKDAKernel(LinearAttnKernelBase):
"""Triton-based kernel for KDA (Kimi Delta Attention) linear attention."""
supports_packed_decode: bool = not is_cpu() and not is_npu()
# XPU has no tvm_ffi CUDA JIT kernel for KDA packed decode; route XPU to the
# non-packed Triton decode() path (fused_sigmoid_gating_delta_rule_update),
# the same fallback CPU/NPU use. Batched decode is handled via query_start_loc.
supports_packed_decode: bool = not is_cpu() and not is_npu() and not is_xpu()
def packed_decode(
self,
+2 -1
View File
@@ -1741,7 +1741,8 @@ def biased_grouped_topk_gpu(
topk_indices,
gating_output,
renormalize,
correction_bias,
# The XPU topk_sigmoid AOT kernel requires an fp32 correction bias.
correction_bias.to(torch.float32),
scale,
)
+2 -2
View File
@@ -49,7 +49,7 @@ from sglang.srt.models.deepseek_v2 import DeepseekV2AttentionMLA as KimiMLAAtten
from sglang.srt.models.llama import LlamaMLP as KimiMLP
from sglang.srt.models.transformers import maybe_prefix
from sglang.srt.runtime_context import get_parallel, get_stream
from sglang.srt.utils import make_layers
from sglang.srt.utils import is_xpu, make_layers
from sglang.srt.utils.common import BumpAllocator, add_prefix, set_weight_attrs
@@ -550,7 +550,7 @@ class KimiLinearModel(nn.Module):
else:
self.embed_tokens = PPMissingLayer()
self.alt_stream = get_stream("alt")
self.alt_stream = None if is_xpu() else get_stream("alt")
self.layers, self.start_layer, self.end_layer = make_layers(
config.num_hidden_layers,