• 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_XLA_XLA_MLIR_TRANSLATE_H_
17 #define TENSORFLOW_COMPILER_MLIR_XLA_XLA_MLIR_TRANSLATE_H_
18 
19 #include <memory>
20 
21 #include "tensorflow/compiler/xla/statusor.h"
22 
23 namespace llvm {
24 class StringRef;
25 }  // namespace llvm
26 
27 namespace mlir {
28 class MLIRContext;
29 class OwningModuleRef;
30 }  // namespace mlir
31 
32 namespace xla {
33 
34 // Converts a HloModuleProto stored in the file with the given `input_filename`
35 // into a MLIR module. Creates MLIR entities into the given MLIR `context`.
36 // If import_all_computation is set to true, imports all computations
37 // irrespective if transitively called from entry computation.
38 mlir::OwningModuleRef HloToMlirHloTranslateFunction(
39     llvm::StringRef input, mlir::MLIRContext* context,
40     bool import_all_computations = false);
41 
42 // Converts a HloModule stored in text form for a file with the given
43 // `input_filename` into a MLIR module. Creates MLIR entities into the given
44 // MLIR `context`.
45 // If import_all_computation is set to true, imports all computations
46 // irrespective if transitively called from entry computation.
47 mlir::OwningModuleRef HloTextToMlirHloTranslateFunction(
48     llvm::StringRef input, mlir::MLIRContext* context,
49     bool import_all_computations = false);
50 
51 }  // namespace xla
52 
53 #endif  // TENSORFLOW_COMPILER_MLIR_XLA_XLA_MLIR_TRANSLATE_H_
54