Skip to content

Commit 63ad705

Browse files
Manjunath Kudlurtensorflower-gardener
Manjunath Kudlur
authored andcommitted
Replace dependency on entire proto library with just the headers for contrib.
- Linking a version of the entire proto library with every .so is wasteful. - Causes duplicate destruction of the static initialized objects causing non-deterministic crashes. Change: 147220106
1 parent 83c857f commit 63ad705

File tree

10 files changed

+42
-13
lines changed

10 files changed

+42
-13
lines changed

BUILD

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Description:
2+
# TensorFlow is an open source software library for numerical computation using
3+
# data flow graphs.
4+
5+
package(
6+
default_visibility = [
7+
"//tensorflow:internal",
8+
"//tensorflow_models:__subpackages__",
9+
],
10+
)
11+
12+
licenses(["notice"]) # Apache 2.0
13+
14+
exports_files(["LICENSE"])
15+
16+
load(
17+
"//tensorflow:tensorflow.bzl",
18+
"cc_header_only_library",
19+
)
20+
21+
cc_header_only_library(
22+
name = "protobuf_headers",
23+
includes = ["external/protobuf/src"],
24+
visibility = ["//visibility:public"],
25+
deps = [
26+
"@protobuf//:protobuf",
27+
],
28+
)

tensorflow/contrib/factorization/kernels/BUILD

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ cc_library(
1414
":clustering_ops",
1515
":masked_matmul_ops",
1616
":wals_solver_ops",
17-
"@protobuf//:protobuf",
17+
"//:protobuf_headers",
1818
],
1919
)
2020

2121
cc_library(
2222
name = "wals_solver_ops",
2323
srcs = ["wals_solver_ops.cc"],
2424
deps = [
25+
"//:protobuf_headers",
2526
"//tensorflow/core:framework_headers_lib",
2627
"//third_party/eigen3",
27-
"@protobuf//:protobuf",
2828
],
2929
alwayslink = 1,
3030
)
@@ -33,9 +33,9 @@ cc_library(
3333
name = "clustering_ops",
3434
srcs = ["clustering_ops.cc"],
3535
deps = [
36+
"//:protobuf_headers",
3637
"//tensorflow/core:framework_headers_lib",
3738
"//third_party/eigen3",
38-
"@protobuf//:protobuf",
3939
],
4040
alwayslink = 1,
4141
)
@@ -44,9 +44,9 @@ cc_library(
4444
name = "masked_matmul_ops",
4545
srcs = ["masked_matmul_ops.cc"],
4646
deps = [
47+
"//:protobuf_headers",
4748
"//tensorflow/core:framework_headers_lib",
4849
"//third_party/eigen3",
49-
"@protobuf//:protobuf",
5050
],
5151
alwayslink = 1,
5252
)

tensorflow/contrib/ffmpeg/default/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ cc_library(
1616
"//tensorflow/contrib/ffmpeg:ffmpeg_lib.h",
1717
],
1818
deps = [
19+
"//:protobuf_headers",
1920
"//tensorflow/core:framework_headers_lib",
20-
"@protobuf//:protobuf",
2121
],
2222
)
2323

tensorflow/contrib/input_pipeline/kernels/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ cc_library(
1111
name = "input_pipeline_kernels",
1212
srcs = ["input_pipeline_kernels.cc"],
1313
deps = [
14+
"//:protobuf_headers",
1415
"//tensorflow/core:framework_headers_lib",
1516
"//third_party/eigen3",
16-
"@protobuf//:protobuf",
1717
],
1818
alwayslink = 1,
1919
)

tensorflow/contrib/layers/kernels/BUILD

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ cc_library(
1111
name = "bucketization_kernel",
1212
srcs = ["bucketization_kernel.cc"],
1313
deps = [
14+
"//:protobuf_headers",
1415
"//tensorflow/core:framework_headers_lib",
1516
"//third_party/eigen3",
16-
"@protobuf//:protobuf",
1717
],
1818
alwayslink = 1,
1919
)
@@ -22,10 +22,10 @@ cc_library(
2222
name = "sparse_feature_cross_kernel",
2323
srcs = ["sparse_feature_cross_kernel.cc"],
2424
deps = [
25+
"//:protobuf_headers",
2526
"//tensorflow/core:framework_headers_lib",
2627
"//third_party/eigen3",
2728
"@farmhash_archive//:farmhash",
28-
"@protobuf//:protobuf",
2929
],
3030
alwayslink = 1,
3131
)

tensorflow/contrib/tensor_forest/BUILD

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ cc_library(
5050
srcs = [":custom_op_sources"],
5151
hdrs = [":custom_op_headers"],
5252
deps = [
53+
"//:protobuf_headers",
5354
"//tensorflow/core:framework_headers_lib",
5455
"//third_party/eigen3",
55-
"@protobuf//:protobuf",
5656
],
5757
alwayslink = 1,
5858
)
@@ -191,9 +191,9 @@ cc_library(
191191
"kernels/tree_utils.h",
192192
],
193193
deps = [
194+
"//:protobuf_headers",
194195
"//tensorflow/core:framework_headers_lib",
195196
"//third_party/eigen3",
196-
"@protobuf//:protobuf",
197197
],
198198
)
199199

tensorflow/contrib/tensor_forest/hybrid/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ cc_library(
6666
"core/ops/utils.h",
6767
],
6868
deps = [
69+
"//:protobuf_headers",
6970
"//tensorflow/core:framework_headers_lib",
7071
"//third_party/eigen3",
71-
"@protobuf//:protobuf",
7272
],
7373
)
7474

tensorflow/python/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ cc_binary(
253253
}),
254254
linkshared = 1,
255255
deps = [
256+
"//:protobuf_headers",
256257
"//tensorflow/core:framework_headers_lib",
257-
"@protobuf//:protobuf",
258258
],
259259
)
260260

tensorflow/tensorflow.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ def cc_header_only_library(name, deps=[], **kwargs):
671671

672672
def tf_custom_op_library_additional_deps():
673673
return [
674-
"@protobuf//:protobuf",
674+
"//:protobuf_headers",
675675
"//third_party/eigen3",
676676
"//tensorflow/core:framework_headers_lib",
677677
]

tensorflow/tools/pip_package/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ py_binary(
7777
filegroup(
7878
name = "licenses",
7979
data = [
80+
"//:LICENSE",
8081
"//third_party/eigen3:LICENSE",
8182
"//third_party/hadoop:LICENSE.txt",
8283
"@boringssl//:LICENSE",

0 commit comments

Comments
 (0)