Fix tensorflow test crashes.
There was missing dialect registration for some of the tests. To avoid duplicate registration failures, also requires moving back to the dialect registration target in tensorflow's version of dialect registration. We only moved off that target because it also registered all core dialects as well, which prevented us from registering the subset we care about. https://github.com/tensorflow/tensorflow/commit/5d1b37c0142f73d6eea32ba4d811aa713af6a006 separated out the core dialect registration, so we can go back to using their target.
Based off of https://github.com/google/iree/pull/1089
There are still some test failures that will require further investigation:
`//integrations/tensorflow/e2e:control_flow_test`
`//integrations/tensorflow/e2e:mandelbrot_test`
`//integrations/tensorflow/e2e:ring_buffer_test`
But those failures were pre-existing.
Tested:
Ran the TF integration CI tests locally
`bazel query '//... except attr("tags", "noga", //...)' | xargs bazel test --test_env=IREE_VULKAN_DISABLE=1 --test_env=IREE_DEFAULT_BACKENDS="tf,iree_vmla" --define=iree_tensorflow=true --test_output=errors --keep_going`
Upstream tests pass.
Work towards #1000
Co-authored-by: Stella Laurenzo <laurenzo@google.com>
PiperOrigin-RevId: 301234545
diff --git a/integrations/tensorflow/bindings/python/pyiree/tf/compiler/BUILD b/integrations/tensorflow/bindings/python/pyiree/tf/compiler/BUILD
index 0dc7d0d..62b8c00 100644
--- a/integrations/tensorflow/bindings/python/pyiree/tf/compiler/BUILD
+++ b/integrations/tensorflow/bindings/python/pyiree/tf/compiler/BUILD
@@ -36,6 +36,7 @@
]
TF_XLA_PASS_DEPS = [
+ "@org_tensorflow//tensorflow/compiler/mlir/tensorflow:tensorflow_dialect_registration",
"//integrations/tensorflow/compiler:tensorflow",
"@org_tensorflow//tensorflow/compiler/mlir/xla:xla_legalize_tf",
]
diff --git a/integrations/tensorflow/compiler/BUILD b/integrations/tensorflow/compiler/BUILD
index 46fa927..f0c3169 100644
--- a/integrations/tensorflow/compiler/BUILD
+++ b/integrations/tensorflow/compiler/BUILD
@@ -48,19 +48,12 @@
alwayslink = 1,
)
-cc_library(
- name = "dialect_registration",
- srcs = ["DialectRegistration.cpp"],
- deps = ["@org_tensorflow//tensorflow/compiler/mlir/tensorflow"],
- alwayslink = 1,
-)
-
cc_binary(
name = "iree-tf-opt",
deps = [
- ":dialect_registration",
":tensorflow",
"//iree/tools:iree_opt_main",
+ "@org_tensorflow//tensorflow/compiler/mlir/tensorflow:tensorflow_dialect_registration",
"@org_tensorflow//tensorflow/compiler/mlir/tensorflow:tensorflow_passes",
"@org_tensorflow//tensorflow/compiler/mlir/xla:xla_legalize_tf",
],
diff --git a/integrations/tensorflow/compiler/DialectRegistration.cpp b/integrations/tensorflow/compiler/DialectRegistration.cpp
deleted file mode 100644
index 38b927e..0000000
--- a/integrations/tensorflow/compiler/DialectRegistration.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2020 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "tensorflow/compiler/mlir/tensorflow/ir/control_flow_ops.h"
-#include "tensorflow/compiler/mlir/tensorflow/ir/tf_device.h"
-#include "tensorflow/compiler/mlir/tensorflow/ir/tf_executor.h"
-#include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h"
-#include "tensorflow/compiler/mlir/tensorflow/ir/tf_saved_model.h"
-
-namespace mlir {
-
-// Static initialization for TF dialect registration.
-static DialectRegistration<TFControlFlow::TFControlFlowDialect>
- tf_control_flow_ops;
-static DialectRegistration<TF::TensorFlowDialect> tf_ops;
-static DialectRegistration<tf_executor::TensorFlowExecutorDialect>
- tf_executor_dialect;
-static DialectRegistration<tf_device::TensorFlowDeviceDialect>
- tf_device_dialect;
-static DialectRegistration<tf_saved_model::TensorFlowSavedModelDialect>
- tf_saved_model_dialect;
-
-} // namespace mlir