提交 b5709e09 编写于 作者: M Mehdi Amini 提交者: TensorFlower Gardener

Introduce a helper for registering all TF dialects (NFC)

This is part of a series of patches intended to make MLIR Dialects explictly
registered and remove the "always_link" global-constructor based registration.
The registration is mainly for tools that need to parse a "TF" MLIR input.

PiperOrigin-RevId: 328161577
Change-Id: I533930a804d2a22b76d0ef36b5970b80500542ea
上级 ac4e209f
...@@ -513,6 +513,7 @@ cc_library( ...@@ -513,6 +513,7 @@ cc_library(
"ir/tf_saved_model.cc", "ir/tf_saved_model.cc",
], ],
hdrs = [ hdrs = [
"dialect_registration.h",
"ir/tf_device.h", "ir/tf_device.h",
"ir/tf_executor.h", "ir/tf_executor.h",
"ir/tf_ops.h", "ir/tf_ops.h",
...@@ -1088,6 +1089,7 @@ cc_library( ...@@ -1088,6 +1089,7 @@ cc_library(
srcs = ["translate/translate_tf_dialect_op.cc"], srcs = ["translate/translate_tf_dialect_op.cc"],
deps = [ deps = [
":export_tf_dialect_op", ":export_tf_dialect_op",
":tensorflow",
"@llvm-project//llvm:Support", "@llvm-project//llvm:Support",
"@llvm-project//mlir:IR", "@llvm-project//mlir:IR",
"@llvm-project//mlir:Support", "@llvm-project//mlir:Support",
...@@ -1408,6 +1410,7 @@ cc_library( ...@@ -1408,6 +1410,7 @@ cc_library(
deps = [ deps = [
":convert_graphdef", ":convert_graphdef",
":mlir_roundtrip_flags", ":mlir_roundtrip_flags",
":tensorflow",
":translate_cl_options", ":translate_cl_options",
":translate_lib", ":translate_lib",
"//tensorflow/core:protos_all_cc", "//tensorflow/core:protos_all_cc",
......
/* Copyright 2020 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.
==============================================================================*/
#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_DIALECT_REGISTRATION_H_
#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_DIALECT_REGISTRATION_H_
#include "mlir/Dialect/StandardOps/IR/Ops.h" // from @llvm-project
#include "mlir/IR/Dialect.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 {
// Inserts all the TensorFlow dialects in the provided registry. This is
// intended for tools that need to register dialects before parsing .mlir files.
inline void RegisterAllTensorFlowDialects(DialectRegistry &registry) {
registry.insert<mlir::StandardOpsDialect, mlir::TF::TensorFlowDialect,
mlir::tf_device::TensorFlowDeviceDialect,
mlir::tf_executor::TensorFlowExecutorDialect,
mlir::tf_saved_model::TensorFlowSavedModelDialect>();
}
} // namespace mlir
#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_DIALECT_REGISTRATION_H_
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册