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

dist2dense_pass fix shape errors in shard randomly sampled data #68067

Conversation

jeff41404
Copy link
Contributor

@jeff41404 jeff41404 commented Sep 6, 2024

PR Category

Auto Parallel

PR Types

Bug fixes

Description

pcard-86711
After PR #67589 supporting sharding of randomly sampled data, it is necessary to synchronously modify the shape in the attribute of previously operator of pd_op.full_int_array when use paddle.distributed.to_static and pir(FLAGS_enable_pir_api=true). Otherwise, the executor will still create data according to this wrong shape during actual execution, resulting in incorrect reporting of shape in subsequent calculations.

import paddle
import paddle.distributed as dist
process_mesh = dist.ProcessMesh([0, 1], dim_names=['dp'])

noise = paddle.randn(x.shape)  
noise = dist.shard_tensor(noise, process_mesh, [dist.Shard(0)) # same shard as x
y = noise * x # will error when use paddle.distributed.to_static and pir

Printing pir program also shows that the shape in the attribute of operator of pd_op.full_int_array (line1 and line3) is inconsistent with correct shape (line2 and line4)
image
this PR will fix this issue.

Copy link

paddle-bot bot commented Sep 6, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Sep 9, 2024
@PaddlePaddle PaddlePaddle unlocked this conversation Sep 9, 2024
Copy link
Contributor

@JZ-LIANG JZ-LIANG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jeff41404 jeff41404 merged commit cd7c853 into PaddlePaddle:develop Sep 13, 2024
29 of 30 checks passed
@jeff41404 jeff41404 deleted the dist2dense_pass_fix_shape_errors_in_shard_randomly_sampled_data_ branch September 13, 2024 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants