[DeepSeek 3.2] Support and optimize pipeline parallelis when context pipeline enabled (#16380)
Co-authored-by: ybyang <ybyang7@iflytek.com>
This commit is contained in:
@@ -504,6 +504,10 @@ class SchedulerPPMixin:
|
||||
|
||||
def init_pp_loop_state(self: Scheduler):
|
||||
self.pp_loop_size: int = self.pp_size + self.server_args.pp_async_batch_depth
|
||||
# In CP mode, attention weights are duplicated, eliminating the need for the attention TP all-gather operation.
|
||||
self.require_attn_tp_allgather = (
|
||||
not self.server_args.enable_nsa_prefill_context_parallel
|
||||
)
|
||||
self.mbs = [None] * self.pp_loop_size
|
||||
self.last_mbs = [None] * self.pp_loop_size
|
||||
self.running_mbs = [
|
||||
@@ -906,7 +910,9 @@ class SchedulerPPMixin:
|
||||
p2p_work.extend(
|
||||
self.pp_group.send_tensor_dict(
|
||||
tensor_dict=tensor_dict,
|
||||
all_gather_group=self.attn_tp_group,
|
||||
all_gather_group=(
|
||||
self.attn_tp_group if self.require_attn_tp_allgather else None
|
||||
),
|
||||
async_send=async_send,
|
||||
)
|
||||
)
|
||||
@@ -916,7 +922,11 @@ class SchedulerPPMixin:
|
||||
pp_proxy_tensors = None
|
||||
if not self.pp_group.is_first_rank:
|
||||
pp_proxy_tensors = PPProxyTensors(
|
||||
self.pp_group.recv_tensor_dict(all_gather_group=self.attn_tp_group)
|
||||
self.pp_group.recv_tensor_dict(
|
||||
all_gather_group=(
|
||||
self.attn_tp_group if self.require_attn_tp_allgather else None
|
||||
)
|
||||
)
|
||||
)
|
||||
return pp_proxy_tensors
|
||||
|
||||
@@ -924,7 +934,9 @@ class SchedulerPPMixin:
|
||||
self: Scheduler,
|
||||
) -> Dict[str, torch.Tensor]:
|
||||
res = self.pp_group.recv_tensor_dict(
|
||||
all_gather_group=self.attn_tp_group,
|
||||
all_gather_group=(
|
||||
self.attn_tp_group if self.require_attn_tp_allgather else None
|
||||
),
|
||||
)
|
||||
return res
|
||||
|
||||
|
||||
Reference in New Issue
Block a user