aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mahmoud Abuzaina <mahmoud.abuzaina@intel.com>2018-07-05 13:56:22 -0700
committerGravatar Mahmoud Abuzaina <mahmoud.abuzaina@intel.com>2018-07-05 13:56:22 -0700
commit64117da0c36f0697467ce6d56a7be6837da24d2f (patch)
treea0fcf1f18c058c10a5f7828209f1fdb6ce07c58c
parentb2fe2a874bade4782aaca5c44bf29e7ff6c39200 (diff)
Fixing AVX performance issue
-rw-r--r--tensorflow/tensorflow.bzl5
-rw-r--r--third_party/mkl_dnn/BUILD8
-rw-r--r--third_party/mkl_dnn/mkldnn.BUILD29
-rw-r--r--tools/bazel.rc4
4 files changed, 45 insertions, 1 deletions
diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl
index e4632c4811..3e3fbeb8f8 100644
--- a/tensorflow/tensorflow.bzl
+++ b/tensorflow/tensorflow.bzl
@@ -24,6 +24,10 @@ load(
"if_mkl",
"if_mkl_lnx_x64"
)
+load(
+ "//third_party/mkl_dnn:build_defs.bzl",
+ "if_mkl_open_source_only",
+)
def register_extension_info(**kwargs):
pass
@@ -214,6 +218,7 @@ def tf_copts(android_optimization_level_override="-O2", is_external=False):
+ if_cuda(["-DGOOGLE_CUDA=1"])
+ if_tensorrt(["-DGOOGLE_TENSORRT=1"])
+ if_mkl(["-DINTEL_MKL=1", "-DEIGEN_USE_VML"])
+ + if_mkl_open_source_only(["-DDO_NOT_USE_ML"])
+ if_mkl_lnx_x64(["-fopenmp"])
+ if_android_arm(["-mfpu=neon"])
+ if_linux_x86_64(["-msse3"])
diff --git a/third_party/mkl_dnn/BUILD b/third_party/mkl_dnn/BUILD
index 5b01f6e3e4..17a0074abe 100644
--- a/third_party/mkl_dnn/BUILD
+++ b/third_party/mkl_dnn/BUILD
@@ -1 +1,9 @@
licenses(["notice"])
+
+config_setting(
+ name = "using_mkl_dnn_only",
+ values = {
+ "define": "using_mkl_dnn_only=true",
+ },
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/mkl_dnn/mkldnn.BUILD b/third_party/mkl_dnn/mkldnn.BUILD
index 68f24aabae..57d2e1292b 100644
--- a/third_party/mkl_dnn/mkldnn.BUILD
+++ b/third_party/mkl_dnn/mkldnn.BUILD
@@ -1,5 +1,10 @@
exports_files(["LICENSE"])
+load(
+ "@org_tensorflow//third_party/mkl_dnn:build_defs.bzl",
+ "if_mkl_open_source_only",
+)
+
config_setting(
name = "clang_linux_x86_64",
values = {
@@ -15,7 +20,14 @@ cc_library(
"src/cpu/*.cpp",
]),
hdrs = glob(["include/*"]),
- copts = ["-fexceptions"] + select({
+ copts = [
+ "-fexceptions",
+ "-DUSE_MKL",
+ "-DUSE_CBLAS",
+ ] + if_mkl_open_source_only([
+ "-UUSE_MKL",
+ "-UUSE_CBLAS",
+ ]) + select({
"@org_tensorflow//tensorflow:linux_x86_64": [
"-fopenmp", # only works with gcc
],
@@ -33,4 +45,19 @@ cc_library(
],
nocopts = "-fno-exceptions",
visibility = ["//visibility:public"],
+ deps = select({
+ "@org_tensorflow//tensorflow:linux_x86_64": [
+ "@mkl_linux//:mkl_headers",
+ "@mkl_linux//:mkl_libs_linux",
+ ],
+ "@org_tensorflow//tensorflow:darwin": [
+ "@mkl_darwin//:mkl_headers",
+ "@mkl_darwin//:mkl_libs_darwin",
+ ],
+ "@org_tensorflow//tensorflow:windows": [
+ "@mkl_windows//:mkl_headers",
+ "@mkl_windows//:mkl_libs_windows",
+ ],
+ "//conditions:default": [],
+ }),
)
diff --git a/tools/bazel.rc b/tools/bazel.rc
index 1c1e6afb65..b3a9e6f0ef 100644
--- a/tools/bazel.rc
+++ b/tools/bazel.rc
@@ -27,6 +27,10 @@ build --define framework_shared_object=true
build:mkl --define=using_mkl=true
build:mkl -c opt
+# This config option is used to enable MKL-DNN open source library only,
+# without depending on MKL binary version.
+build:mkl_open_source_only --define=using_mkl_dnn_only=true
+
build:download_clang --crosstool_top=@local_config_download_clang//:toolchain
build:download_clang --define=using_clang=true