Skip to content

Fix dtensor_to_local backward bugs #71232

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

Merged
merged 2 commits into from
Feb 24, 2025

Conversation

From00
Copy link
Contributor

@From00 From00 commented Feb 21, 2025

PR Category

Auto Parallel

PR Types

Bug fixes

Description

修复dtensor_to_local反向切分标记问题。在之前的实现中,dtensor_to_local反向输出梯度的切分状态与前向的对应输入相同,这在很多场景下是不成立的,例如常见的模型并行场景:

x: Shard(1)
y: Shard(0)

z = matmul(x, y)

x_grad: Partial(sum)
y_grad: Partial(sum)

本PR修改dtensor_to_local实现,允许用户手动标记梯度的切分状态。

Pcard-76459

Copy link

paddle-bot bot commented Feb 21, 2025

你的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.

self, out_dist_attrs: list[tuple[ProcessMesh, list[Placement]]]
self,
out_dist_attrs: list[tuple[ProcessMesh, list[Placement]]],
grad_dist_attrs: list[tuple[ProcessMesh, list[Placement]]],
Copy link
Contributor

Choose a reason for hiding this comment

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

需不需要给 grad_dist_attrs 加一个默认值 None,所有 grad 的 dist_attr 都和输入相同

Copy link
Contributor Author

Choose a reason for hiding this comment

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

后续PR增加这个易用性优化

Copy link
Contributor

@pkuzyc pkuzyc left a comment

Choose a reason for hiding this comment

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

LGTM

@From00 From00 merged commit f04aa61 into PaddlePaddle:develop Feb 24, 2025
34 checks passed
Enigmatisms pushed a commit to Enigmatisms/Paddle that referenced this pull request Mar 6, 2025
* Fix dtensor_to_local backward bugs

* Fix CI errors
YqGe585 pushed a commit to YqGe585/Paddle that referenced this pull request May 7, 2025
* Fix dtensor_to_local backward bugs

* Fix CI errors
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