• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2019 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 #ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_BRIDGE_H_
17 #define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_BRIDGE_H_
18 
19 #include "mlir/IR/BuiltinOps.h"  // from @llvm-project
20 #include "tensorflow/core/lib/core/status.h"
21 
22 namespace mlir {
23 namespace TFTPU {
24 
25 // Run all the passes involved in transforming the graph before execution so
26 // that it is suitable for targeting TPUs. When enable_logging is true, enables
27 // tensorflow::BridgeLogger.
28 tensorflow::Status TPUBridge(ModuleOp module, bool enable_logging);
29 
30 // Run all the passes involved in transforming the graph before execution so
31 // that it is suitable for targeting TPUs. When enable_logging is true, enables
32 // tensorflow::BridgeLogger.
33 // This variant of `TPUBridge` is intended for TensorFlow V1 compatibility.
34 tensorflow::Status TPUBridgeV1Compat(ModuleOp module, bool enable_logging);
35 
36 }  // namespace TFTPU
37 
38 namespace TF {
39 
40 // Runs all passes involved in transforming or optimizing an MLIR graph without
41 // any target specialization. When enable_logging is true, enables
42 // tensorflow::BridgeLogger. When enable_inliner is true, enables the inliner
43 // pass.
44 tensorflow::Status RunBridgeWithStandardPipeline(ModuleOp module,
45                                                  bool enable_logging,
46                                                  bool enable_inliner);
47 
48 }  // namespace TF
49 
50 }  // namespace mlir
51 
52 #endif  // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_BRIDGE_H_
53