-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[Semi Auto] Revise spmd rule static mode API #57269
[Semi Auto] Revise spmd rule static mode API #57269
Conversation
…o semi-auto/default-rule
你的PR提交成功,感谢你对开源项目的贡献! |
✅ This PR's description meets the template requirements! |
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 overall
} | ||
|
||
static std::pair<std::vector<TensorDistAttr>, std::vector<TensorDistAttr>> | ||
infer_backward(const phi::distributed::SpmdRule &self, const py::args &args) { |
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.
py::args& can be const?
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.
it work
static void parse_single_pyobject(PyObject *obj, | ||
phi::distributed::InferSpmdContext *ctx, | ||
const size_t arg_pos) { | ||
if (PyList_Check(obj)) { // list inputs, spmd not allow tuple inputs |
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 suggest we can support tuple and list both.
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 is no tuple argument in Phi API yaml right now, we would support it once there is tuple input defined by Phi.
VLOG(6) << "args indx: [" << arg_pos << "] input one tensor."; | ||
DistTensorSpec in = py::cast<DistTensorSpec>(obj); | ||
VLOG(6) << "DistTensorSpec: " << in.to_string(); | ||
ctx->EmplaceBackInput(phi::distributed::DistMetaTensor( |
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 can consider unify DistMetaTensor and DistTensorSpec in the future.
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.
yes, that is on the list
* adapt general spmd rule * polish details * add new rules --------- Co-authored-by: Chen Weihang <chenweihang@baidu.com>
* adapt general spmd rule * polish details * add new rules --------- Co-authored-by: Chen Weihang <chenweihang@baidu.com>
PR types
Function optimization
PR changes
Others
Description
Pcard-70448
Refactor the static mode python api to distinguish input between tensor and [tensor].
Now the python api signature is exact the same as its C++ implement (which is like the format in Op's Python API).
Before:
After:
TODO: