Cleanup: remove remaining uses of Dialect registration from TensorFlow (NFC)
PiperOrigin-RevId: 330612300 Change-Id: I75abfceec5bbedc5a1c4404a4fbf43467bbe45a6
This commit is contained in:
parent
ad125235fa
commit
dfd9dedc17
@ -99,7 +99,6 @@ cc_library(
|
||||
"//tensorflow/compiler/mlir/lite/quantization:quantization_passes",
|
||||
"//tensorflow/compiler/mlir/lite/quantization/tensorflow:tf_to_quant",
|
||||
"//tensorflow/compiler/mlir/tensorflow",
|
||||
"//tensorflow/compiler/mlir/tensorflow:tensorflow_dialect_registration",
|
||||
"//tensorflow/compiler/mlir/tensorflow:tensorflow_passes",
|
||||
"//tensorflow/compiler/mlir/tensorflow:tensorflow_test_passes",
|
||||
"//tensorflow/compiler/mlir/tensorflow:tf_dialect_passes",
|
||||
@ -168,7 +167,6 @@ tf_cc_binary(
|
||||
":init_mlir",
|
||||
"//tensorflow/compiler/mlir/tensorflow:convert_graphdef",
|
||||
"//tensorflow/compiler/mlir/tensorflow:mlir_roundtrip_flags",
|
||||
"//tensorflow/compiler/mlir/tensorflow:tensorflow_dialect_registration",
|
||||
"//tensorflow/compiler/mlir/tensorflow:tf_xla_mlir_translate",
|
||||
"//tensorflow/compiler/mlir/tensorflow:translate_cl_options",
|
||||
"//tensorflow/compiler/mlir/tensorflow:translate_lib",
|
||||
@ -182,7 +180,7 @@ tf_cc_binary(
|
||||
"//tensorflow/stream_executor/lib",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@llvm-project//llvm:Support",
|
||||
"@llvm-project//mlir:AllPassesAndDialects",
|
||||
"@llvm-project//mlir:AllPassesAndDialectsNoRegistration",
|
||||
"@llvm-project//mlir:IR",
|
||||
"@llvm-project//mlir:Support",
|
||||
"@llvm-project//mlir:Translation",
|
||||
|
@ -642,7 +642,6 @@ cc_library(
|
||||
"//tensorflow/compiler/mlir/tensorflow",
|
||||
"//tensorflow/compiler/mlir/tensorflow:convert_tensor",
|
||||
"//tensorflow/compiler/mlir/tensorflow:export_tf_dialect_op",
|
||||
"//tensorflow/compiler/mlir/tensorflow:tensorflow_dialect_registration",
|
||||
"//tensorflow/compiler/mlir/tensorflow:tensorflow_types",
|
||||
"//tensorflow/compiler/xla:statusor",
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
@ -875,7 +874,6 @@ cc_library(
|
||||
"//tensorflow/compiler/mlir/lite/quantization:quantization_passes",
|
||||
"//tensorflow/compiler/mlir/tensorflow",
|
||||
"//tensorflow/compiler/mlir/tensorflow:decode_constant_pass",
|
||||
"//tensorflow/compiler/mlir/tensorflow:tensorflow_dialect_registration",
|
||||
"//tensorflow/compiler/mlir/tensorflow:tensorflow_passes",
|
||||
"//tensorflow/compiler/mlir/tensorflow:tf_graph_optimization_pass",
|
||||
"//tensorflow/compiler/mlir/tensorflow:tf_saved_model_passes",
|
||||
|
@ -925,14 +925,13 @@ cc_library(
|
||||
)
|
||||
|
||||
# Library with TensorFlow dialect static initialization.
|
||||
# TODO(aminim): OBSOLETE ; remove all users and delete this.
|
||||
cc_library(
|
||||
name = "tensorflow_dialect_registration",
|
||||
srcs = ["ir/dialect_registration.cc"],
|
||||
deps = [
|
||||
":tensorflow",
|
||||
"@llvm-project//mlir:Shape",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
||||
cc_library(
|
||||
@ -1310,9 +1309,8 @@ cc_library(
|
||||
cc_library(
|
||||
name = "tf_dialect_lib",
|
||||
deps = [
|
||||
":tensorflow_dialect_registration",
|
||||
":tf_dialect_passes",
|
||||
"@llvm-project//mlir:AllPassesAndDialects",
|
||||
"@llvm-project//mlir:AllPassesAndDialectsNoRegistration",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1506,7 +1504,6 @@ COMPILE_MLIR_UTIL_DEPS = [
|
||||
":error_util",
|
||||
":mlir_roundtrip_flags",
|
||||
":tensorflow",
|
||||
":tensorflow_dialect_registration",
|
||||
":tensorflow_types",
|
||||
":tensorflow_passes",
|
||||
":translate_utils",
|
||||
@ -1790,14 +1787,13 @@ cc_library(
|
||||
":convert_graphdef",
|
||||
":error_util",
|
||||
":tensorflow",
|
||||
":tensorflow_dialect_registration",
|
||||
":tensorflow_passes",
|
||||
"//tensorflow/core:framework",
|
||||
"//tensorflow/core:graph",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core/platform:logging",
|
||||
"@llvm-project//llvm:Support",
|
||||
"@llvm-project//mlir:AllPassesAndDialects",
|
||||
"@llvm-project//mlir:AllPassesAndDialectsNoRegistration",
|
||||
"@llvm-project//mlir:Analysis",
|
||||
"@llvm-project//mlir:IR",
|
||||
"@llvm-project//mlir:Pass",
|
||||
|
@ -1,34 +0,0 @@
|
||||
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
|
||||
|
||||
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
|
||||
|
||||
http://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 "mlir/Dialect/Shape/IR/Shape.h" // from @llvm-project
|
||||
#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<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;
|
||||
static DialectRegistration<mlir::shape::ShapeDialect> shape_dialect;
|
||||
|
||||
} // namespace mlir
|
@ -117,7 +117,6 @@ cc_library(
|
||||
":tfjs_optimize",
|
||||
"//tensorflow/compiler/mlir/tensorflow",
|
||||
"//tensorflow/compiler/mlir/tensorflow:decode_constant_pass",
|
||||
"//tensorflow/compiler/mlir/tensorflow:tensorflow_dialect_registration",
|
||||
"//tensorflow/compiler/mlir/tensorflow:tensorflow_passes",
|
||||
"//tensorflow/compiler/mlir/tensorflow:tf_graph_optimization_pass",
|
||||
"//tensorflow/compiler/mlir/tensorflow:tf_saved_model_passes",
|
||||
@ -141,7 +140,6 @@ cc_library(
|
||||
"//tensorflow/compiler/mlir/tensorflow:convert_graphdef",
|
||||
"//tensorflow/compiler/mlir/tensorflow:export_utils",
|
||||
"//tensorflow/compiler/mlir/tensorflow:mlir_roundtrip_flags",
|
||||
"//tensorflow/compiler/mlir/tensorflow:tensorflow_dialect_registration",
|
||||
"//tensorflow/compiler/xla:statusor",
|
||||
"//tensorflow/core:framework",
|
||||
"//tensorflow/core:graph",
|
||||
@ -179,7 +177,7 @@ cc_library(
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/types:span",
|
||||
"@llvm-project//llvm:Support",
|
||||
"@llvm-project//mlir:AllPassesAndDialects",
|
||||
"@llvm-project//mlir:AllPassesAndDialectsNoRegistration",
|
||||
"@llvm-project//mlir:IR",
|
||||
"@llvm-project//mlir:Parser",
|
||||
"@llvm-project//mlir:Pass",
|
||||
|
@ -90,18 +90,6 @@ Status ConvertOutputInfo(const tf2xla::Config& config,
|
||||
return ParseOutputArrayInfo(array_names, &specs->outputs);
|
||||
}
|
||||
|
||||
static void RegisterDialects() {
|
||||
static bool init_once = []() {
|
||||
mlir::registerDialect<mlir::tf_executor::TensorFlowExecutorDialect>();
|
||||
mlir::registerDialect<mlir::TF::TensorFlowDialect>();
|
||||
mlir::registerDialect<mlir::StandardOpsDialect>();
|
||||
mlir::registerDialect<mlir::mhlo::MhloDialect>();
|
||||
mlir::registerDialect<mlir::shape::ShapeDialect>();
|
||||
return true;
|
||||
}();
|
||||
(void)init_once;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Status ConvertGraphDefToXlaViaMlir(
|
||||
@ -150,9 +138,7 @@ Status ConvertGraphDefToXlaViaMlir(
|
||||
}
|
||||
}
|
||||
|
||||
RegisterDialects();
|
||||
mlir::MLIRContext context;
|
||||
context.loadAllGloballyRegisteredDialects();
|
||||
TF_ASSIGN_OR_RETURN(
|
||||
mlir::OwningModuleRef module,
|
||||
ConvertGraphdefToMlir(pruned_graph_def, debug_info, specs, &context));
|
||||
|
@ -516,7 +516,6 @@ static Status CompileModuleToLlvmIrImpl(
|
||||
DumpHloModuleIfEnabled(*hlo_module, **buffer_assignment,
|
||||
"after_optimizations");
|
||||
|
||||
mlir::registerAllDialects();
|
||||
mlir::MLIRContext mlir_context;
|
||||
|
||||
IrEmitterContext ir_emitter_context(
|
||||
|
@ -87,7 +87,7 @@ cc_library(
|
||||
"@com_google_absl//absl/container:flat_hash_map",
|
||||
"@llvm-project//llvm:Core",
|
||||
"@llvm-project//mlir:GPUDialect",
|
||||
"@llvm-project//mlir:AllPassesAndDialects",
|
||||
"@llvm-project//mlir:AllPassesAndDialectsNoRegistration",
|
||||
"@llvm-project//mlir:IR",
|
||||
"@llvm-project//mlir:LLVMDialect",
|
||||
"@llvm-project//mlir:LLVMTransforms",
|
||||
|
Loading…
Reference in New Issue
Block a user