Move automatic pass registration to mlir-auto-init.cpp.

PiperOrigin-RevId: 300706581
Change-Id: Iebd5dfc04de5177220b97f6bdada90e7c26a33f8
This commit is contained in:
Adrian Kuegel 2020-03-13 00:43:09 -07:00 committed by TensorFlower Gardener
parent 8d0fd52cd4
commit 5d1b37c014
6 changed files with 21 additions and 11 deletions

View File

@ -517,6 +517,7 @@ cc_library(
"@com_google_absl//absl/strings",
"@flatbuffers",
"@llvm-project//llvm:support",
"@llvm-project//mlir:AllPassesAndDialects",
"@llvm-project//mlir:IR",
"@llvm-project//mlir:TransformUtils",
],
@ -703,6 +704,7 @@ cc_library(
"//tensorflow/compiler/mlir/tensorflow:tensorflow_passes",
"//tensorflow/compiler/mlir/tensorflow:tf_graph_optimization_pass",
"//tensorflow/compiler/mlir/tensorflow:translate_lib",
"@llvm-project//mlir:AllPassesAndDialects",
"@llvm-project//mlir:Analysis",
"@llvm-project//mlir:IR",
"@llvm-project//mlir:Pass",
@ -736,6 +738,7 @@ cc_library(
"//tensorflow/lite/tools/optimize:quantize_weights",
"//tensorflow/stream_executor/lib",
"@llvm-project//llvm:support",
"@llvm-project//mlir:AllPassesAndDialects",
"@llvm-project//mlir:IR",
"@llvm-project//mlir:Parser",
"@llvm-project//mlir:Pass",

View File

@ -445,7 +445,6 @@ cc_library(
srcs = ["ir/dialect_registration.cc"],
deps = [
":tensorflow",
"@llvm-project//mlir:AllPassesAndDialectsNoRegistration",
"@llvm-project//mlir:IR",
"@llvm-project//mlir:LoopOpsTransforms",
],
@ -815,6 +814,7 @@ cc_library(
deps = [
":tensorflow_dialect_registration",
":tf_dialect_passes",
"@llvm-project//mlir:AllPassesAndDialects",
],
)
@ -1020,6 +1020,7 @@ cc_library(
"//tensorflow/core/platform:logging",
"//tensorflow/stream_executor/lib",
"@llvm-project//llvm:support",
"@llvm-project//mlir:AllPassesAndDialects",
"@llvm-project//mlir:IR",
"@llvm-project//mlir:Parser",
"@llvm-project//mlir:Pass",

View File

@ -13,8 +13,6 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "mlir/InitAllDialects.h" // TF:llvm-project
#include "mlir/InitAllPasses.h" // TF:llvm-project
#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"
@ -23,13 +21,6 @@ limitations under the License.
namespace mlir {
static bool auto_init = []() {
registerAllDialects();
registerAllPasses();
return true;
}();
// Static initialization for TF dialect registration.
static DialectRegistration<TFControlFlow::TFControlFlowDialect>
tf_control_flow_ops;

View File

@ -67,13 +67,13 @@ cc_library(
":lhlo_dialect_emitter",
"@com_google_absl//absl/container:flat_hash_map",
"@llvm-project//mlir:GPUDialect",
"@llvm-project//mlir:AllPassesAndDialects",
"@llvm-project//mlir:IR",
"@llvm-project//mlir:LLVMDialect",
"@llvm-project//mlir:LLVMTransforms",
"@llvm-project//mlir:StandardOps",
"@llvm-project//mlir:Support",
"@llvm-project//mlir:TargetNVVMIR",
"//tensorflow/compiler/mlir/tensorflow:tensorflow_dialect_registration",
"//tensorflow/compiler/xla:util",
"//tensorflow/compiler/xla/service:buffer_assignment",
"//tensorflow/compiler/xla/service:compiler",

View File

@ -1913,6 +1913,7 @@ cc_library(
cc_library(
name = "AllPassesAndDialects",
srcs = ["@org_tensorflow//third_party/mlir:mlir-auto-init.cpp"],
deps = [
":AllPassesAndDialectsNoRegistration",
],

14
third_party/mlir/mlir-auto-init.cpp vendored Normal file
View File

@ -0,0 +1,14 @@
#include "mlir/InitAllDialects.h"
#include "mlir/InitAllPasses.h"
namespace mlir {
// This target is a convenient dependency for users to auto-initialize MLIR
// internals.
static bool auto_init = []() {
registerAllDialects();
registerAllPasses();
return true;
}();
} // namespace mlir