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

MKLDNN layout: Gaussian random layout #11523

Conversation

mozga-intel
Copy link
Contributor

@mozga-intel mozga-intel commented Jun 15, 2018

The gaussian random operator of the MKLDNN significantly speed up the resnet model. The some function of mkldnn are used directly in this operator in order to get the better performance.

  • The gaussian random operator takes advantage of layout of mkldnn.
  • The gaussian random directly sets the layout of mkldnn.
  • Also the mkldnn format is directly forced.
  • The Ohwi16o type is set to get the best performance during of reorder of weights.

@mozga-intel mozga-intel requested a review from luotao1 June 15, 2018 21:31
@mozga-intel mozga-intel changed the title MKLDNN layouts: Gaussian random layout MKLDNN layout: Gaussian random layout Jun 15, 2018
@mozga-intel
Copy link
Contributor Author

@luotao1 Could you continue the checking of this code, please.

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.

Please add the unit test in test_gaussian_random_mkldnn_op.py

#include "paddle/fluid/platform/device_context.h"
#include "paddle/fluid/platform/mkldnn_helper.h"

#include "paddle/fluid/framework/eigen.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

Are the including headers in line 15-line 24all needed? There are only two headers in gaussian_random_op.cc

#include <random>
#include "paddle/fluid/framework/op_registry.h"

using mkldnn::primitive;
using mkldnn::softmax_forward;
using mkldnn::prop_kind;
using mkldnn::stream;
Copy link
Contributor

Choose a reason for hiding this comment

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

Are line 28-37 all needed? please remove the unused one, such as mkldnn::softmax_forward.

@mozga-intel mozga-intel force-pushed the mozga-intel/Gausian_random_mkldnn_layout branch from 04d47b5 to 9d28678 Compare June 19, 2018 09:35
@mozga-intel mozga-intel force-pushed the mozga-intel/Gausian_random_mkldnn_layout branch from 9d28678 to 7b9aa60 Compare June 19, 2018 10:10
@mozga-intel
Copy link
Contributor Author

@luotao1 Done

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!Thanks very much!

@luotao1 luotao1 merged commit 5972990 into PaddlePaddle:develop Jun 19, 2018
@luotao1 luotao1 moved this from Doing to Done in Intel Optimization on Fluid Jun 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

2 participants