diff --git a/tensorflow/BUILD b/tensorflow/BUILD index a04ddf9f8a1927..4a048456b44b80 100644 --- a/tensorflow/BUILD +++ b/tensorflow/BUILD @@ -444,11 +444,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 b195d06b334f9d..f76c4dff49e79e 100644 --- a/tensorflow/core/kernels/BUILD +++ b/tensorflow/core/kernels/BUILD @@ -3514,9 +3514,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 ba7fccdd6fdb7d..f65e188e3bd76d 100644 --- a/tensorflow/core/platform/default/build_config.bzl +++ b/tensorflow/core/platform/default/build_config.bzl @@ -784,11 +784,10 @@ 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", + ] def tf_additional_numa_deps(): return select({ diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl index 98e2cf100bdcab..9cf92a83202148 100644 --- a/tensorflow/tensorflow.bzl +++ b/tensorflow/tensorflow.bzl @@ -597,11 +597,9 @@ def tf_cc_binary( name = name_os, 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 = depset(data + added_data_deps), linkopts = linkopts + _rpath_linkopts(name_os), visibility = visibility, @@ -956,11 +954,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() + tf_binary_additional_srcs(), diff --git a/tensorflow/tools/pip_package/BUILD b/tensorflow/tools/pip_package/BUILD index 457ec631919283..466a54489dbd8c 100644 --- a/tensorflow/tools/pip_package/BUILD +++ b/tensorflow/tools/pip_package/BUILD @@ -271,7 +271,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",