[Feature] Migrate moe sp support to non-torch compiled path for GLM5.2 (#47881)
Signed-off-by: yewentao256 <zhyanwentao@126.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent
eb33ff34dd
commit
4238b011a7
@@ -122,7 +122,9 @@ class TrtLlmFp8ExpertsBase:
|
||||
return (
|
||||
not moe_parallel_config.use_all2all_kernels
|
||||
or moe_parallel_config.use_ag_rs_all2all_kernels
|
||||
) and not moe_parallel_config.enable_eplb
|
||||
) and not (
|
||||
moe_parallel_config.enable_eplb or moe_parallel_config.is_sequence_parallel
|
||||
)
|
||||
|
||||
|
||||
class TrtLlmFp8ExpertsModular(TrtLlmFp8ExpertsBase, mk.FusedMoEExpertsModular):
|
||||
|
||||
@@ -45,9 +45,10 @@ def _restore_full_token_layout_if_needed(
|
||||
hidden_states: torch.Tensor,
|
||||
residual: torch.Tensor,
|
||||
num_tokens: int,
|
||||
is_sequence_parallel: bool = False,
|
||||
) -> tuple[torch.Tensor, torch.Tensor]:
|
||||
"""Restore full token rows for the MTP proposer after SP MoE layers."""
|
||||
if hidden_states.shape[0] == num_tokens:
|
||||
if not is_sequence_parallel and hidden_states.shape[0] == num_tokens:
|
||||
return hidden_states, residual
|
||||
|
||||
combined_states = torch.cat([hidden_states, residual], dim=-1)
|
||||
@@ -142,6 +143,7 @@ class DeepSeekMultiTokenPredictorLayer(nn.Module):
|
||||
hidden_states,
|
||||
residual,
|
||||
positions.shape[0],
|
||||
is_sequence_parallel=self.mtp_block.use_sequence_parallel_moe,
|
||||
)
|
||||
hidden_states = residual + hidden_states # pre-final-norm (logits hidden)
|
||||
# Recycle the post-final-norm hidden into the next draft step.
|
||||
|
||||
Reference in New Issue
Block a user