-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Enable fc passes #45704
Enable fc passes #45704
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
… enable_fc_passes_
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but let's wait for jenkins results
… enable_fc_passes_
… enable_fc_passes_
… enable_fc_passes_
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
… enable_fc_passes_
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…addle into enable_fc_passes_
@XiaoguangHu01 @jeff41404 @jzhang533 can I get the approve please? |
paddle/fluid/pybind/inference_api.cc
Outdated
None. | ||
Examples: | ||
.. code-block:: python | ||
from paddle.fluid.core import AnalysisConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This API is exposed as paddle.inference.Config.disable_mkldnn_fc_passes
, right ?
We have a plan to deprecate APIs exposed in paddle.fluid
namespace (in python frontend only), @jeff41404 is drafting the plan, and part of this work will happen in next release (v2.5).
So, it would be better to discourage users using paddle.fluid
APIs in the sample code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there some other API where it should be put?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sfraczek you can see inference doc for config https://www.paddlepaddle.org.cn/inference/v2.4/api_reference/python_api_doc/Config/ConfigClass.html
import paddle.inference as paddle_infer
paddle_infer.Config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a configurable API to disable any Pass paddle.inference.Config.delete_pass(pass: str)
, see
Tt is recommended not to add this API if ‘paddle.inference.Config.delete_pass’ can meet requirements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qingqing01
API disable_mkldnn_fc_passes
was created to disable all fc passes at one go. They were gathered in the method because they strongly depend on each other and it would have very little sense to disable them separately.
This PR makes fc passes automatically enabled when mkldnn is enabled, so we wanted to give a user the chance to disable them, because previously they were disabled by default.
There are many methods in current API which work the same way, but instead of disabling multiple passes they enable them (e.g. enable_mkldnn_bfloat16
, enable_mkldnn_int8
) . These methods could have been also replaced with many paddle.inference.Config.insert_pass(pass: str)
calls, but due to the strong connection between passes some dedicated methods were created, and we wanted to do the same with paddle.inference.Config.disable_mkldnn_fc_passes
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @qingqing01 can you please let me know what is the final decision about disable_mkldnn_fc_passes API?
@yeliang2258 this PR has been blocked for a while, please help to review. |
@paulinagacek Please resolve the conflict of the code, thanks. |
@paulinagacek Hello, I would like to know, why onednn's FC is slower than paddle native in many cases, can this problem be solved completely? |
… enable_fc_passes_
@yeliang2258 I will ask my collegue who investigated this issue and I will let you know as soon as possible |
@yeliang2258 The most difficult thing about this case is that it depends on the entire model and it is hard to predict what effect this will have on the final performance. We try to repair and optimize most of these common models, but for less popular models the user will have a faster solution thanks to DisableMkldnnFcPasses. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR types
Others
PR changes
APIs
Describe
It enables following fc mkldnn passes by default when mkldnn is enabled:
There was added
DisableMkldnnFcPasses()
in AnalysisConfig to disable mentioned fc mkldnn passes.