Skip to content

[CINN]add matmul grad fuse pattern #67466

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

Merged
merged 11 commits into from
Sep 10, 2024

Conversation

phlrain
Copy link
Collaborator

@phlrain phlrain commented Aug 15, 2024

PR Category

CINN

PR Types

Others

Description

pcard-76996

优化matmul grad的逻辑,适配编译器场景

Copy link

paddle-bot bot commented Aug 15, 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.

zyfncg
zyfncg previously approved these changes Aug 15, 2024
@phlrain phlrain changed the title add matmul grad fuse pattern [CINN]add matmul grad fuse pattern Aug 15, 2024
Copy link

paddle-ci-bot bot commented Sep 3, 2024

Sorry to inform you that 7fd453c's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

Comment on lines +138 to +157
bool have_sum_op = false;
pir::Value sum_output;
pir::Value sum_input;
for (auto user_it = dout.use_begin(); user_it != dout.use_end();
++user_it) {
if (!user_it->owner()) {
continue;
}
if (auto sum_op = user_it->owner()->dyn_cast<paddle::dialect::SumOp>()) {
have_sum_op = true;
sum_output = sum_op->result(0);
sum_input = sum_op->operand_source(0);
rewriter.SetInsertionPointAfter(sum_op);
break;
}
}

if (!have_sum_op) {
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

这个sum op的作用是什么?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这个sum op 是计算linear中bias的grad的,对应的是组合算子拆解前的 add_grad的算子,add_grad 被拆成了 assign op + sum op

@phlrain phlrain merged commit aa92797 into PaddlePaddle:develop Sep 10, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants