Skip to content

Commit

Permalink
revert p2p communication for xpu (PaddlePaddle#53496)
Browse files Browse the repository at this point in the history
  • Loading branch information
sljlp authored May 4, 2023
1 parent 19950e6 commit eda0c58
Showing 1 changed file with 0 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,6 @@
_use_cache = False
_enable_partial_send_recv = True

_xpu_comm_group_started = False


def _xpu_comm_group_start():
if not paddle.is_compiled_with_xpu():
return
global _xpu_comm_group_started
assert not _xpu_comm_group_started
framework.core.ProcessGroupBKCL.group_start()
_xpu_comm_group_started = True


def _xpu_comm_group_end():
if not paddle.is_compiled_with_xpu():
return
global _xpu_comm_group_started
if _xpu_comm_group_started:
framework.core.ProcessGroupBKCL.group_end()
_xpu_comm_group_started = False


def initialize_p2p_groups(hcg, use_cache=True, enable_partial_send_recv=True):
global _hcg, _use_cache, _enable_partial_send_recv
Expand Down Expand Up @@ -371,7 +351,6 @@ def _p2p_helper(
# TODO(Yuang Liu): use batch_isend_irecv replace all these comm ops
tasks = []
# start to p2p communicate
_xpu_comm_group_start()
if tensor_send_prev is not None:
if isinstance(tensor_send_prev, tuple):
for d in tensor_send_prev:
Expand Down Expand Up @@ -407,7 +386,6 @@ def _p2p_helper(
use_calc_stream=sync_recv,
)
if sync_recv:
_xpu_comm_group_end()
allgather_partial(
d,
nranks=mp_degree,
Expand All @@ -428,7 +406,6 @@ def _p2p_helper(
)

if sync_recv:
_xpu_comm_group_end()
allgather_partial(
tensor_recv_prev,
nranks=mp_degree,
Expand Down Expand Up @@ -475,7 +452,6 @@ def _p2p_helper(
)

if sync_recv:
_xpu_comm_group_end()
allgather_partial(
d,
nranks=mp_degree,
Expand All @@ -496,7 +472,6 @@ def _p2p_helper(
use_calc_stream=sync_recv,
)
if sync_recv:
_xpu_comm_group_end()
allgather_partial(
tensor_recv_next,
nranks=mp_degree,
Expand All @@ -506,7 +481,6 @@ def _p2p_helper(
)
else:
tasks.append(task)
_xpu_comm_group_end()
if not sync_recv:
if framework.in_dygraph_mode():
# wait irecv tasks in eager dygraph mode with new comm library
Expand Down

0 comments on commit eda0c58

Please sign in to comment.