From 49933325cca5cfa32e03e06843774fa70fec64b5 Mon Sep 17 00:00:00 2001 From: Liangsheng Yin Date: Thu, 22 Oct 2026 21:44:01 -0700 Subject: [PATCH] [Perf] dspark: Combine the draft's mHC streams from bf16 without an fp32 copy (#45964) --- python/sglang/srt/models/deepseek_v4_dspark.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/models/deepseek_v4_dspark.py b/python/sglang/srt/models/deepseek_v4_dspark.py index 0b0a8c676b..ed763a9566 100644 --- a/python/sglang/srt/models/deepseek_v4_dspark.py +++ b/python/sglang/srt/models/deepseek_v4_dspark.py @@ -950,7 +950,8 @@ class DeepseekV4ForCausalLMDSpark(nn.Module): if self.hc_pre_from_prev_sublayer: from sglang.kernels.ops.layernorm.mhc import mhc_combine - x = mhc_combine(x.flatten(1).float(), pre, self.hc_mult, x.dtype) + # The kernel widens each element to fp32 as it loads it. + x = mhc_combine(x.flatten(1), pre, self.hc_mult, x.dtype) return LogitsProcessorOutput(next_token_logits=None, hidden_states=x) def collapse_hc_head(self, x: torch.Tensor) -> torch.Tensor: