diff --git a/tensorflow/BUILD b/tensorflow/BUILD index 0be7920d1193f2..bee36c8144630f 100644 --- a/tensorflow/BUILD +++ b/tensorflow/BUILD @@ -401,11 +401,10 @@ load( filegroup( name = "intel_binary_blob", - data = if_mkl_ml( - [ - "//third_party/mkl:intel_binary_blob", - ], - ), + # XXX: always link to MKL binary blob + data = [ + "//third_party/mkl:intel_binary_blob", + ], ) cc_library( diff --git a/tensorflow/core/kernels/BUILD b/tensorflow/core/kernels/BUILD index ffb093b2efe7c8..c9f66e2ca1b9c8 100644 --- a/tensorflow/core/kernels/BUILD +++ b/tensorflow/core/kernels/BUILD @@ -3288,9 +3288,10 @@ tf_kernel_library( # *impl.h are excluded by default from the CPU build, add explicitly. hdrs = ["batch_matmul_op_impl.h"], prefix = "batch_matmul_op", - deps = MATH_DEPS + [":eigen_contraction_kernel"] + if_mkl_ml([ + deps = MATH_DEPS + [":eigen_contraction_kernel"] + [ + # XXX: always link to MKL binary blob "//third_party/mkl:intel_binary_blob", - ]), + ] ) tf_kernel_library( diff --git a/tensorflow/core/platform/default/build_config.bzl b/tensorflow/core/platform/default/build_config.bzl index e26828c75e4476..ca1984ea0a4cef 100644 --- a/tensorflow/core/platform/default/build_config.bzl +++ b/tensorflow/core/platform/default/build_config.bzl @@ -741,8 +741,7 @@ def tf_additional_binary_deps(): # core). "//tensorflow/core/kernels:lookup_util", "//tensorflow/core/util/tensor_bundle", - ] + if_mkl_ml( - [ - "//third_party/mkl:intel_binary_blob", - ], - ) + ] + [ + # XXX: always link to MKL binary blob + "//third_party/mkl:intel_binary_blob", + ] diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl index 874d9e872c5d9f..f10d4a53eb5afc 100644 --- a/tensorflow/tensorflow.bzl +++ b/tensorflow/tensorflow.bzl @@ -434,11 +434,9 @@ def tf_cc_binary( name = name, copts = copts, srcs = srcs + tf_binary_additional_srcs(), - deps = deps + tf_binary_dynamic_kernel_deps(kernels) + if_mkl_ml( - [ - clean_dep("//third_party/mkl:intel_binary_blob"), - ], - ), + deps = deps + tf_binary_dynamic_kernel_deps(kernels) + + # XXX: always link to MKL binary blob + [clean_dep("//third_party/mkl:intel_binary_blob")], data = data + tf_binary_dynamic_kernel_dsos(kernels), linkopts = linkopts + _rpath_linkopts(name), **kwargs @@ -780,11 +778,9 @@ def tf_cc_test( "-lm", ], }) + linkopts + _rpath_linkopts(name), - deps = deps + tf_binary_dynamic_kernel_deps(kernels) + if_mkl_ml( - [ - clean_dep("//third_party/mkl:intel_binary_blob"), - ], - ), + deps = deps + tf_binary_dynamic_kernel_deps(kernels) + + # XXX: always link to MKL binary blob + [clean_dep("//third_party/mkl:intel_binary_blob")], data = data + tf_binary_dynamic_kernel_dsos(kernels), exec_compatible_with = tf_exec_compatible_with(kwargs), # Nested select() statements seem not to be supported when passed to diff --git a/tensorflow/tools/pip_package/BUILD b/tensorflow/tools/pip_package/BUILD index bc970d0f763159..74a6bebb8f9932 100644 --- a/tensorflow/tools/pip_package/BUILD +++ b/tensorflow/tools/pip_package/BUILD @@ -253,7 +253,9 @@ sh_binary( "//conditions:default": [ ":simple_console", ], - }) + if_mkl_ml(["//third_party/mkl:intel_binary_blob"]), + }) + + # XXX: always link to MKL binary blob + [ "//third_party/mkl:intel_binary_blob"], ) # A genrule for generating a marker file for the pip package on Windows diff --git a/third_party/mkl/build_defs.bzl b/third_party/mkl/build_defs.bzl index 10c2d90c84816b..9a204badeea51c 100644 --- a/third_party/mkl/build_defs.bzl +++ b/third_party/mkl/build_defs.bzl @@ -106,7 +106,14 @@ def mkl_deps(): inclusion in the deps attribute of rules. """ return select({ - str(Label("//third_party/mkl_dnn:build_with_mkl_dnn_only")): ["@mkl_dnn"], + # XXX: Temporary change: link to binary MKL unless TF threading is + # enabled. Rationale: the binary blob contains libiomp5 -- the Intel + # Compiler OpenMP runtime -- that can be used in place of libgomp + # which is slow. + str(Label("//third_party/mkl_dnn:build_with_mkl_dnn_only")): [ + "//third_party/mkl:intel_binary_blob", + "@mkl_dnn", + ], str(Label("//third_party/mkl:build_with_mkl_ml_only")): ["//third_party/mkl:intel_binary_blob"], str(Label("//third_party/mkl:build_with_mkl")): [ "//third_party/mkl:intel_binary_blob",