Skip to content

Commit 7b2e71b

Browse files
authored
[Transformer][UCC] Fix async p2p ops (#1691)
* fix async ucc * apply pep preferred way * Revert "apply pep preferred way" This reverts commit 84ceb08.
1 parent 8ffc901 commit 7b2e71b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apex/transformer/pipeline_parallel/p2p_communication.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ def _run_p2pops(
5959

6060
need_to_sync = p2p_group.name() != default_group.name()
6161
reqs = []
62+
ops = []
6263

6364
if batch_p2p_comm and p2p_group.name() == "nccl":
64-
ops = []
6565
if tensor_send_prev is not None:
6666
send_prev_op = torch.distributed.P2POp(
6767
op=torch.distributed.isend,
@@ -140,7 +140,7 @@ def _run_p2pops(
140140
return (None, None, None, None, reqs)
141141

142142
if async_comm:
143-
if len(reqs) == len(ops):
143+
if len(ops) == 0 or len(reqs) == len(ops):
144144
tensor_send_prev_req = None if tensor_send_prev is None else reqs.pop(0)
145145
tensor_recv_prev_req = None if tensor_recv_prev is None else reqs.pop(0)
146146
tensor_send_next_req = None if tensor_send_next is None else reqs.pop(0)

0 commit comments

Comments
 (0)