-
Couldn't load subscription status.
- Fork 5.9k
[Auto Parallel] Add spmd rule No.15 for index_put and index_put_grad ops. #73486
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
Conversation
| 你的PR提交成功,感谢你对开源项目的贡献! |
| /re-run all-failed |
| // build input data class | ||
| std::vector<int64_t> x_shape = {64, 64, 64}; | ||
| std::vector<int64_t> indice_shape = {32}; | ||
| std::vector<int64_t> value_shape = {32}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case, if value_shape=[32, 64], can run normally on single device, but can run normally on multi device? especially dims_mapping of x is {-1, 0, 1}
tips: After using this spmd rule, the local shape will be: x_shape=[64, 64, 32], indice_shape=([32], [32]), value_shape=[32, 64], Can index_put operator will run successfully?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I fix this situation(value_shape greater than 1) in next commit.
| x_ndim, | ||
| indices_size)); | ||
| | ||
| PADDLE_ENFORCE_EQ(value_ndim, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the definition of the index_put operator, it can support value_ndim greater than 1. This restriction cannot be applied as it can be verified through the following code:
x = paddle.zeros([4, 4, 4]) value = paddle.ones([4, 4]) # can support value_ndim > 1(meet certain conditions) # value = paddle.arange(16).reshape([4, 4]).astype("float32") ix1 = paddle.to_tensor([0,1,2,3]) ix2 = paddle.to_tensor([0,1,2,3]) indices=(ix1,ix2) out = paddle.index_put(x,indices,value) print(out) # can run normallyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I have removed this restriction.
| /re-run all-failed |
| /re-run all-failed |
| } | ||
| } else { // indices_size = x_ndim | ||
| for (int i = 0; i < x_ndim; i++) { | ||
| x_dims_mapping[i] = -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the branch of else only handles the case of indices_size = x_ndim? can it be merged into the above branch, so we do not need to distinguish between if and else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your suggestion, I removed the if and else in this code block.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@ ## develop #73486 +/- ## =========================================== Coverage ? 100.00% =========================================== Files ? 1 Lines ? 122 Branches ? 0 =========================================== Hits ? 122 Misses ? 0 Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR Category
Auto Parallel
PR Types
New features
Description