diff options
author | Brennan Saeta <brennan.saeta@gmail.com> | 2018-06-16 12:23:23 -0700 |
---|---|---|
committer | Gunhan Gulsoy <gunan@google.com> | 2018-06-16 12:23:23 -0700 |
commit | 6d1603622b1c3b25de0a8d342714fed271308a47 (patch) | |
tree | b6f141e7cdd24c90ad7ca537ad0ecd690d8b36e1 | |
parent | 79d7e11f3ea4ec13332693cdcf271bf10aad583d (diff) |
Do not depend on boringssl for big-endian architectures. (#20038)
* Do not depend on boringssl for big-endian architectures.
A recent commit migrated TensorFlow from grpc_unsecure (and grpc++_unsecure)
to their secure variants. These secure variants depend on BoringSSL.
Unfortunately, BoringSSL does not work on big-endian architectures.
This commit abstracts the grpc dependency behind a couple cc_library rules,
and plumbs through the logic to conditionally build without BoringSSL based
on the target architecture.
Fixes #20014
* Fix BUILD file formatting.
* Fix typo in CPU name
* Add an additional bind and select when evaluating the cc_proto_library rules.
-rw-r--r-- | tensorflow/BUILD | 22 | ||||
-rw-r--r-- | tensorflow/compiler/xla/rpc/BUILD | 6 | ||||
-rw-r--r-- | tensorflow/contrib/tpu/profiler/BUILD | 2 | ||||
-rw-r--r-- | tensorflow/contrib/verbs/BUILD | 4 | ||||
-rw-r--r-- | tensorflow/core/debug/BUILD | 4 | ||||
-rw-r--r-- | tensorflow/core/distributed_runtime/BUILD | 4 | ||||
-rw-r--r-- | tensorflow/core/distributed_runtime/eager/BUILD | 4 | ||||
-rw-r--r-- | tensorflow/core/distributed_runtime/rpc/BUILD | 38 | ||||
-rw-r--r-- | tensorflow/core/distributed_runtime/rpc/eager/BUILD | 6 | ||||
-rw-r--r-- | tensorflow/core/platform/default/build_config.bzl | 5 | ||||
-rw-r--r-- | tensorflow/workspace.bzl | 5 |
11 files changed, 65 insertions, 35 deletions
diff --git a/tensorflow/BUILD b/tensorflow/BUILD index d77f04139e..4e212e96dc 100644 --- a/tensorflow/BUILD +++ b/tensorflow/BUILD @@ -155,6 +155,12 @@ config_setting( ) config_setting( + name = "linux_s390x", + values = {"cpu": "s390x"}, + visibility = ["//visibility:public"], +) + +config_setting( name = "debug", values = { "compilation_mode": "dbg", @@ -424,6 +430,22 @@ filegroup( data = glob(["docs_src/**/*.md"]), ) +cc_library( + name = "grpc", + deps = select({ + ":linux_s390x": ["@grpc//:grpc_unsecure"], + "//conditions:default": ["@grpc"], + }), +) + +cc_library( + name = "grpc++", + deps = select({ + ":linux_s390x": ["@grpc//:grpc++_unsecure"], + "//conditions:default": ["@grpc//:grpc++"], + }), +) + # A shared object which includes registration mechanisms for ops and # kernels. Does not include the implementations of any ops or kernels. Instead, # the library which loads libtensorflow_framework.so diff --git a/tensorflow/compiler/xla/rpc/BUILD b/tensorflow/compiler/xla/rpc/BUILD index 1775666652..0b1cec1925 100644 --- a/tensorflow/compiler/xla/rpc/BUILD +++ b/tensorflow/compiler/xla/rpc/BUILD @@ -39,10 +39,10 @@ tf_cc_binary( srcs = ["grpc_service_main.cc"], deps = [ ":grpc_service", + "//tensorflow:grpc++", "//tensorflow/compiler/xla/service:cpu_plugin", "//tensorflow/core:framework_internal", "//tensorflow/core:lib", - "@grpc//:grpc++", ], ) @@ -54,6 +54,7 @@ tf_cc_test( ], deps = [ ":grpc_stub", + "//tensorflow:grpc++", "//tensorflow/compiler/xla/client", "//tensorflow/compiler/xla/client/xla_client:xla_builder", "//tensorflow/compiler/xla/tests:literal_test_util", @@ -61,7 +62,6 @@ tf_cc_test( "//tensorflow/core:lib", "//tensorflow/core:test", "//tensorflow/core:test_main", - "@grpc//:grpc++", ], ) @@ -71,9 +71,9 @@ cc_library( hdrs = ["grpc_service.h"], deps = [ ":xla_service_proto", + "//tensorflow:grpc++", "//tensorflow/compiler/xla/service", "//tensorflow/compiler/xla/service:platform_util", "//tensorflow/core/distributed_runtime/rpc:grpc_util", - "@grpc//:grpc++", ], ) diff --git a/tensorflow/contrib/tpu/profiler/BUILD b/tensorflow/contrib/tpu/profiler/BUILD index 3b2d7adfff..38d1c3049e 100644 --- a/tensorflow/contrib/tpu/profiler/BUILD +++ b/tensorflow/contrib/tpu/profiler/BUILD @@ -49,11 +49,11 @@ tf_cc_binary( ":tpu_profiler_analysis_proto_cc", ":tpu_profiler_proto_cc", ":version", + "//tensorflow:grpc++", "//tensorflow/core:framework_internal", "//tensorflow/core:lib", "//tensorflow/core/distributed_runtime/rpc:grpc_util", "//tensorflow/core/platform/cloud:gcs_file_system", - "@grpc//:grpc++", ], ) diff --git a/tensorflow/contrib/verbs/BUILD b/tensorflow/contrib/verbs/BUILD index 1b45584dcb..19cb8983b6 100644 --- a/tensorflow/contrib/verbs/BUILD +++ b/tensorflow/contrib/verbs/BUILD @@ -53,12 +53,12 @@ cc_library( ":grpc_verbs_service_impl", ":rdma_mgr", ":verbs_service_proto_cc", + "//tensorflow:grpc++", "//tensorflow/core:lib_internal", "//tensorflow/core/distributed_runtime:session_mgr", "//tensorflow/core/distributed_runtime/rpc:async_service_interface", "//tensorflow/core/distributed_runtime/rpc:grpc_call", "//tensorflow/core/distributed_runtime/rpc:grpc_util", - "@grpc//:grpc++", ], alwayslink = 1, ) @@ -69,7 +69,7 @@ cc_library( hdrs = ["grpc_verbs_service_impl.h"], deps = [ ":verbs_service_proto_cc", - "@grpc//:grpc++", + "//tensorflow:grpc++", ], ) diff --git a/tensorflow/core/debug/BUILD b/tensorflow/core/debug/BUILD index 50f8a307d8..36e9b3455a 100644 --- a/tensorflow/core/debug/BUILD +++ b/tensorflow/core/debug/BUILD @@ -143,6 +143,7 @@ tf_cuda_library( ":debug_node_key", ":debug_service_proto_cc", ":debugger_event_metadata_proto_cc", + "//tensorflow:grpc++", "//tensorflow/core:core_cpu_internal", "//tensorflow/core:framework", "//tensorflow/core:graph", @@ -150,7 +151,6 @@ tf_cuda_library( "//tensorflow/core:lib_internal", "//tensorflow/core:proto_text", "//tensorflow/core:protos_all_cc", - "@grpc//:grpc++", ], alwayslink = 1, ) @@ -166,11 +166,11 @@ tf_cuda_library( ":debug_io_utils", ":debug_service_proto_cc", ":debugger_event_metadata_proto_cc", + "//tensorflow:grpc++", "//tensorflow/core:framework", "//tensorflow/core:lib", "//tensorflow/core:lib_internal", "//tensorflow/core:protos_all_cc", - "@grpc//:grpc++", ], alwayslink = 1, ) diff --git a/tensorflow/core/distributed_runtime/BUILD b/tensorflow/core/distributed_runtime/BUILD index c6db2aec06..0abef01a9a 100644 --- a/tensorflow/core/distributed_runtime/BUILD +++ b/tensorflow/core/distributed_runtime/BUILD @@ -628,6 +628,7 @@ tf_cuda_cc_test( ":master", ":remote_device", ":worker_interface", + "//tensorflow:grpc++", "//tensorflow/core:core_cpu", "//tensorflow/core:core_cpu_internal", "//tensorflow/core:framework", @@ -649,7 +650,6 @@ tf_cuda_cc_test( "//tensorflow/core/kernels:dense_update_ops", "//tensorflow/core/kernels:identity_op", "//tensorflow/core/kernels:variable_ops", - "@grpc//:grpc++", ], ) @@ -667,6 +667,7 @@ tf_cuda_cc_test( ":master", ":remote_device", ":worker_interface", + "//tensorflow:grpc++", "//tensorflow/core:core_cpu", "//tensorflow/core:core_cpu_internal", "//tensorflow/core:framework", @@ -682,7 +683,6 @@ tf_cuda_cc_test( "//tensorflow/core/distributed_runtime/rpc:grpc_testlib", "//tensorflow/core/distributed_runtime/rpc:grpc_util", "//tensorflow/core/distributed_runtime/rpc:grpc_worker_cache", - "@grpc//:grpc++", ], ) diff --git a/tensorflow/core/distributed_runtime/eager/BUILD b/tensorflow/core/distributed_runtime/eager/BUILD index dc02d1b9bf..1a7187597d 100644 --- a/tensorflow/core/distributed_runtime/eager/BUILD +++ b/tensorflow/core/distributed_runtime/eager/BUILD @@ -47,6 +47,8 @@ cc_library( "eager_service_impl.h", ], deps = [ + "//tensorflow:grpc", + "//tensorflow:grpc++", "//tensorflow/c:c_api_internal", "//tensorflow/c:tf_status_helper", "//tensorflow/core:core_cpu_internal", @@ -65,8 +67,6 @@ cc_library( "//tensorflow/core/distributed_runtime:worker_env", "//tensorflow/core/distributed_runtime/eager:remote_tensor_handle", "//tensorflow/core/distributed_runtime/rpc:rpc_rendezvous_mgr", - "@grpc", - "@grpc//:grpc++", ], ) diff --git a/tensorflow/core/distributed_runtime/rpc/BUILD b/tensorflow/core/distributed_runtime/rpc/BUILD index 882271e3f5..66c4e5d7a9 100644 --- a/tensorflow/core/distributed_runtime/rpc/BUILD +++ b/tensorflow/core/distributed_runtime/rpc/BUILD @@ -41,8 +41,8 @@ cc_library( srcs = ["grpc_util.cc"], hdrs = ["grpc_util.h"], deps = [ - "@grpc", - "@grpc//:grpc++", + "//tensorflow:grpc", + "//tensorflow:grpc++", "//tensorflow/core:lib", # Required to be able to overload TensorResponse parsing. "//tensorflow/core/distributed_runtime:tensor_coding", @@ -55,8 +55,8 @@ cc_library( hdrs = ["grpc_client_cq_tag.h"], deps = [ ":grpc_util", + "//tensorflow:grpc++", "//tensorflow/core:lib", - "@grpc//:grpc++", ], ) @@ -67,10 +67,10 @@ cc_library( deps = [ ":grpc_client_cq_tag", ":grpc_util", + "//tensorflow:grpc++", "//tensorflow/core:lib", "//tensorflow/core/distributed_runtime:call_options", "//tensorflow/core/distributed_runtime:tensor_coding", - "@grpc//:grpc++", ], ) @@ -83,6 +83,7 @@ cc_library( ":grpc_state", ":grpc_util", ":grpc_worker_service_impl", + "//tensorflow:grpc++", "//tensorflow/core:core_cpu_internal", "//tensorflow/core:lib", "//tensorflow/core:lib_internal", @@ -90,7 +91,6 @@ cc_library( "//tensorflow/core/distributed_runtime:tensor_coding", "//tensorflow/core/distributed_runtime:worker_cache_logger", "//tensorflow/core/distributed_runtime:worker_interface", - "@grpc//:grpc++", ], ) @@ -100,10 +100,10 @@ cc_library( hdrs = ["grpc_channel.h"], deps = [ ":grpc_util", + "//tensorflow:grpc++", "//tensorflow/core:framework", "//tensorflow/core:lib", "//tensorflow/core:lib_internal", - "@grpc//:grpc++", ], ) @@ -112,13 +112,13 @@ cc_library( srcs = ["grpc_tensor_coding.cc"], hdrs = ["grpc_tensor_coding.h"], deps = [ + "//tensorflow:grpc++", "//tensorflow/core:core_cpu_internal", "//tensorflow/core:framework", "//tensorflow/core:framework_internal", "//tensorflow/core:lib", "//tensorflow/core:protos_all_cc", "//tensorflow/core:worker_proto_cc", - "@grpc//:grpc++", ], ) @@ -127,9 +127,9 @@ cc_library( srcs = [], hdrs = ["grpc_call.h"], deps = [ + "//tensorflow:grpc++", "//tensorflow/core:lib", "//tensorflow/core:lib_internal", - "@grpc//:grpc++", ], ) @@ -167,6 +167,7 @@ tf_cuda_library( ":grpc_tensor_coding", ":grpc_util", ":grpc_worker_service_impl", + "//tensorflow:grpc++", "//tensorflow/core:core_cpu_internal", "//tensorflow/core:framework", "//tensorflow/core:lib", @@ -180,7 +181,6 @@ tf_cuda_library( "//tensorflow/core/distributed_runtime:worker_cache", "//tensorflow/core/distributed_runtime:worker_env", "//tensorflow/core/distributed_runtime:worker_session", - "@grpc//:grpc++", ], ) @@ -190,9 +190,9 @@ cc_library( hdrs = ["grpc_worker_service_impl.h"], deps = [ ":grpc_util", + "//tensorflow:grpc++", "//tensorflow/core:worker_proto_cc", "//tensorflow/core/distributed_runtime:tensor_coding", - "@grpc//:grpc++", ], ) @@ -221,11 +221,11 @@ cc_library( ":grpc_call", ":grpc_master_service_impl", ":grpc_util", + "//tensorflow:grpc++", "//tensorflow/core:lib", "//tensorflow/core:lib_internal", "//tensorflow/core:master_proto_cc", "//tensorflow/core/distributed_runtime:master", - "@grpc//:grpc++", ], alwayslink = 1, ) @@ -235,8 +235,8 @@ cc_library( srcs = ["grpc_master_service_impl.cc"], hdrs = ["grpc_master_service_impl.h"], deps = [ + "//tensorflow:grpc++", "//tensorflow/core:master_proto_cc", - "@grpc//:grpc++", ], ) @@ -269,6 +269,8 @@ cc_library( ":grpc_worker_cache", ":grpc_worker_service", ":rpc_rendezvous_mgr", + "//tensorflow:grpc", + "//tensorflow:grpc++", "//tensorflow/core:core_cpu", "//tensorflow/core:core_cpu_internal", "//tensorflow/core:framework", @@ -285,8 +287,6 @@ cc_library( "//tensorflow/core/distributed_runtime:server_lib", "//tensorflow/core/distributed_runtime:session_mgr", "//tensorflow/core/distributed_runtime:worker_env", - "@grpc", - "@grpc//:grpc++", ], alwayslink = 1, ) @@ -307,13 +307,13 @@ tf_cc_binary( ], deps = [ ":grpc_server_lib", + "//tensorflow:grpc++", "//tensorflow/core:core_cpu", "//tensorflow/core:framework_internal", "//tensorflow/core:lib", "//tensorflow/core:protos_all_cc", "//tensorflow/core/distributed_runtime:server_lib", "//tensorflow/core/kernels:data_flow", - "@grpc//:grpc++", ], ) @@ -325,6 +325,7 @@ tf_cc_binary( ], deps = [ ":grpc_server_lib", + "//tensorflow:grpc++", "//tensorflow/core:core_cpu", "//tensorflow/core:framework_internal", "//tensorflow/core:lib", @@ -338,7 +339,6 @@ tf_cc_binary( "//tensorflow/core/kernels:matmul_op", "//tensorflow/core/kernels:reduction_ops", "//tensorflow/core/kernels:variable_ops", - "@grpc//:grpc++", ], ) @@ -423,6 +423,7 @@ tf_cc_test( deps = [ ":grpc_tensor_coding", ":grpc_testlib", + "//tensorflow:grpc++", "//tensorflow/core:core_cpu", "//tensorflow/core:core_cpu_internal", "//tensorflow/core:framework", @@ -432,7 +433,6 @@ tf_cc_test( "//tensorflow/core:test_main", "//tensorflow/core:testlib", "//tensorflow/core:worker_proto_cc", - "@grpc//:grpc++", ], ) @@ -442,11 +442,11 @@ tf_cc_test( srcs = ["grpc_util_test.cc"], deps = [ ":grpc_util", + "//tensorflow:grpc", + "//tensorflow:grpc++", "//tensorflow/core:test", "//tensorflow/core:test_main", "//tensorflow/core:worker_proto_cc", - "@grpc", - "@grpc//:grpc++", ], ) diff --git a/tensorflow/core/distributed_runtime/rpc/eager/BUILD b/tensorflow/core/distributed_runtime/rpc/eager/BUILD index a5472159cc..6b44d8cecf 100644 --- a/tensorflow/core/distributed_runtime/rpc/eager/BUILD +++ b/tensorflow/core/distributed_runtime/rpc/eager/BUILD @@ -11,8 +11,8 @@ cc_library( srcs = ["grpc_eager_service.cc"], hdrs = ["grpc_eager_service.h"], deps = [ + "//tensorflow:grpc++", "//tensorflow/core:eager_service_proto_cc", - "@grpc//:grpc++", ], ) @@ -21,6 +21,7 @@ cc_library( srcs = ["grpc_eager_client.cc"], hdrs = ["grpc_eager_client.h"], deps = [ + "//tensorflow:grpc++", "//tensorflow/core:eager_service_proto_cc", "//tensorflow/core:lib", "//tensorflow/core/distributed_runtime/eager:eager_client", @@ -29,7 +30,6 @@ cc_library( "//tensorflow/core/distributed_runtime/rpc:grpc_state", "//tensorflow/core/distributed_runtime/rpc:grpc_util", "//tensorflow/core/distributed_runtime/rpc/eager:grpc_eager_service", - "@grpc//:grpc++", ], ) @@ -39,6 +39,7 @@ cc_library( hdrs = ["grpc_eager_service_impl.h"], deps = [ ":grpc_eager_service", + "//tensorflow:grpc++", "//tensorflow/core:framework", "//tensorflow/core:ptr_util", "//tensorflow/core/distributed_runtime/eager:eager_service_impl", @@ -48,7 +49,6 @@ cc_library( "//tensorflow/core/distributed_runtime/rpc:grpc_util", "//tensorflow/core/distributed_runtime/rpc:grpc_worker_cache", "//tensorflow/core/distributed_runtime/rpc:grpc_worker_service", - "@grpc//:grpc++", ], ) diff --git a/tensorflow/core/platform/default/build_config.bzl b/tensorflow/core/platform/default/build_config.bzl index a319ccbdbe..66ccd81e41 100644 --- a/tensorflow/core/platform/default/build_config.bzl +++ b/tensorflow/core/platform/default/build_config.bzl @@ -202,7 +202,10 @@ def cc_proto_library( ) if use_grpc_plugin: - cc_libs += ["//external:grpc_lib"] + cc_libs += select({ + "//tensorflow:linux_s390x": ["//external:grpc_lib_unsecure"], + "//conditions:default": ["//external:grpc_lib"], + }) if default_header: header_only_name = name diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl index 212a8bad47..09f7a9b7dd 100644 --- a/tensorflow/workspace.bzl +++ b/tensorflow/workspace.bzl @@ -794,6 +794,11 @@ def tf_workspace(path_prefix="", tf_repo_name=""): actual = "@grpc//:grpc++", ) + native.bind( + name = "grpc_lib_unsecure", + actual = "@grpc//:grpc++_unsecure", + ) + # Needed by gRPC native.bind( name = "libssl", |