From 121e0161c5a7273c5a59f1e10a8577428c685796 Mon Sep 17 00:00:00 2001 From: Avijit <30507445+avijit-nervana@users.noreply.github.com> Date: Tue, 24 Jul 2018 23:35:27 -0700 Subject: nGraph integration with TensorFlow * Added nGraph bridge as a third_party to be built with TensorFlow based on user selection. * Added a limited set of C++ unit tests to verify the correctness of the computation --- tensorflow/BUILD | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'tensorflow/BUILD') diff --git a/tensorflow/BUILD b/tensorflow/BUILD index 51eea94847..6d443eb9f2 100644 --- a/tensorflow/BUILD +++ b/tensorflow/BUILD @@ -24,6 +24,8 @@ load( "gen_api_init_files", # @unused ) +load("//third_party/ngraph:build_defs.bzl", "if_ngraph") + # Config setting for determining if we are building for Android. config_setting( name = "android", @@ -408,6 +410,14 @@ config_setting( visibility = ["//visibility:public"], ) +# This flag is set from the configure step when the user selects with nGraph option. +# By default it should be false +config_setting( + name = "with_ngraph_support", + values = {"define": "with_ngraph_support=true"}, + visibility = ["//visibility:public"], +) + package_group( name = "internal", packages = [ @@ -540,7 +550,7 @@ tf_cc_shared_object( "//tensorflow/c:version_script.lds", "//tensorflow/c/eager:c_api", "//tensorflow/core:tensorflow", - ], + ] ) tf_cc_shared_object( @@ -568,7 +578,7 @@ tf_cc_shared_object( "//tensorflow/cc:scope", "//tensorflow/cc/profiler", "//tensorflow/core:tensorflow", - ], + ] + if_ngraph(["@ngraph_tf//:ngraph_tf"]) ) exports_files( -- cgit v1.2.3 From 93e950c308071071f35d6dcb35b9f91b8a34876c Mon Sep 17 00:00:00 2001 From: Avijit <30507445+avijit-nervana@users.noreply.github.com> Date: Sun, 12 Aug 2018 14:35:19 -0700 Subject: Updated based on PR feedback. --- WORKSPACE | 2 +- tensorflow/BUILD | 3 +-- tensorflow/core/BUILD | 2 +- tensorflow/core/platform/default/build_config.bzl | 1 - tensorflow/python/BUILD | 2 +- tensorflow/tensorflow.bzl | 1 + tensorflow/workspace.bzl | 1 + third_party/ngraph/ngraph_tf.BUILD | 1 + 8 files changed, 7 insertions(+), 6 deletions(-) (limited to 'tensorflow/BUILD') diff --git a/WORKSPACE b/WORKSPACE index 02a1dc1626..17961829a6 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -78,4 +78,4 @@ new_http_archive( "http://storage.googleapis.com/download.tensorflow.org/models/speech_commands_v0.01.zip", "http://download.tensorflow.org/models/speech_commands_v0.01.zip", ], -) \ No newline at end of file +) diff --git a/tensorflow/BUILD b/tensorflow/BUILD index 161e5f80d4..5c13ebacfc 100644 --- a/tensorflow/BUILD +++ b/tensorflow/BUILD @@ -23,6 +23,7 @@ load( "//tensorflow/python/tools/api/generator:api_gen.bzl", "gen_api_init_files", # @unused ) +load("//third_party/ngraph:build_defs.bzl", "if_ngraph") # Config setting used when building for products # which requires restricted licenses to be avoided. @@ -441,8 +442,6 @@ load( "if_mkl", ) -load("//third_party/ngraph:build_defs.bzl", "if_ngraph") - filegroup( name = "intel_binary_blob", data = if_mkl( diff --git a/tensorflow/core/BUILD b/tensorflow/core/BUILD index 385a14eb44..189f512400 100644 --- a/tensorflow/core/BUILD +++ b/tensorflow/core/BUILD @@ -2523,7 +2523,7 @@ tf_cuda_library( "//third_party/mkl:intel_binary_blob", "@mkl_dnn", ], - ), + ), alwayslink = 1, ) diff --git a/tensorflow/core/platform/default/build_config.bzl b/tensorflow/core/platform/default/build_config.bzl index e15aae5488..28891320c4 100644 --- a/tensorflow/core/platform/default/build_config.bzl +++ b/tensorflow/core/platform/default/build_config.bzl @@ -708,4 +708,3 @@ def tf_additional_binary_deps(): "//third_party/mkl:intel_binary_blob", ], ) - \ No newline at end of file diff --git a/tensorflow/python/BUILD b/tensorflow/python/BUILD index 456f007348..eb3f50f922 100644 --- a/tensorflow/python/BUILD +++ b/tensorflow/python/BUILD @@ -3809,7 +3809,7 @@ tf_py_wrap_cc( tf_additional_plugin_deps() + tf_additional_verbs_deps() + tf_additional_mpi_deps() + - tf_additional_gdr_deps())+ + tf_additional_gdr_deps()) + if_ngraph(["@ngraph_tf//:ngraph_tf"]) ) diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl index 443c582360..12ac8dfa0e 100644 --- a/tensorflow/tensorflow.bzl +++ b/tensorflow/tensorflow.bzl @@ -29,6 +29,7 @@ load( "//third_party/mkl_dnn:build_defs.bzl", "if_mkl_open_source_only", ) + load( "//third_party/ngraph:build_defs.bzl", "if_ngraph", diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl index 702698abed..4aa0172e22 100644 --- a/tensorflow/workspace.bzl +++ b/tensorflow/workspace.bzl @@ -6,6 +6,7 @@ load("//third_party:nccl/nccl_configure.bzl", "nccl_configure") load("//third_party/mkl:build_defs.bzl", "mkl_repository") load("//third_party/git:git_configure.bzl", "git_configure") load("//third_party/py:python_configure.bzl", "python_configure") + load("//third_party/sycl:sycl_configure.bzl", "sycl_configure") load("//third_party/systemlibs:syslibs_configure.bzl", "syslibs_configure") load("//third_party/toolchains/clang6:repo.bzl", "clang6_configure") diff --git a/third_party/ngraph/ngraph_tf.BUILD b/third_party/ngraph/ngraph_tf.BUILD index 838f022222..f36532449c 100644 --- a/third_party/ngraph/ngraph_tf.BUILD +++ b/third_party/ngraph/ngraph_tf.BUILD @@ -68,6 +68,7 @@ cc_library( "-I external/ngraph/src", "-D NGRAPH_EMBEDDED_IN_TENSORFLOW=1", ], + alwayslink=1, visibility = ["//visibility:public"], ) -- cgit v1.2.3