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 BatchNorm + Act fusion pass. #27912

Merged
merged 22 commits into from
Oct 26, 2020

Conversation

arogowie-intel
Copy link
Contributor

@arogowie-intel arogowie-intel commented Oct 13, 2020

PR types

New features

PR changes

Others

Describe

This PR adds oneDNN pass for BatchNorm + Act function fusion. Currently only ReLU is supported as activation function.

Performance improvement is around 2.8% - benchmarked on pvanet_ocr model using Xeon 6148 machine. Run with 40 threads.

model avg running time (s) relative speedup
base fp32 0,473066 1x
optimized fp32 0,150530 3,143x
optimized fp32 & bn+act 0,146477 1,028x

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@arogowie-intel
Copy link
Contributor Author

@jczaja @wozna @wojtuss Please take a look and review.

@arogowie-intel arogowie-intel marked this pull request as ready for review October 20, 2020 13:54
@jczaja jczaja self-requested a review October 22, 2020 08:22
jczaja
jczaja previously approved these changes Oct 22, 2020
Copy link
Contributor

@jczaja jczaja left a comment

Choose a reason for hiding this comment

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

LGTM

@arogowie-intel
Copy link
Contributor Author

arogowie-intel commented Oct 22, 2020

@luotao1 Could you please help. I see following error occur, although it is not related to my changes:
PR-CI-Windows-OPENBLAS: Line 5993: 2020-10-22 02:31:29 LINK : fatal error LNK1104: cannot open file 'C:\home\workspace\Paddle\build\paddle\fluid\pybind\Release\op_function_generator.exe' [C:\home\workspace\Paddle\build\paddle\fluid\pybind\op_function_generator.vcxproj]

Moreover in PR-CI-Coverage and PR-CI-Windows i get AssertionError: We only support 'data()' in static graph mode, please call 'paddle.enable_static()' to enter static graph mode., although I have called enable_static() here

Finally in PR-CI-Approval I see complaint about the usage of PADDLE_ENFORCE* macro in these lines. I have specified the error type and provided clear, long description. Maybe this is a problem with formatting? However clang-format has passed.

@luotao1
Copy link
Contributor

luotao1 commented Oct 22, 2020

  • PR-CI-Windows-OPENBLAS: you can rerun it, it's a random failure
  • PR-CI-Coverage and PR-CI-Windows: Maybe you can refer to other unit-tests like python/paddle/fluid/contrib/slim/tests/test_graph.py
import paddle
import paddle.fluid as fluid
from paddle.fluid.framework import IrGraph
from paddle.fluid import core

paddle.enable_static()
...
  • PR-CI-Approval: The check rule is not robust, I will approve it if other CIs all passed.

@arogowie-intel
Copy link
Contributor Author

@luotao1 All CI-checks (except approval) passed. Could you review please?

Copy link

@wojtuss wojtuss left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

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

LGTM

@luotao1 luotao1 merged commit 7db747d into PaddlePaddle:develop Oct 26, 2020
@arogowie-intel arogowie-intel deleted the aosewski/fuse_bn_relu branch October 27, 2020 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants