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

[PIR] register some fused_ops #57655

Merged

Conversation

kangguangli
Copy link
Contributor

@kangguangli kangguangli commented Sep 22, 2023

PR types

Others

PR changes

Others

Description

  1. register fused_attention_grad in pir
  2. register fused_feedforward and its grad op in pir
  3. migrate FusedAttentionInfermeta from multiary.cc to fusion.cc by comments in [PIR] register fused_attention in pir #57557
  4. delete some redundant unittests

Others

Pcard-67164

@paddle-bot
Copy link

paddle-bot bot commented Sep 22, 2023

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

const OpOutputMapping& arg_to_idx) override {
OpTranscriber::RecordOpResultMapping(
ctx, param_map, op_desc, operation, arg_to_idx);
if (op_desc.HasOutput("Out")) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sometimes, the original fused_feedforward will have two outputs pointing to same variable, which uses same memory buffer.

if (!add_residual) {
if (use_dropout_2) {
GET_IR_NODE_FROM_SUBGRAPH(
dropout_out_2, dropout_out_2, fused_feedforward_pattern);
fused_feedforward_op_desc.SetOutput("Out", {dropout_out_2->Name()});

After translating, the two outputs will be mapped to two values while having different memory buffers and result in precision problem.

By forcing this duplicate variable mapping to output out only, we can get the right result.

Copy link
Contributor

Choose a reason for hiding this comment

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

建议针对该问题添加必要 Warning 日志

XieYunshen
XieYunshen previously approved these changes Sep 27, 2023
Copy link
Contributor

@XieYunshen XieYunshen left a comment

Choose a reason for hiding this comment

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

LGTM
单测删除

zyfncg
zyfncg previously approved these changes Sep 27, 2023
Comment on lines +1262 to +1263
dropout1_seed: Dropout1Seed
dropout2_seed: Dropout2Seed
Copy link
Contributor

Choose a reason for hiding this comment

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

这两个是不可变attribute?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

不是,fused_feedforward的kernel参数重既包含dropout1_seed,又包含dropout1_seed_val

@kangguangli kangguangli dismissed stale reviews from zyfncg and XieYunshen via bc9a318 September 27, 2023 08:18
@kangguangli kangguangli merged commit 17f5b4f into PaddlePaddle:develop Sep 28, 2023
27 checks passed
@kangguangli kangguangli deleted the register_fused_operations branch September 28, 2023 08:43
Frida-a pushed a commit to Frida-a/Paddle that referenced this pull request Oct 14, 2023
* register_fused_ops

* add unittest

* fix bug and add test

* refine

* refine

* set timeout
jiahy0825 pushed a commit to jiahy0825/Paddle that referenced this pull request Oct 16, 2023
* register_fused_ops

* add unittest

* fix bug and add test

* refine

* refine

* set timeout
danleifeng pushed a commit to danleifeng/Paddle that referenced this pull request Nov 14, 2023
* register_fused_ops

* add unittest

* fix bug and add test

* refine

* refine

* set timeout
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.

None yet

4 participants