tensorflow / tensorflow

An Open Source Machine Learning Framework for Everyone
https://tensorflow.org
Apache License 2.0
186.15k stars 74.28k forks source link

When will TFRT integration be fully released? #60876

Open ychensha opened 1 year ago

ychensha commented 1 year ago
Click to expand! ### Issue Type Support ### Have you reproduced the bug with TF nightly? No ### Source source ### Tensorflow Version master, commit id 1bd12b4863759e44da4139628973f372655b14f6 ### Custom Code No ### OS Platform and Distribution Linux ### Mobile device _No response_ ### Python version _No response_ ### Bazel version 6.1.0 ### GCC/Compiler version 8.3.1 ### CUDA/cuDNN version _No response_ ### GPU model and memory _No response_ ### Current Behaviour? Firstly, the TFRT integration is disable in `.bazelrc`. Comment out TFRT deleted packages in `.bazelrc`, add deps for tensorflow serving, fix some reference in `BUILD`, blah, blah, blah...The build is still broken. ```diff diff --git a/.bazelrc b/.bazelrc index e26bf6de7f8..48edf30f4c7 100644 --- a/.bazelrc +++ b/.bazelrc @@ -694,10 +694,10 @@ build:ubsan --linkopt -fsanitize=undefined build:ubsan --linkopt -lubsan # Disable TFRT integration for now unless --config=tfrt is specified. -build --deleted_packages=tensorflow/core/tfrt/stubs,tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/ir,tensorflow/compiler/mlir/tfrt/ir/mlrt,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/mlrt,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/compiler/mlir/tfrt/transforms/mlrt,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/mlrt,tensorflow/core/tfrt/mlrt/attribute,tensorflow/core/tfrt/mlrt/kernel,tensorflow/core/tfrt/mlrt/bytecode,tensorflow/core/tfrt/mlrt/interpreter,tensorflow/compiler/mlir/tfrt/translate/mlrt,tensorflow/compiler/mlir/tfrt/translate/mlrt/testdata,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils,tensorflow/core/tfrt/utils/debug,tensorflow/core/tfrt/saved_model/python,tensorflow/core/tfrt/graph_executor/python +# build --deleted_packages=tensorflow/core/tfrt/stubs,tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/ir,tensorflow/compiler/mlir/tfrt/ir/mlrt,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/mlrt,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/compiler/mlir/tfrt/transforms/mlrt,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/mlrt,tensorflow/core/tfrt/mlrt/attribute,tensorflow/core/tfrt/mlrt/kernel,tensorflow/core/tfrt/mlrt/bytecode,tensorflow/core/tfrt/mlrt/interpreter,tensorflow/compiler/mlir/tfrt/translate/mlrt,tensorflow/compiler/mlir/tfrt/translate/mlrt/testdata,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils,tensorflow/core/tfrt/utils/debug,tensorflow/core/tfrt/saved_model/python,tensorflow/core/tfrt/graph_executor/python # TODO(b/240450920): We are in the process of migrating JitRt backend to XLA # and while we are doing this we can't keep it buildable/testable in OSS. -build:tfrt --deleted_packages=tensorflow/core/tfrt/stubs,tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/ir,tensorflow/compiler/mlir/tfrt/ir/mlrt,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/mlrt,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/compiler/mlir/tfrt/transforms/mlrt,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/mlrt,tensorflow/core/tfrt/mlrt/attribute,tensorflow/core/tfrt/mlrt/kernel,tensorflow/core/tfrt/mlrt/bytecode,tensorflow/core/tfrt/mlrt/interpreter,tensorflow/compiler/mlir/tfrt/translate/mlrt,tensorflow/compiler/mlir/tfrt/translate/mlrt/testdata,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils,tensorflow/core/tfrt/utils/debug,tensorflow/core/tfrt/saved_model/python,tensorflow/core/tfrt/graph_executor/python +# build:tfrt --deleted_packages=tensorflow/core/tfrt/stubs,tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/ir,tensorflow/compiler/mlir/tfrt/ir/mlrt,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/mlrt,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/compiler/mlir/tfrt/transforms/mlrt,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/mlrt,tensorflow/core/tfrt/mlrt/attribute,tensorflow/core/tfrt/mlrt/kernel,tensorflow/core/tfrt/mlrt/bytecode,tensorflow/core/tfrt/mlrt/interpreter,tensorflow/compiler/mlir/tfrt/translate/mlrt,tensorflow/compiler/mlir/tfrt/translate/mlrt/testdata,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils,tensorflow/core/tfrt/utils/debug,tensorflow/core/tfrt/saved_model/python,tensorflow/core/tfrt/graph_executor/python # TF Fuzztest config try-import fuzztest.bazelrc diff --git a/tensorflow/compiler/mlir/tfrt/ir/mlrt/tf_ops.td b/tensorflow/compiler/mlir/tfrt/ir/mlrt/tf_ops.td index 7268588749d..cee88fb112b 100644 --- a/tensorflow/compiler/mlir/tfrt/ir/mlrt/tf_ops.td +++ b/tensorflow/compiler/mlir/tfrt/ir/mlrt/tf_ops.td @@ -19,8 +19,8 @@ limitations under the License. include "tensorflow/compiler/mlir/tfrt/ir/mlrt/tf_mlrt_dialect.td" include "tensorflow/compiler/mlir/tfrt/ir/mlrt/mlrt_dialect.td" include "tensorflow/compiler/mlir/tensorflow/ir/tf_op_base.td" -include "third_party/tf_runtime/include/tfrt/compiler/opdefs/tfrt_op_interfaces.td" -include "third_party/tf_runtime/include/tfrt/compiler/opdefs/tfrt_traits.td" +include "external/tf_runtime/include/tfrt/compiler/opdefs/tfrt_op_interfaces.td" +include "external/tf_runtime/include/tfrt/compiler/opdefs/tfrt_traits.td" // tf_mlrt.tf_await returns a tensorflow Tensor. It is a fake op that is only // used during parallelization and has no runtime implementation. diff --git a/tensorflow/compiler/mlir/tfrt/transforms/mlrt/BUILD b/tensorflow/compiler/mlir/tfrt/transforms/mlrt/BUILD index beb50129756..ec69705437e 100644 --- a/tensorflow/compiler/mlir/tfrt/transforms/mlrt/BUILD +++ b/tensorflow/compiler/mlir/tfrt/transforms/mlrt/BUILD @@ -74,7 +74,7 @@ cc_library( "//tensorflow/compiler/mlir/tfrt/ir/mlrt:tf_mlrt_tpu_ops", "//tensorflow/core/tfrt/fallback:fallback_state", "//tensorflow/core/tfrt/fallback:op_kernel_runner_cache", - "//third_party/protobuf", + "@com_google_protobuf//:protobuf", "@llvm-project//mlir:FuncDialect", "@llvm-project//mlir:FuncTransforms", "@llvm-project//mlir:IR", @@ -150,7 +150,7 @@ cc_library( ":assign_op_key", ":passes", ":while_to_map_fn", - "//base:vlog", + # "//base:vlog", "//tensorflow/compiler/mlir/tensorflow:dump_mlir_util", "//tensorflow/compiler/mlir/tensorflow:error_util", "//tensorflow/compiler/mlir/tfrt:import_model", diff --git a/tensorflow/core/tfrt/graph_executor/BUILD b/tensorflow/core/tfrt/graph_executor/BUILD index 7cef54cdb69..7e4537869c1 100644 --- a/tensorflow/core/tfrt/graph_executor/BUILD +++ b/tensorflow/core/tfrt/graph_executor/BUILD @@ -152,7 +152,7 @@ cc_library( visibility = ["//visibility:public"], deps = [ ":config_proto_cc", - "//google/protobuf:any_cc_proto", + # "//google/protobuf:any_cc_proto", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", ], @@ -161,7 +161,7 @@ cc_library( tf_proto_library( name = "config_proto", srcs = ["config.proto"], - protodeps = ["//google/protobuf:any"], + # protodeps = ["//google/protobuf:any"], visibility = ["//visibility:public"], ) @@ -187,7 +187,7 @@ cc_library( hdrs = ["sync_resource_state.h"], visibility = ["//visibility:public"], deps = [ - "//tensorflow_serving/util:any_ptr", + "@tensorflow_serving//tensorflow_serving/util:any_ptr", "@tf_runtime//:tensor", ], ) diff --git a/tensorflow/core/tfrt/graph_executor/sync_resource_state.h b/tensorflow/core/tfrt/graph_executor/sync_resource_state.h index 1571fc01352..159f1714a71 100644 --- a/tensorflow/core/tfrt/graph_executor/sync_resource_state.h +++ b/tensorflow/core/tfrt/graph_executor/sync_resource_state.h @@ -18,7 +18,7 @@ limitations under the License. #include #include -#include "third_party/tensorflow_serving/util/any_ptr.h" +#include "tensorflow_serving/tensorflow_serving/util/any_ptr.h" #include "tfrt/tensor/dense_host_tensor.h" // from @tf_runtime namespace tensorflow { namespace tfrt_stub { diff --git a/tensorflow/workspace3.bzl b/tensorflow/workspace3.bzl index 91871db22c8..c16b5d0ab9b 100644 --- a/tensorflow/workspace3.bzl +++ b/tensorflow/workspace3.bzl @@ -2,6 +2,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("//third_party:tf_runtime/workspace.bzl", tf_runtime = "repo") +load("//third_party:tensorflow_serving/workspace.bzl", tensorflow_serving = "repo") load("//third_party/llvm:workspace.bzl", llvm = "repo") def workspace(): @@ -16,6 +17,7 @@ def workspace(): ) tf_runtime() + tensorflow_serving() # https://github.com/bazelbuild/bazel-skylib/releases http_archive( diff --git a/third_party/tensorflow_serving/workspace.bzl b/third_party/tensorflow_serving/workspace.bzl new file mode 100644 index 00000000000..5e5f54b6f1a --- /dev/null +++ b/third_party/tensorflow_serving/workspace.bzl @@ -0,0 +1,20 @@ +"""Provides the repository macro to import TFRT.""" + +load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls") + +def repo(): + TFRT_COMMIT = "bd203faa888dd5ce90f21e3ee9af92dbc90b8a25" + TFRT_SHA256 = "" + + tf_http_archive( + name = "tensorflow_serving", + sha256 = TFRT_SHA256, + strip_prefix = "serving-{commit}".format(commit = TFRT_COMMIT), + urls = tf_mirror_urls("https://github.com/tensorflow/serving/archive/{commit}.tar.gz".format(commit = TFRT_COMMIT)), + # A patch file can be provided for atomic commits to both TF and TFRT. + # The job that bumps the TFRT_COMMIT also resets patch_file to 'None'. + patch_file = None, + ) ``` ### Standalone code to reproduce the issue ```shell bazel build --incompatible_fix_package_group_reporoot_syntax=false tensorflow/core/tfrt/graph_executor:graph_executor ``` ### Relevant log output ```shell external/tf_runtime/lib/basic_kernels/opdefs/tfrt_base.cc:80:9: required from here bazel-out/k8-opt/bin/external/llvm-project/mlir/_virtual_includes/CallOpInterfacesIncGen/mlir/Interfaces/CallInterfaces.h.inc:155:56: error: 'class tfrt::compiler::CallOp' has no member named 'setCalleeFromCallable'; did you mean 'getCallableForCallee'? return (llvm::cast(tablegen_opaque_val)).setCalleeFromCallable(callee); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ getCallableForCallee bazel-out/k8-opt/bin/external/llvm-project/mlir/_virtual_includes/CallOpInterfacesIncGen/mlir/Interfaces/CallInterfaces.h.inc:155:84: error: return-statement with a value, in function returning 'void' [-fpermissive] return (llvm::cast(tablegen_opaque_val)).setCalleeFromCallable(callee); ^ cc1plus: warning: unrecognized command line option '-Wno-unused-local-typedef' Target //tensorflow/core/tfrt/graph_executor:graph_executor failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 72.836s, Critical Path: 33.33s INFO: 247 processes: 21 internal, 226 local. FAILED: Build did NOT complete successfully ```
sachinprasadhs commented 1 year ago

@bchetioui , Could you please take a look into this, it is related to your commit https://github.com/tensorflow/tensorflow/commit/1bd12b4863759e44da4139628973f372655b14f6

bchetioui commented 1 year ago

@sachinprasadhs @ychensha Hi, just to confirm, did you narrow down the failure to my commit? It is a very small change which doesn't add/remove any dependency to any file, and has nothing to do with TFRT---I'd be surprised if it had anything to do with the failure reported here.

sachinprasadhs commented 1 year ago

Understood, Thank you!