You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The input args of infer_meta and infer_spmd function may be different from the operation's input. The original PIR InferMeta function has not handled this case. This pr fix this bug.
For example, in StackGrad op, its operation inputs are [x, out_grad], while its spmd_function's inputs are [out_grad].
The original InferSpmd part in InferMeta function:
auto spmd_info = phi::distributed::StackGradInferSpmd(dist_meta_out_grad, axis);
DebugInfoForInferSpmd("StackGradOp", spmd_info);
// Raise error here, because its infer spmd function has only one input, so
// spmd_info.first.size() is 1u.
PADDLE_ENFORCE_EQ(spmd_info.first.size(), 2u, common::errors::Unavailable(
"Size of spmd_info.first for op[SumGradOp]is unexpected."));
// The input x's dist_attr is not in spmd_info, so also incorrect here.
for(auto& arg_dist : spmd_info.first) {{
dist_operand_attrs.push_back(CvtToPirAttr(arg_dist));
}}
After fix the bug:
auto dist_meta_out_grad = CvtToDistMetaTensor(out_grad_.type().dyn_cast<DistDenseTensorType>());
auto spmd_info = phi::distributed::StackGradInferSpmd(dist_meta_out_grad, axis);
DebugInfoForInferSpmd("StackGradOp", spmd_info);
// spmd_info.first.size() is equal to infer_spmd function's input size
PADDLE_ENFORCE_EQ(spmd_info.first.size(), 1u, common::errors::Unavailable(
"Size of spmd_info.first for op[StackGradOp]is unexpected."));
// Get the dist_attr from operation input
dist_operand_attrs.push_back(GetTensorDistAttrArray(x));
dist_operand_attrs.push_back(CvtToPirAttr(spmd_info.first[0]));
你的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.
The reason will be displayed to describe this comment to others. Learn more.
The input args of infer_spmd is consistent with infer_meta. The problem is that the auto parallel part in PIR has not handled the case when the infer_meta args (i.e. infer_spmd args) are inconsistent with the op input.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
Auto Parallel
PR Types
Bug fixes
Description
Pcard-67164
The input args of infer_meta and infer_spmd function may be different from the operation's input. The original PIR InferMeta function has not handled this case. This pr fix this bug.
For example, in StackGrad op, its operation inputs are [x, out_grad], while its spmd_function's inputs are [out_grad].