1 /* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7     http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 #include "mlir/IR/BuiltinOps.h"
17 #include "mlir/Tools/mlir-translate/Translation.h"
18 #include "tensorflow/compiler/mlir/tfrt/jit/tf_jitrt_registration.h"
19 #include "tfrt/bef_converter/bef_to_mlir_translate.h"  // from @tf_runtime
20 #include "tfrt/bef_converter/mlir_to_bef_translate.h"  // from @tf_runtime
21 #include "tfrt/init_tfrt_dialects.h"  // from @tf_runtime
22 
23 static mlir::TranslateFromMLIRRegistration mlir_to_bef_registration(
24     "mlir-to-bef", tfrt::MLIRToBEFTranslate,
__anon1b71feb90102(mlir::DialectRegistry &registry) 25     [](mlir::DialectRegistry &registry) {
26       tfrt::RegisterTFRTDialects(registry);
27       tfrt::RegisterTFRTCompiledDialects(registry);
28       tensorflow::RegisterTfJitRtDialect(registry);
29     });
30 
31 static mlir::TranslateToMLIRRegistration bef_to_mlir_registration(
__anon1b71feb90202(llvm::SourceMgr &source_mgr, mlir::MLIRContext *context) 32     "bef-to-mlir", [](llvm::SourceMgr &source_mgr, mlir::MLIRContext *context) {
33       mlir::DialectRegistry registry;
34       tensorflow::RegisterTfJitRtDialect(registry);
35       context->appendDialectRegistry(registry);
36       return tfrt::BEFToMLIRTranslate(source_mgr, context);
37     });
38