Skip to content
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

【BUAA】【Infer Symbolic Shape】add mv, shadow_feed, share_data_ #66956

Merged
merged 5 commits into from
Aug 7, 2024

Conversation

uanu2002
Copy link
Contributor

@uanu2002 uanu2002 commented Aug 2, 2024

PR Category

CINN

PR Types

Others

Description

添加 mv, shadow_feed, share_data_ 算子符号推导接口实现。

Copy link

paddle-bot bot commented Aug 2, 2024

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

@luotao1 luotao1 added contributor External developers HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 labels Aug 2, 2024
@uanu2002 uanu2002 changed the title 【Infer Symbolic Shape BUAA】add mv, shadow_feed, share_data_ 【BUAA】【Infer Symbolic Shape】add mv, shadow_feed, share_data_ Aug 5, 2024
@@ -720,6 +720,39 @@ bool MatmulOpInferSymbolicShape(pir::Operation *op,
return true;
}

bool MvOpInferSymbolicShape(pir::Operation *op,
pir::InferSymbolicShapeContext *infer_context) {
const auto &input_shape =
Copy link
Contributor

Choose a reason for hiding this comment

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

命名不规范,这里是shape_or_data 类型,规范命名:x_shape_or_data

pir::InferSymbolicShapeContext *infer_context) {
const auto &input_shape =
infer_context->GetShapeOrDataForValue(op->operand_source(0));
const auto &vec_shape =
Copy link
Contributor

Choose a reason for hiding this comment

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

同上,取出shape域的值后再用shape后缀

phi::errors::InvalidArgument(
"The rank of input Vec should be 1, but is %d",
vec_shape.shape().size()));
PADDLE_ENFORCE_EQ(input_shape.shape()[1],
Copy link
Contributor

Choose a reason for hiding this comment

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

这里添加的是 DimExpr 之间的约束,应该使用:infer_context->Addequalcst()

@@ -133,6 +133,9 @@ OP_DECLARE_INFER_SYMBOLIC_SHAPE(ScatterNdAdd)
OP_DECLARE_INFER_SYMBOLIC_SHAPE(Scatter)
OP_DECLARE_INFER_SYMBOLIC_SHAPE(Scatter_)
OP_DECLARE_INFER_SYMBOLIC_SHAPE(Select)
OP_DECLARE_INFER_SYMBOLIC_SHAPE(ShadowFeed)
OP_DECLARE_INFER_SYMBOLIC_SHAPE(ShareData_)
OP_DECLARE_INFER_SYMBOLIC_SHAPE(ShareData__)
Copy link
Contributor

Choose a reason for hiding this comment

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

带下划线的算子inplace名和原算子一致,删掉 ShareData__

Copy link
Contributor

Choose a reason for hiding this comment

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

🎉恭喜触发了隐藏bug,麻烦在周会时跟大家分享

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修复上述问题:7cfe49e

@gongshaotian
Copy link
Contributor

mv op coverage 流水线通过;sharedata_ op 有对应单测,check_pir flag为默认关闭状态;shadowfeed op 较为特殊,先不添加单测;

@gongshaotian
Copy link
Contributor

LGTM

@luotao1 luotao1 merged commit c6de16c into PaddlePaddle:develop Aug 7, 2024
30 of 31 checks passed
@uanu2002 uanu2002 deleted the cinn_new3 branch August 15, 2024 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants