From dec7430b13213974928ae395322feabc788b1664 Mon Sep 17 00:00:00 2001 From: Kibeom Kim Date: Mon, 18 May 2020 10:38:01 -0700 Subject: [PATCH] Ensure that tf_py_test tfrt test is not enabled for open source build by introducing tfrt_enabled_internal flag. PiperOrigin-RevId: 312108475 Change-Id: Ia73668bf1e8f097441ed23dd75fb1ac2c0327e1f --- tensorflow/python/data/service/BUILD | 2 ++ tensorflow/python/eager/BUILD | 2 +- tensorflow/python/keras/layers/preprocessing/BUILD | 2 ++ tensorflow/python/kernel_tests/BUILD | 5 ++++- tensorflow/python/kernel_tests/proto/BUILD | 2 +- tensorflow/python/saved_model/BUILD | 2 ++ tensorflow/tensorflow.bzl | 11 ++++++++++- 7 files changed, 22 insertions(+), 4 deletions(-) diff --git a/tensorflow/python/data/service/BUILD b/tensorflow/python/data/service/BUILD index 19bcaa3b952..18678230205 100644 --- a/tensorflow/python/data/service/BUILD +++ b/tensorflow/python/data/service/BUILD @@ -1,4 +1,6 @@ load("//tensorflow:tensorflow.bzl", "tf_python_pybind_extension") + +# buildifier: disable=same-origin-load load("//tensorflow:tensorflow.bzl", "tf_py_test") package( diff --git a/tensorflow/python/eager/BUILD b/tensorflow/python/eager/BUILD index c08cb8cc1c3..394b929bf1b 100644 --- a/tensorflow/python/eager/BUILD +++ b/tensorflow/python/eager/BUILD @@ -1,7 +1,7 @@ -load("//tensorflow:tensorflow.bzl", "tf_py_test") load("//tensorflow:tensorflow.bzl", "cuda_py_test") # buildifier: disable=same-origin-load +load("//tensorflow:tensorflow.bzl", "tf_py_test") load("//tensorflow:tensorflow.bzl", "tf_python_pybind_extension") load("//tensorflow/python/tpu:tpu.bzl", "tpu_py_test") load( diff --git a/tensorflow/python/keras/layers/preprocessing/BUILD b/tensorflow/python/keras/layers/preprocessing/BUILD index 052a57b52f3..b580382f9d8 100644 --- a/tensorflow/python/keras/layers/preprocessing/BUILD +++ b/tensorflow/python/keras/layers/preprocessing/BUILD @@ -2,6 +2,8 @@ # Contains the Keras preprocess layers (internal TensorFlow version). load("//tensorflow:tensorflow.bzl", "tf_py_test") + +# buildifier: disable=same-origin-load load("//tensorflow:tensorflow.bzl", "cuda_py_test") load("//tensorflow/python/tpu:tpu.bzl", "tpu_py_test") load("//tensorflow/core/platform/default:distribute.bzl", "distribute_py_test") diff --git a/tensorflow/python/kernel_tests/BUILD b/tensorflow/python/kernel_tests/BUILD index 13f59b74baf..cd03da9b179 100644 --- a/tensorflow/python/kernel_tests/BUILD +++ b/tensorflow/python/kernel_tests/BUILD @@ -1,8 +1,11 @@ # Tests of TensorFlow kernels written using the Python API. -load("//tensorflow:tensorflow.bzl", "sycl_py_test", "tf_custom_op_library", "tf_py_test") +load("//tensorflow:tensorflow.bzl", "sycl_py_test", "tf_custom_op_library") load("//tensorflow:tensorflow.bzl", "cuda_py_test") +# buildifier: disable=same-origin-load +load("//tensorflow:tensorflow.bzl", "tf_py_test") + package( default_visibility = ["//tensorflow:internal"], licenses = ["notice"], # Apache 2.0 diff --git a/tensorflow/python/kernel_tests/proto/BUILD b/tensorflow/python/kernel_tests/proto/BUILD index d9643f3d125..0e935dfe8c4 100644 --- a/tensorflow/python/kernel_tests/proto/BUILD +++ b/tensorflow/python/kernel_tests/proto/BUILD @@ -1,7 +1,7 @@ # Tests of tf.io.*proto. -load("//tensorflow:tensorflow.bzl", "tf_py_test") load("//tensorflow:tensorflow.bzl", "tf_cc_shared_object") +load("//tensorflow:tensorflow.bzl", "tf_py_test") load("//tensorflow/core/platform:build_config_root.bzl", "if_static") load("//tensorflow/core/platform:build_config.bzl", "tf_additional_all_protos", "tf_proto_library") diff --git a/tensorflow/python/saved_model/BUILD b/tensorflow/python/saved_model/BUILD index 2e5db7edd27..5c30d320fb7 100644 --- a/tensorflow/python/saved_model/BUILD +++ b/tensorflow/python/saved_model/BUILD @@ -2,6 +2,8 @@ # TensorFlow SavedModel. load("//tensorflow:tensorflow.bzl", "cuda_py_test") + +# buildifier: disable=same-origin-load load("//tensorflow:tensorflow.bzl", "tf_py_test") package( diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl index d72bdf58186..70b03146f34 100644 --- a/tensorflow/tensorflow.bzl +++ b/tensorflow/tensorflow.bzl @@ -2218,6 +2218,15 @@ def tf_py_test( xla_enabled = False, grpc_enabled = False, tfrt_enabled = False, + # `tfrt_enabled` is set for some test targets, and if we enable + # TFRT tests just by that, this will enable TFRT builds for open source. + # TFRT open source is not fully integrated yet so we need a temporary + # workaround to enable TFRT only for internal builds. `tfrt_enabled_internal` + # will be set by `tensorflow.google.bzl`'s `tf_py_test` target, which is + # only applied for internal builds. + # TODO(b/156911178): Revert this temporary workaround once TFRT open source + # is fully integrated with TF. + tfrt_enabled_internal = False, **kwargs): """Create one or more python tests with extra tensorflow dependencies.""" xla_test_true_list = [] @@ -2261,7 +2270,7 @@ def tf_py_test( deps = depset(deps + xla_test_true_list), **kwargs ) - if tfrt_enabled: + if tfrt_enabled_internal: py_test( name = name + "_tfrt", size = size,