From 120b5362000c6b9bd479815203a07fb26c1cc51b Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Thu, 13 Oct 2022 20:51:32 -0700 Subject: [PATCH] Rename config tsl_link_protobuf to tsl_protobuf_header_only This changes the default value to the original intent: exposing headers only is a "hack" in the build graph and should be an "opt-in". Tensorflow does that when building its shared library, but that shouldn't be the majority of the clients (hopefully). This also aligns with the default value for enabling the shared library mode in tensorflow: it's off by default (even though TensorFlow changes the default in its bazelrc!) PiperOrigin-RevId: 481050893 --- .bazelrc | 4 ++-- tensorflow/tsl/BUILD | 4 ++-- tensorflow/tsl/platform/default/build_config.bzl | 2 +- tensorflow/tsl/tsl.bzl | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.bazelrc b/.bazelrc index 1908f956f51..83dcc15bcf1 100644 --- a/.bazelrc +++ b/.bazelrc @@ -98,7 +98,7 @@ # nothing in a bazelrc will default to a monolithic build. The following line # opts in to modular op registration support by default. build --define framework_shared_object=true -build --define tsl_link_protobuf=false +build --define tsl_protobuf_header_only=true build --define=use_fast_cpp_protos=true build --define=allow_oversize_protos=true @@ -210,7 +210,7 @@ build:ios_fat --ios_multi_cpus=armv7,arm64,i386,x86_64 # By default, TensorFlow will build with a dependence on # //tensorflow:libtensorflow_framework.so. build:monolithic --define framework_shared_object=false -build:monolithic --define tsl_link_protobuf=true +build:monolithic --define tsl_protobuf_header_only=false build:monolithic --experimental_link_static_libraries_once=false # b/229868128 # Please note that MKL on MacOS or windows is still not supported. diff --git a/tensorflow/tsl/BUILD b/tensorflow/tsl/BUILD index 3e854579375..c1a33873a18 100644 --- a/tensorflow/tsl/BUILD +++ b/tensorflow/tsl/BUILD @@ -48,8 +48,8 @@ config_setting( # This should be removed after Tensorflow moves to cc_shared_library config_setting( - name = "tsl_link_protobuf", - define_values = {"tsl_link_protobuf": "true"}, + name = "tsl_protobuf_header_only", + define_values = {"tsl_protobuf_header_only": "true"}, visibility = ["//visibility:public"], ) diff --git a/tensorflow/tsl/platform/default/build_config.bzl b/tensorflow/tsl/platform/default/build_config.bzl index 7ecca9f99ad..7b2074f6fd3 100644 --- a/tensorflow/tsl/platform/default/build_config.bzl +++ b/tensorflow/tsl/platform/default/build_config.bzl @@ -807,7 +807,7 @@ def tf_protobuf_deps(): def tsl_protobuf_deps(): return if_tsl_link_protobuf([clean_dep("@com_google_protobuf//:protobuf")], [clean_dep("@com_google_protobuf//:protobuf_headers")]) -# When tsl_link_protobuf is false, we need to add the protobuf library +# When tsl_protobuf_header_only is true, we need to add the protobuf library # back into our binaries explicitly. def tsl_cc_test( name, diff --git a/tensorflow/tsl/tsl.bzl b/tensorflow/tsl/tsl.bzl index 198a31b4e5f..ad5e098f914 100644 --- a/tensorflow/tsl/tsl.bzl +++ b/tensorflow/tsl/tsl.bzl @@ -57,8 +57,8 @@ def if_google(google_value, oss_value = []): def if_tsl_link_protobuf(if_true, if_false = []): return select({ - clean_dep("//tensorflow/tsl:tsl_link_protobuf"): if_true, - "//conditions:default": if_false, + "//conditions:default": if_true, + clean_dep("//tensorflow/tsl:tsl_protobuf_header_only"): if_false, }) def if_libtpu(if_true, if_false = []): -- GitLab