CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[Auto Parallel] Add spmd rule No.6 for unique ops. #72824
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提交成功,感谢你对开源项目的贡献! |
TensorDistAttr indices_dist_attr_dst = TensorDistAttr(); | ||
if (return_index) { | ||
indices_dist_attr_dst = CopyTensorDistAttrForOutput(x_dist_attr_src); | ||
indices_dist_attr_dst.set_dims_mapping({-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.
If the variable "axis" is not "None", the number of dimension of "indices" should be the same as that of the input "x" (so are "inverse" and "counts").
It does not make sense to simply set "dims_mapping" as {-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.
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.
Oh you're right! I'm sorry to misunderstand the operator. Thanks for helping me understand it correctly!
bool return_index, | ||
bool return_inverse, | ||
bool return_counts, | ||
const std::vector<int>& axis); |
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.
Maybe we do not need this interface.
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 will delete it later.
bool return_counts, | ||
const std::vector<int>& axis, | ||
DataType dtype, | ||
bool is_sorted); |
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.
Why should we need a distinct "Static" interface ?
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.
because I see the unique op in dynamic mode and static mode has different parameters. In my mind, auto parallel is support with two modes, but i'am don't sure how framework to do it, so I add this interface with 'static' suffex and register in 'paddle/phi/ops/yaml/inconsistent/static_ops.yaml'. It's only my guess. Can you tell me more information about it, will I need delete it? Thanks !
# return_index=True, return_inverse=True, return_counts=True, axis={} | ||
# [0, -1] --> [-1,-1], [-1], [-1], [-1], [-1] | ||
# self.x_dist_tensor_spec.set_dims_mapping([0, -1]) | ||
# result_dist_attrs = self.rule.infer_forward( | ||
# self.x_dist_tensor_spec, | ||
# self.attrs["return_index"], | ||
# self.attrs["return_inverse"], | ||
# self.attrs["return_counts"], | ||
# self.attrs["axis"], | ||
# self.attrs['dtype'], | ||
# ) | ||
|
||
# self.assertEqual(len(result_dist_attrs), 2) | ||
# inferred_input_dist_attrs = result_dist_attrs[0] | ||
# inferred_output_dist_attrs = result_dist_attrs[1] | ||
|
||
# self.assertEqual(len(inferred_input_dist_attrs), 1) | ||
# self.assertEqual(len(inferred_output_dist_attrs), 4) | ||
|
||
# self.assertEqual(inferred_input_dist_attrs[0].dims_mapping, [-1, -1]) | ||
# self.assertEqual(inferred_output_dist_attrs[0].dims_mapping, [-1]) | ||
# self.assertEqual(inferred_output_dist_attrs[1].dims_mapping, [-1]) | ||
# self.assertEqual(inferred_output_dist_attrs[2].dims_mapping, [-1]) | ||
# self.assertEqual(inferred_output_dist_attrs[3].dims_mapping, [-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.
shall we open these annotated codes?
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 forget it, directly open it will wrong, because it will put the axis with empty list, it's difficult to decide what the type of it to cpp, std::vector or std::<int_64>. so it closed it now, because it's has tested in cpp. my be adding a default parameter can open this test, I will try it later.
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.
I found in this pr #57877 (comment) , the problem has already emerged. Now I add support empty list in parse_single_pyobject
,and force to vector<int64>
, so support std::vector<int> InferSpmdContext::AttrAt(size_t idx) const
to deal it to pure int.
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
log_softmax,cummax,cummin
) and their backward ops #72720 中的 DataType Attr 逻辑