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

[AutoParallel] fix reshard set dist_attr without placments and process_mesh #60535

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions paddle/phi/core/distributed/auto_parallel/dist_tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ DistTensor::DistTensor() : value_(std::make_shared<DenseTensor>()) {}
DistTensor::DistTensor(const std::shared_ptr<phi::DenseTensor>& global_value,
const TensorDistAttr& dist_attr)
: global_dims_(global_value->dims()), dist_attr_(dist_attr) {
process_mesh_ = dist_attr_.process_mesh();
placements_ = ToPlacements(dist_attr);

// If the current rank doesn't in process_mesh, we should create an
// uninitialized tensor only with tensor_meta.
if (IsCurRankInMesh(dist_attr.process_mesh())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ void ReshardFunction::SetDistProps(DistTensor* tensor,

tensor->global_dims_ = dims;
tensor->dist_attr_ = dist_attr;
tensor->process_mesh_ = dist_attr.process_mesh();
tensor->placements_ = ToPlacements(dist_attr);
}

void ReshardFunction::SetDistProps(DistTensor* tensor,
Expand All @@ -64,6 +66,8 @@ void ReshardFunction::SetDistProps(DistTensor* tensor,
str_join(vectorize(tensor->dims()))));

tensor->dist_attr_ = dist_attr;
tensor->process_mesh_ = dist_attr.process_mesh();
tensor->placements_ = ToPlacements(dist_attr);
}

DenseTensor* ReshardFunction::GetMutableTensor(DistTensor* tensor) {
Expand Down