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

Mkl kernels #8184

Merged
merged 6 commits into from Mar 23, 2017
Merged

Mkl kernels #8184

merged 6 commits into from Mar 23, 2017

Conversation

vivek-rane
Copy link

Adding MKL support for conv_ops

@tensorflow-jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

@teamdandelion
Copy link
Contributor

@petewarden / @josh11b could one of you take a look?

@jhseu jhseu requested review from andydavis1 and removed request for petewarden and josh11b March 14, 2017 01:40

if (input_is_mkl) {
OP_REQUIRES(context, mkl_params_.mkl_input_shape.GetDimension() == 4,
errors::InvalidArgument("Input tensor must be 4-dimensional"));
Copy link
Contributor

Choose a reason for hiding this comment

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

spacing looks funny.

limitations under the License.
==============================================================================*/

// See docs in ../ops/nn_ops.cc.
Copy link
Contributor

Choose a reason for hiding this comment

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

I realize there is a lot of documentation in nn_ops.cc to which this comment refers. However, could you add comments here that explains how this OpKernel differs from those in 'nn_ops.cc' (it uses mkl library, it changes layout, etc). It would be good to have a high-level description at the top on this file (as well as backprop input).

MklCreateInputLayouts(context);

Tensor mkl_tmp_input_buf, mkl_tmp_outbackprop_buf_;
MklPrepareConvolutionInputs(context, &mkl_tmp_input_buf);
Copy link
Contributor

Choose a reason for hiding this comment

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

Glad you broke out function calls for MklPrepare* and MklCleanup...

#include "third_party/mkl/include/mkl_dnn_types.h"

namespace tensorflow {

Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above: high-level description up top and some comments about what each method does.

int64 pad_top, pad_bottom;
int64 pad_left, pad_right;
OP_REQUIRES_OK(context, GetWindowedOutputSizeVerbose(
dims.rows.input_size, dims.rows.filter_size,
Copy link
Contributor

Choose a reason for hiding this comment

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

line spacing looks weird.

.SetShapeFn([](InferenceContext* c) {
return InputTensorShapeOrUnknown(c, 0 /* input_idx */, 4 /* ndims */);
})
.Doc(R"doc(
Copy link
Contributor

Choose a reason for hiding this comment

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

Please document all inputs, outputs and attrs. Please look at other doc strings as examples.


mkl_params.in_dims = 4;

mkl_params.in_sizes[0] = static_cast<size_t>(dims.cols.input_size);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe break this up with line spaces between param types for readability:

mkl_params.input_offset[0] = static_cast<int>(-pad_left);
mkl_params.input_offset[1] = static_cast<int>(-pad_top);

 mkl_params.conv_strides[0] = static_cast<size_t>(dims.cols.stride);
 mkl_params.conv_strides[1] = static_cast<size_t>(dims.rows.stride);

sizes.push_back(tf_sizes[2]);
} else {
sizes.push_back(tf_sizes[2]);
sizes.push_back(tf_sizes[1]);
Copy link
Contributor

Choose a reason for hiding this comment

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

fix line spacing.

@andydavis1
Copy link
Contributor

Looks good, but please address my comments above before committing.

@andydavis1 andydavis1 closed this Mar 17, 2017
@andydavis1
Copy link
Contributor

@tensorflow-jenkins test this please

@andydavis1 andydavis1 reopened this Mar 17, 2017
@tensorflow-jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

@andydavis1
Copy link
Contributor

@tensorflow-jenkins test this please

@martinwicke martinwicke added the stat:awaiting response Status - Awaiting response from author label Mar 22, 2017
@martinwicke
Copy link
Member

Can you address the build failure:

ERROR: /workspace/tensorflow/core/kernels/BUILD:2374:1: in deps attribute of cc_test rule //tensorflow/core/kernels:immutable_constant_op_test: target '//tensorflow/core/kernels:mkl_ops' does not exist. Since this rule was created by the macro 'tf_cc_test', the error might have been caused by the macro implementation in /workspace/tensorflow/tensorflow.bzl:346:23.
ERROR: Analysis of target '//tensorflow/core/kernels:immutable_constant_op_test' failed; build aborted.

@vivek-rane
Copy link
Author

Code review comments should be addressed now, and the immutable op test failure should be fixed.

@andydavis1
Copy link
Contributor

@tensorflow-jenkins test this please

@vivek-rane
Copy link
Author

The failure here seems unrelated to our work (likely a setup issue):

15:48:16 Traceback (most recent call last):
15:48:16   File "C:/tf_jenkins/home/workspace/tensorflow-pr-win-cmake-py/tensorflow/python/debug/cli/readline_ui_test.py", line 24, in <module>
15:48:16     from tensorflow.python.debug.cli import readline_ui
15:48:16   File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\debug\cli\readline_ui.py", line 20, in <module>
15:48:16     import readline
15:48:16 ImportError: No module named 'readline'

@martinwicke
Copy link
Member

martinwicke commented Mar 22, 2017 via email

@Cais
Copy link

Cais commented Mar 23, 2017

@martinwicke I believe you pinged the wrong person ...

@martinwicke
Copy link
Member

Ah, sorry, I did!

@caisq, do you recognize this failure?

@caisq
Copy link
Contributor

caisq commented Mar 23, 2017

@martinwicke Yes, this is probably because pyreadline (the Windows equivalent of readline), which is a dependency of tfdbg on Windows, is not installed on the particular Windows machine (win1-slave). I'll install it. This error shouldn't block this PR.

@martinwicke martinwicke merged commit f598a19 into tensorflow:master Mar 23, 2017
@martinwicke
Copy link
Member

Thank you!

@vivek-rane vivek-rane deleted the mkl-kernels branch March 23, 2017 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes stat:awaiting response Status - Awaiting response from author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants