[Perf][GLM-5.3-Flash] Decode hot-path cleanups: strided KDA recurrent inputs, NoPE MQA query without concat, no duplicate router GEMM (#55736)

Signed-off-by: Jared Wen <jaredwen@inferact.ai>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Jared Wen
2026-09-10 16:28:33 +08:00
committed by GitHub
co-authored by Claude Fable 5.1
parent b47b01cf33
commit 1768273c13
8 changed files with 268 additions and 27 deletions
+4 -4
View File
@@ -259,11 +259,11 @@ class Glm5NextMoE(nn.Module):
if self.is_sequence_parallel and not already_sequence_parallel:
hidden_states = sequence_parallel_chunk(hidden_states)
# The router is always external (self.gate); main's MoERunner expects
# pre-computed router_logits, so compute them here unconditionally.
router_logits, _ = self.gate(hidden_states)
# MoERunner holds the gate (passed to FusedMoEFactory) and computes
# the router logits itself, so nothing is precomputed here (matches
# DeepseekV2MoE; `router_logits` is a placeholder).
final_hidden_states = self.experts(
hidden_states=hidden_states, router_logits=router_logits
hidden_states=hidden_states, router_logits=hidden_states
)
if self.is_sequence_parallel and not already_sequence_parallel: