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

onednn: remove fc_elementwise_add fusion #55504

Merged
merged 3 commits into from
Jul 24, 2023

Conversation

xinyu-intel
Copy link
Contributor

PR types

Bug fixes

PR changes

OPs

Description

post-sum fusion is conflicted with memory_optimization_pass because the post-sum and dst share the same buffer. This pr is to deprecate the fusion to make language model happy. We'll switch to use matmul and post-binary fusion to improve the performance then.

@paddle-bot
Copy link

paddle-bot bot commented Jul 18, 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.

@xinyu-intel
Copy link
Contributor Author

@kolinwei hi, please help to check the approval in coverage job. The tests will be removed along with the feature.

@xinyu-intel
Copy link
Contributor Author

@vivienfanghuagood hi, can you take a look at this?

@@ -173,7 +173,6 @@ if(WITH_MKLDNN)
pass_library(conv_elementwise_add_mkldnn_fuse_pass inference DIR mkldnn)
pass_library(int8_scale_calculation_mkldnn_pass inference DIR mkldnn)
pass_library(params_quantization_mkldnn_pass inference DIR mkldnn)
pass_library(fc_elementwise_add_mkldnn_fuse_pass inference DIR mkldnn)
Copy link
Contributor

Choose a reason for hiding this comment

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

If this pass is removed, will the performance of some models be affected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some will be impact. A simple case should be linear -> add, add won't be fused into linear and cause extra computation. However, the current post-sum fusion need memory inplace and it will be conflict with memory reuse opimization and cause wrong accuracy. We'll re-enable the fusion by using post-binary fusion which doesn't actually need memory inplace but this needs more validation work.

@onecatcn onecatcn assigned onecatcn and unassigned xinyu-intel and onecatcn Jul 21, 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
单测删除

@qingqing01 qingqing01 merged commit bea1f04 into PaddlePaddle:develop Jul 24, 2023
cqulilujia pushed a commit to cqulilujia/Paddle that referenced this pull request Jul 24, 2023
* onednn: remove fc+eltwiseadd fusion pass
* onednn: remove post-sum fusion in fc kernel
* onednn: tests: make unfused add run into f32
wz1qqx pushed a commit to wz1qqx/Paddle that referenced this pull request Jul 31, 2023
* onednn: remove fc+eltwiseadd fusion pass
* onednn: remove post-sum fusion in fc kernel
* onednn: tests: make unfused add run into f32
jinjidejinmuyan pushed a commit to jinjidejinmuyan/Paddle that referenced this pull request Aug 30, 2023
* onednn: remove fc+eltwiseadd fusion pass
* onednn: remove post-sum fusion in fc kernel
* onednn: tests: make unfused add run into f32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers Intel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants