Re-enabling MKL-DNN contraction kernel. Prevent _lstm_ops.so and _gru_ops.so from using MKL-DNN contraction kernel to avoid having duplicate MKL-DNN thread-local symbols in both files which can cause a crash due to linking issues.

PiperOrigin-RevId: 241355936
This commit is contained in:
Penporn Koanantakool 2019-04-01 10:50:30 -07:00 committed by TensorFlower Gardener
parent daf85eddac
commit 3af1404a10
3 changed files with 27 additions and 7 deletions
.bazelrc
tensorflow
contrib/rnn
core/kernels

View File

@ -105,9 +105,6 @@ build --define=PREFIX=/usr
build --define=LIBDIR=$(PREFIX)/lib
build --define=INCLUDEDIR=$(PREFIX)/include
# Disable MKL-DNN contraction kernels by default.
build --define=tensorflow_mkldnn_contraction_kernel=0
# Default options should come above this line
# Options from ./configure

View File

@ -182,8 +182,10 @@ tf_custom_op_library(
"kernels/lstm_ops.h",
],
deps = [
"//tensorflow/core/kernels:eigen_contraction_kernel",
"//tensorflow/core/kernels:eigen_helpers",
# _lstm_ops.so and _gru_ops.so cannot both be linked to MKL-DNN,
# or there will be duplicate thread_local symbols, which can cause
# problems in TensorFlow Transform.
"//tensorflow/core/kernels:eigen_helpers_no_mkl",
],
)
@ -207,8 +209,10 @@ tf_custom_op_library(
"kernels/gru_ops.h",
],
deps = [
"//tensorflow/core/kernels:eigen_contraction_kernel",
"//tensorflow/core/kernels:eigen_helpers",
# _lstm_ops.so and _gru_ops.so cannot both be linked to MKL-DNN,
# or there will be duplicate thread_local symbols, which can cause
# problems in TensorFlow Transform.
"//tensorflow/core/kernels:eigen_helpers_no_mkl",
],
)

View File

@ -792,6 +792,25 @@ cc_library(
],
)
cc_library(
name = "eigen_helpers_no_mkl",
hdrs = [
"eigen_activations.h",
"eigen_attention.h",
"eigen_backward_cuboid_convolutions.h",
"eigen_backward_spatial_convolutions.h",
"eigen_cuboid_convolution.h",
"eigen_pooling.h",
"eigen_softmax.h",
"eigen_spatial_convolutions.h",
"eigen_volume_patch.h",
],
deps = [
":eigen_spatial_convolutions-inl",
"//third_party/eigen3",
],
)
cc_library(
name = "eigen_spatial_convolutions-inl",
hdrs = [