Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XPU] Fix error for dynamic shape send recv #71425

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions paddle/phi/kernels/funcs/send_recv_functor.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,20 @@ void send_shape_info(const Context& dev_ctx,
CommContext* comm_ctx,
int peer,
StreamType stream) {
#if (defined(PADDLE_WITH_RCCL) || defined(PADDLE_WITH_NCCL)) && \
NCCL_VERSION_CODE >= 2703
PADDLE_ENFORCE_EQ((stream != nullptr && comm_ctx != nullptr),
true,
errors::InvalidArgument(
"NCCLComm and Stream should be provided if use NCCL "
"to send the shape info."));
#elif defined(PADDLE_WITH_XPU_BKCL)
PADDLE_ENFORCE_EQ(
(comm_ctx != nullptr),
true,
errors::InvalidArgument("BKCLComm should be provided if use BKCL "
"to send the shape info."));
#endif
paddle::DataType shape_dtype = paddle::DataType::INT32;
auto dims = x.dims();
int shape_size = dims.size();
Expand Down Expand Up @@ -93,11 +102,20 @@ DDim recv_shape_info(const Context& dev_ctx,
CommContext* comm_ctx,
int peer) {
StreamType stream = dev_ctx.stream();
#if (defined(PADDLE_WITH_RCCL) || defined(PADDLE_WITH_NCCL)) && \
NCCL_VERSION_CODE >= 2703
PADDLE_ENFORCE_EQ((stream != nullptr && comm_ctx != nullptr),
true,
errors::InvalidArgument(
"NCCLComm and Stream should be provided if use NCCL "
"to send the shape info."));
#elif defined(PADDLE_WITH_XPU_BKCL)
PADDLE_ENFORCE_EQ(
(comm_ctx != nullptr),
true,
errors::InvalidArgument("BKCLComm should be provided if use BKCL "
"to send the shape info."));
#endif
paddle::DataType shape_dtype = paddle::DataType::INT32;

// phi::DenseTensor shape_size_tensortensor(shape_dtype);
Expand Down
Loading