fix(mtp): avoid mtp perf regression in deepseek when enable eplb (#28982)
Co-authored-by: chunjiang.hc <chunjiang.hc@alibaba-inc.com>
This commit is contained in:
@@ -939,7 +939,7 @@ class DeepseekV2MoE(nn.Module):
|
|||||||
server_args = get_server_args()
|
server_args = get_server_args()
|
||||||
dispatch_info = (
|
dispatch_info = (
|
||||||
ExpertLocationDispatchInfo.init_new(layer_id=self.layer_id)
|
ExpertLocationDispatchInfo.init_new(layer_id=self.layer_id)
|
||||||
if server_args.enable_eplb
|
if server_args.enable_eplb and not self.is_nextn
|
||||||
else None
|
else None
|
||||||
)
|
)
|
||||||
with torch.cuda.stream(self.alt_stream):
|
with torch.cuda.stream(self.alt_stream):
|
||||||
@@ -1036,7 +1036,7 @@ class DeepseekV2MoE(nn.Module):
|
|||||||
server_args = get_server_args()
|
server_args = get_server_args()
|
||||||
dispatch_info = (
|
dispatch_info = (
|
||||||
ExpertLocationDispatchInfo.init_new(layer_id=self.layer_id)
|
ExpertLocationDispatchInfo.init_new(layer_id=self.layer_id)
|
||||||
if server_args.enable_eplb
|
if server_args.enable_eplb and not self.is_nextn
|
||||||
else None
|
else None
|
||||||
)
|
)
|
||||||
defer_shared = not self.experts.moe_runner_config.inplace
|
defer_shared = not self.experts.moe_runner_config.inplace
|
||||||
@@ -1237,8 +1237,12 @@ class DeepseekV2MoE(nn.Module):
|
|||||||
hidden_states,
|
hidden_states,
|
||||||
router_logits,
|
router_logits,
|
||||||
num_token_non_padded=forward_batch.num_token_non_padded,
|
num_token_non_padded=forward_batch.num_token_non_padded,
|
||||||
expert_location_dispatch_info=ExpertLocationDispatchInfo.init_new(
|
expert_location_dispatch_info=(
|
||||||
layer_id=self.layer_id,
|
ExpertLocationDispatchInfo.init_new(
|
||||||
|
layer_id=self.layer_id,
|
||||||
|
)
|
||||||
|
if not self.is_nextn
|
||||||
|
else None
|
||||||
),
|
),
|
||||||
**topk_kwargs,
|
**topk_kwargs,
|
||||||
)
|
)
|
||||||
@@ -1471,8 +1475,12 @@ class DeepseekV2MoE(nn.Module):
|
|||||||
hidden_states=hidden_states,
|
hidden_states=hidden_states,
|
||||||
router_logits=router_logits,
|
router_logits=router_logits,
|
||||||
num_token_non_padded=state.forward_batch.num_token_non_padded,
|
num_token_non_padded=state.forward_batch.num_token_non_padded,
|
||||||
expert_location_dispatch_info=ExpertLocationDispatchInfo.init_new(
|
expert_location_dispatch_info=(
|
||||||
layer_id=self.layer_id,
|
ExpertLocationDispatchInfo.init_new(
|
||||||
|
layer_id=self.layer_id,
|
||||||
|
)
|
||||||
|
if not self.is_nextn
|
||||||
|
else None
|
||||||
),
|
),
|
||||||
**topk_kwargs,
|
**topk_kwargs,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user