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

[INTEL MKL] Enabled Conv2D fprop for MKL-DNN v1.0. #30549

Merged

Conversation

bhavani-subramanian
Copy link
Contributor

No description provided.

@tensorflow-bot tensorflow-bot bot added the size:L CL Change Size: Large label Jul 9, 2019
@rthadur rthadur requested a review from penpornk July 9, 2019 23:59
@rthadur rthadur self-assigned this Jul 9, 2019
@rthadur rthadur added this to Assigned Reviewer in PR Queue via automation Jul 9, 2019
@rthadur rthadur added the comp:mkl MKL related issues label Jul 9, 2019
Copy link
Member

@penpornk penpornk left a comment

Choose a reason for hiding this comment

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

Thank you for your PR! I'm a little concerned with redundant codes. I think we should minimize them.

tensorflow/core/graph/mkl_layout_pass.cc Show resolved Hide resolved
tensorflow/core/graph/mkl_layout_pass.cc Outdated Show resolved Hide resolved
tensorflow/core/kernels/mkl_conv_ops.cc Outdated Show resolved Hide resolved
tensorflow/core/kernels/mkl_conv_ops.cc Outdated Show resolved Hide resolved
tensorflow/core/kernels/mkl_conv_ops.cc Outdated Show resolved Hide resolved
tensorflow/core/kernels/mkl_conv_ops.cc Outdated Show resolved Hide resolved
tensorflow/core/kernels/mkl_conv_ops.cc Outdated Show resolved Hide resolved
tensorflow/core/kernels/mkl_conv_ops.cc Outdated Show resolved Hide resolved
tensorflow/core/kernels/mkl_conv_ops.cc Outdated Show resolved Hide resolved
void AllocatePersistentTensor(OpKernelContext* context,
const ConvFwdPd& conv_prim_desc,
Tensor** filter_tensor,
const MklDnnShape& filter_mkl_shape) {
Copy link
Member

Choose a reason for hiding this comment

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

Please try to merge with existing original code (same or the rest of the PR). This one can call the one with three parameters then do extra processing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

PR Queue automation moved this from Assigned Reviewer to Reviewer Requested Changes Jul 11, 2019
@rthadur rthadur added the stat:awaiting response Status - Awaiting response from author label Jul 12, 2019
@tensorflowbutler tensorflowbutler added the stale This label marks the issue/pr stale - to be closed automatically if no activity label Jul 27, 2019
@tensorflowbutler
Copy link
Member

It has been 14 days with no activity and the awaiting response label was assigned. Is this PR still valid? Assigning the stalled label. Please comment to reassure me that this is still being worked on.

@bhavani-subramanian
Copy link
Contributor Author

@tensorflowbutler yes, this PR is still being worked on. I'll push the requested changes within a couple of days. Thanks!

@tensorflowbutler tensorflowbutler added stat:awaiting response Status - Awaiting response from author and removed stat:awaiting response Status - Awaiting response from author stale This label marks the issue/pr stale - to be closed automatically if no activity labels Jul 28, 2019
@rthadur rthadur requested a review from penpornk July 29, 2019 20:29
@bhavani-subramanian
Copy link
Contributor Author

@penpornk I have addressed your review comments. Please take a look. Thanks!

Copy link
Member

@penpornk penpornk left a comment

Choose a reason for hiding this comment

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

Thank you very much for all the changes! This looks great! I have a few more comments.

tensorflow/core/graph/mkl_layout_pass.cc Show resolved Hide resolved
static_cast<int32>(
GetFilterTfDataFormat(filter_mkl_shape, conv_prim_desc));
#else
GetFilterTfDataFormat(filter_mkl_shape, conv_prim_desc);
Copy link
Member

Choose a reason for hiding this comment

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

To be added.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

static_cast<int32>(
GetFilterTfDataFormat(filter_mkl_shape, conv_prim_desc));
#else
GetFilterTfDataFormat(filter_mkl_shape, conv_prim_desc);
Copy link
Member

Choose a reason for hiding this comment

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

This looks similar to the v1 case. static_cast<int32> shouldn't make a difference since we are assigning it to the int32 version of second_tensor anyway. Can we merge this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -136,8 +138,13 @@ class MklDnnConvUtil {
CHECK_BOUNDS(input_cols_raw, "Input cols too large");
int input_cols = static_cast<int>(input_cols_raw);

#ifdef ENABLE_MKLDNN_V1
// MKL-DNN always requires input in NCHW format Conv2D.
std::vector<long int> mkldnn_sizes(4, -1);
Copy link
Member

Choose a reason for hiding this comment

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

You can define MKLDNN_SIZE_DTYPE (or any name you prefer) to be either long int or int at the beginning and then use it throughout the file.

Suggested change
std::vector<long int> mkldnn_sizes(4, -1);
std::vector<MKLDNN_SIZE_DTYPE> mkldnn_sizes(4, -1);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@bhavani-subramanian
Copy link
Contributor Author

@penpornk I have addressed your latest review comments. Please let me know if it looks okay. Thank you!

Copy link
Member

@penpornk penpornk left a comment

Choose a reason for hiding this comment

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

Thank you for your patience! One more comment, please.

@@ -658,6 +631,10 @@ class MklDummyOp : public OpKernel {
}
};

#ifdef ENABLE_MKLDNN_V1
#undef MKLDNN_SIZE_DTYPE
Copy link
Member

Choose a reason for hiding this comment

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

MKLDNN_SIZE_DTYPE is always defined, we don't need to guard it with v1 ifdef.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you're right :) Fixed it.

Copy link
Member

@penpornk penpornk left a comment

Choose a reason for hiding this comment

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

Thank you very much again! I think we're good to go. :)

PR Queue automation moved this from Reviewer Requested Changes to Approved by Reviewer Jul 29, 2019
@tensorflow-bot tensorflow-bot bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Jul 29, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Jul 29, 2019
@tensorflowbutler tensorflowbutler removed the stat:awaiting response Status - Awaiting response from author label Jul 30, 2019
@rthadur rthadur added ready to pull PR ready for merge process and removed ready to pull PR ready for merge process labels Jul 30, 2019
@tensorflow-copybara tensorflow-copybara merged commit ab4af31 into tensorflow:master Jul 31, 2019
PR Queue automation moved this from Approved by Reviewer to Merged Jul 31, 2019
tensorflow-copybara pushed a commit that referenced this pull request Jul 31, 2019
@nammbash nammbash deleted the mkldnn-1.0-conv2d-fwd branch April 25, 2020 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes comp:mkl MKL related issues ready to pull PR ready for merge process size:L CL Change Size: Large
Projects
PR Queue
  
Merged
Development

Successfully merging this pull request may close these issues.

None yet

7 participants