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: Support for batch norm operator #11098

Conversation

mozga-intel
Copy link
Contributor

@mozga-intel mozga-intel commented May 31, 2018

Waiting for supports of the mkldnn’s layout.

Please have a look at this batch norm operator supported by the MKLDNN’s layout and assess if we can keep this design of the code.

This code uses the implementation of layout which is available in the last pull-request. Therefore some of the function in this code are not available in this pull-request, but are available here.

This version of code can be merged into the main branch when the pull-request with layout is accepted.
The concept of splits of the long code was proposed by @luotao1

Pull-request is related to #11040

@mozga-intel mozga-intel force-pushed the mozga-intel/Batch_norm_mkldnn_layout branch from 69b8f56 to 7d56435 Compare June 10, 2018 21:33
@mozga-intel
Copy link
Contributor Author

@luotao1 The code is prepared to the code-review process.

@luotao1 luotao1 requested a review from tensor-tang June 11, 2018 07:29
bool is_diff_dst_reordered = false;
if (diff_dst_pd != user_diff_dst_memory.get_primitive_desc()) {
diff_dst_memory = memory(diff_dst_pd);
reorder_diff_dst = reorder(user_diff_dst_memory, diff_dst_memory);
Copy link
Contributor

Choose a reason for hiding this comment

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

Inplace reorder?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

But does mkldnn reorder support inplace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"Both forward and backward passes support in-place operation, i.e. src and dst point to the same memory for forward, and diff_dst and diff_src point to the same memory for backward pass."
info

Copy link
Contributor

@tensor-tang tensor-tang Jun 13, 2018

Choose a reason for hiding this comment

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

Actually my point is does mkldnn::reorder support inplace, not batchnorm.
AFAIK, mkldnn::reorder does not support inplace yet.

While, you are not using inplace reorder here.

auto diff_dst_memory = user_diff_dst_memory;
...
diff_dst_memory = memory(diff_dst_pd);

This will allocate new memory.

So that's fine.

Copy link
Contributor

@tensor-tang tensor-tang left a comment

Choose a reason for hiding this comment

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

All unit tests passed.
LGTM

@tensor-tang tensor-tang merged commit 489f581 into PaddlePaddle:develop Jun 13, 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