aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party
diff options
context:
space:
mode:
authorGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-09-18 17:18:58 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-09-18 17:19:05 -0700
commit08af8cac22af4cc430e092b6218ca77736efb82c (patch)
tree36d4b644f518eea56e359a777d208846be52a635 /third_party
parent93b5dea9663c00d3bb06348143b50b73b6fbacfb (diff)
parent7210ca23ce19e54aa3cbc21ff72e5e5d4189dfea (diff)
Merge pull request #22160 from NervanaSystems:avijit/add-cpu-backend
PiperOrigin-RevId: 213546915
Diffstat (limited to 'third_party')
-rw-r--r--third_party/ngraph/ngraph.BUILD113
-rw-r--r--third_party/ngraph/ngraph_tf.BUILD48
-rw-r--r--third_party/ngraph/tbb.BUILD63
3 files changed, 198 insertions, 26 deletions
diff --git a/third_party/ngraph/ngraph.BUILD b/third_party/ngraph/ngraph.BUILD
index 31aa3cee51..1fd1b8e8e0 100644
--- a/third_party/ngraph/ngraph.BUILD
+++ b/third_party/ngraph/ngraph.BUILD
@@ -3,6 +3,112 @@ licenses(["notice"]) # 3-Clause BSD
exports_files(["LICENSE"])
cc_library(
+ name = "ngraph_headers",
+ hdrs = glob(["src/ngraph/**/*.hpp"]),
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "ngraph_cpu_backend",
+ srcs = [
+ "src/ngraph/runtime/cpu/cpu_backend.cpp",
+ "src/ngraph/runtime/cpu/cpu_builder.cpp",
+ "src/ngraph/runtime/cpu/cpu_call_frame.cpp",
+ "src/ngraph/runtime/cpu/cpu_external_function.cpp",
+ "src/ngraph/runtime/cpu/cpu_kernels.cpp",
+ "src/ngraph/runtime/cpu/cpu_layout_descriptor.cpp",
+ "src/ngraph/runtime/cpu/cpu_tensor_view_wrapper.cpp",
+ "src/ngraph/runtime/cpu/cpu_tensor_view.cpp",
+ "src/ngraph/runtime/cpu/cpu_tracing.cpp",
+ "src/ngraph/runtime/cpu/builder/add.cpp",
+ "src/ngraph/runtime/cpu/builder/allreduce.cpp",
+ "src/ngraph/runtime/cpu/builder/avg_pool.cpp",
+ "src/ngraph/runtime/cpu/builder/argmin.cpp",
+ "src/ngraph/runtime/cpu/builder/argmax.cpp",
+ "src/ngraph/runtime/cpu/builder/batch_norm.cpp",
+ "src/ngraph/runtime/cpu/builder/broadcast.cpp",
+ "src/ngraph/runtime/cpu/builder/bounded_relu.cpp",
+ "src/ngraph/runtime/cpu/builder/concat.cpp",
+ "src/ngraph/runtime/cpu/builder/convert.cpp",
+ "src/ngraph/runtime/cpu/builder/convert_layout.cpp",
+ "src/ngraph/runtime/cpu/builder/convolution.cpp",
+ "src/ngraph/runtime/cpu/builder/dot.cpp",
+ "src/ngraph/runtime/cpu/builder/function_call.cpp",
+ "src/ngraph/runtime/cpu/builder/lstm.cpp",
+ "src/ngraph/runtime/cpu/builder/lrn.cpp",
+ "src/ngraph/runtime/cpu/builder/matmul_bias.cpp",
+ "src/ngraph/runtime/cpu/builder/max.cpp",
+ "src/ngraph/runtime/cpu/builder/max_pool.cpp",
+ "src/ngraph/runtime/cpu/builder/min.cpp",
+ "src/ngraph/runtime/cpu/builder/one_hot.cpp",
+ "src/ngraph/runtime/cpu/builder/relu.cpp",
+ "src/ngraph/runtime/cpu/builder/pad.cpp",
+ "src/ngraph/runtime/cpu/builder/product.cpp",
+ "src/ngraph/runtime/cpu/builder/reduce_function.cpp",
+ "src/ngraph/runtime/cpu/builder/reduce_function_window.cpp",
+ "src/ngraph/runtime/cpu/builder/replace_slice.cpp",
+ "src/ngraph/runtime/cpu/builder/reshape.cpp",
+ "src/ngraph/runtime/cpu/builder/reverse.cpp",
+ "src/ngraph/runtime/cpu/builder/reverse_sequence.cpp",
+ "src/ngraph/runtime/cpu/builder/rnn.cpp",
+ "src/ngraph/runtime/cpu/builder/select.cpp",
+ "src/ngraph/runtime/cpu/builder/select_and_scatter.cpp",
+ "src/ngraph/runtime/cpu/builder/sigmoid.cpp",
+ "src/ngraph/runtime/cpu/builder/slice.cpp",
+ "src/ngraph/runtime/cpu/builder/softmax.cpp",
+ "src/ngraph/runtime/cpu/builder/sum.cpp",
+ "src/ngraph/runtime/cpu/kernel/eigen_thread_pool.cpp",
+ "src/ngraph/runtime/cpu/kernel/pad.cpp",
+ "src/ngraph/runtime/cpu/kernel/reduce_max.cpp",
+ "src/ngraph/runtime/cpu/kernel/reduce_sum.cpp",
+ "src/ngraph/runtime/cpu/kernel/reshape.cpp",
+ "src/ngraph/runtime/cpu/mkldnn_emitter.cpp",
+ "src/ngraph/runtime/cpu/mkldnn_invoke.cpp",
+ "src/ngraph/runtime/cpu/mkldnn_utils.cpp",
+ "src/ngraph/runtime/cpu/op/batch_dot.cpp",
+ "src/ngraph/runtime/cpu/op/batch_norm_relu.cpp",
+ "src/ngraph/runtime/cpu/op/bounded_relu.cpp",
+ "src/ngraph/runtime/cpu/op/group_conv.cpp",
+ "src/ngraph/runtime/cpu/op/conv_bias.cpp",
+ "src/ngraph/runtime/cpu/op/conv_relu.cpp",
+ "src/ngraph/runtime/cpu/op/convert_layout.cpp",
+ "src/ngraph/runtime/cpu/op/loop_kernel.cpp",
+ "src/ngraph/runtime/cpu/op/lstm.cpp",
+ "src/ngraph/runtime/cpu/op/matmul_bias.cpp",
+ "src/ngraph/runtime/cpu/op/max_pool_with_indices.cpp",
+ "src/ngraph/runtime/cpu/op/rnn.cpp",
+ "src/ngraph/runtime/cpu/op/sigmoid_mul.cpp",
+ "src/ngraph/runtime/cpu/pass/cpu_assignment.cpp",
+ "src/ngraph/runtime/cpu/pass/cpu_collapse_dims.cpp",
+ "src/ngraph/runtime/cpu/pass/cpu_concat_inputs.cpp",
+ "src/ngraph/runtime/cpu/pass/cpu_fusion.cpp",
+ "src/ngraph/runtime/cpu/pass/cpu_layout.cpp",
+ "src/ngraph/runtime/cpu/pass/cpu_loop_kernel_fusion.cpp",
+ "src/ngraph/runtime/cpu/pass/cpu_mat_fusion.cpp",
+ "src/ngraph/runtime/cpu/pass/cpu_post_layout_optimizations.cpp",
+ "src/ngraph/runtime/cpu/pass/cpu_rnn_fusion.cpp",
+ "src/ngraph/runtime/cpu/pass/cpu_workspace_insertion.cpp",
+ ],
+ hdrs = glob(["src/ngraph/runtime/cpu/**/*.hpp"]) + glob([]),
+ deps = [
+ ":ngraph_headers",
+ "@eigen_archive//:eigen",
+ "@nlohmann_json_lib",
+ "@tbb",
+ "@mkl_dnn//:mkl_dnn",
+ ],
+ copts = [
+ "-I external/ngraph/src",
+ "-I external/nlohmann_json_lib/include/",
+ '-D SHARED_LIB_EXT=\\".so\\"',
+ '-D NGRAPH_VERSION=\\"0.7.0\\"',
+ "-D NGRAPH_DEX_ONLY",
+ ],
+ visibility = ["//visibility:public"],
+ alwayslink = 1,
+)
+
+cc_library(
name = "ngraph_core",
srcs = glob([
"src/ngraph/*.cpp",
@@ -18,11 +124,10 @@ cc_library(
"src/ngraph/pass/*.hpp",
"src/ngraph/runtime/*.cpp",
"src/ngraph/type/*.cpp",
- "src/ngraph/runtime/interpreter/*.cpp",
- "src/ngraph/runtime/interpreter/*.hpp",
]),
- hdrs = glob(["src/ngraph/**/*.hpp"]),
deps = [
+ ":ngraph_headers",
+ ":ngraph_cpu_backend",
"@eigen_archive//:eigen",
"@nlohmann_json_lib",
],
@@ -30,7 +135,7 @@ cc_library(
"-I external/ngraph/src",
"-I external/nlohmann_json_lib/include/",
'-D SHARED_LIB_EXT=\\".so\\"',
- '-D NGRAPH_VERSION=\\"0.5.0\\"',
+ '-D NGRAPH_VERSION=\\"0.7.0\\"',
],
visibility = ["//visibility:public"],
alwayslink = 1,
diff --git a/third_party/ngraph/ngraph_tf.BUILD b/third_party/ngraph/ngraph_tf.BUILD
index 4d96ccf2f2..979318d7c2 100644
--- a/third_party/ngraph/ngraph_tf.BUILD
+++ b/third_party/ngraph/ngraph_tf.BUILD
@@ -8,37 +8,34 @@ load(
)
cc_library(
- name = "ngraph_libs_linux",
- srcs = [
- "lib/libiomp5.so",
- "lib/libmklml_intel.so",
- ],
- visibility = ["//visibility:public"],
-)
-
-cc_library(
name = "ngraph_tf",
srcs = [
+ "src/ngraph_api.h",
+ "src/ngraph_api.cc",
+ "src/ngraph_assign_clusters.h",
+ "src/ngraph_assign_clusters.cc",
"src/ngraph_builder.h",
"src/ngraph_builder.cc",
- "src/ngraph_cluster.h",
- "src/ngraph_cluster.cc",
+ "src/ngraph_capture_variables.h",
+ "src/ngraph_capture_variables.cc",
+ "src/ngraph_conversions.h",
"src/ngraph_cluster_manager.h",
"src/ngraph_cluster_manager.cc",
- "src/ngraph_confirm_pass.cc",
- "src/ngraph_device.cc",
+ "src/ngraph_deassign_clusters.h",
+ "src/ngraph_deassign_clusters.cc",
"src/ngraph_encapsulate_op.cc",
- "src/ngraph_encapsulate_pass.cc",
+ "src/ngraph_encapsulate_clusters.h",
+ "src/ngraph_encapsulate_clusters.cc",
"src/ngraph_freshness_tracker.h",
"src/ngraph_freshness_tracker.cc",
- "src/ngraph_graph_rewrite_passes.cc",
- "src/ngraph_liberate_pass.cc",
- "src/ngraph_op_kernels.cc",
- "src/ngraph_stub_ops.cc",
+ "src/ngraph_mark_for_clustering.h",
+ "src/ngraph_mark_for_clustering.cc",
+ "src/ngraph_rewrite_pass.cc",
+ "src/ngraph_rewrite_for_tracking.h",
+ "src/ngraph_rewrite_for_tracking.cc",
+ "src/ngraph_tracked_variable.cc",
"src/ngraph_utils.h",
"src/ngraph_utils.cc",
- "src/ngraph_send_recv_ops.cc",
- "src/ngraph_variable_ops.cc",
"src/tf_graphcycles.cc",
"logging/ngraph_log.h",
"logging/ngraph_log.cc",
@@ -58,7 +55,6 @@ cc_library(
"-I external/ngraph_tf/src",
"-I external/ngraph_tf/logging",
"-I external/ngraph/src",
- "-D NGRAPH_EMBEDDED_IN_TENSORFLOW=1",
],
alwayslink = 1,
visibility = ["//visibility:public"],
@@ -69,6 +65,15 @@ tf_cc_test(
size = "small",
srcs = [
"test/tf_exec.cpp",
+ "test/conversions.cpp",
+ "test/padding.cpp",
+ "test/graph_rewrites/assign_clusters.cc",
+ "test/test_utilities.h",
+ "test/test_utilities.cpp",
+ "test/test_math_ops.cpp",
+ "test/test_nn_ops.cpp",
+ "test/opexecuter.h",
+ "test/opexecuter.cpp",
"test/main.cpp",
],
deps = [
@@ -80,7 +85,6 @@ tf_cc_test(
],
extra_copts = [
"-fexceptions ",
- "-D NGRAPH_EMBEDDED_IN_TENSORFLOW=1",
"-I external/ngraph_tf/src",
"-I external/ngraph_tf/logging",
"-I external/ngraph/src",
diff --git a/third_party/ngraph/tbb.BUILD b/third_party/ngraph/tbb.BUILD
new file mode 100644
index 0000000000..04e6544ffb
--- /dev/null
+++ b/third_party/ngraph/tbb.BUILD
@@ -0,0 +1,63 @@
+licenses(["notice"]) # 3-Clause BSD
+
+exports_files(["LICENSE"])
+
+# Taken from: https://github.com/rnburn/satyr/blob/master/bazel/tbb.BUILD
+# License for this BUILD file: MIT
+# See: https://github.com/rnburn/satyr/blob/master/LICENSE
+#
+# License for TBB: Apache 2.0
+# See: https://github.com/01org/tbb/blob/tbb_2018/LICENSE
+
+genrule(
+ name = "build_tbb",
+ srcs = glob(["**"]) + [
+ "@local_config_cc//:toolchain",
+ ],
+ cmd = """
+ set -e
+ WORK_DIR=$$PWD
+ DEST_DIR=$$PWD/$(@D)
+ export PATH=$$(dirname $(AR)):$$PATH
+ export CXXFLAGS=$(CC_FLAGS)
+ export NM=$(NM)
+ export AR=$(AR)
+ cd $$(dirname $(location :Makefile))
+
+ #TBB's build needs some help to figure out what compiler it's using
+ if $$CXX --version | grep clang &> /dev/null; then
+ COMPILER_OPT="compiler=clang"
+ else
+ COMPILER_OPT="compiler=gcc"
+
+ # # Workaround for TBB bug
+ # # See https://github.com/01org/tbb/issues/59
+ # CXXFLAGS="$$CXXFLAGS -flifetime-dse=1"
+ fi
+
+ # uses extra_inc=big_iron.inc to specify that static libraries are
+ # built. See https://software.intel.com/en-us/forums/intel-threading-building-blocks/topic/297792
+ make tbb_build_prefix="build" \
+ extra_inc=big_iron.inc \
+ $$COMPILER_OPT; \
+
+ echo cp build/build_{release,debug}/*.a $$DEST_DIR
+ cp build/build_{release,debug}/*.a $$DEST_DIR
+ cd $$WORK_DIR
+ """,
+ outs = [
+ "libtbb.a",
+ "libtbbmalloc.a",
+ ],
+)
+
+cc_library(
+ name = "tbb",
+ hdrs = glob([
+ "include/serial/**",
+ "include/tbb/**/**",
+ ]),
+ srcs = ["libtbb.a"],
+ includes = ["include"],
+ visibility = ["//visibility:public"],
+)