• 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_ATTRIBUTE_IMPORTER_H_
17 #define TENSORFLOW_COMPILER_MLIR_XLA_ATTRIBUTE_IMPORTER_H_
18 
19 #include "mlir/IR/Attributes.h"  // from @llvm-project
20 #include "mlir/IR/Builders.h"  // from @llvm-project
21 #include "tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.h"
22 #include "tensorflow/compiler/xla/statusor.h"
23 #include "tensorflow/compiler/xla/xla_data.pb.h"
24 #include "tensorflow/core/platform/types.h"
25 
26 namespace xla {
27 
28 // Converts an XLA PrecisionConfig to the corresponding MLIR attribute.
29 mlir::ArrayAttr ConvertPrecisionConfig(const PrecisionConfig* config,
30                                        mlir::Builder* builder);
31 
32 // Converts the gather dimensions to attributes.
33 mlir::mhlo::GatherDimensionNumbers ConvertGatherDimensionNumbers(
34     const xla::GatherDimensionNumbers& dnums, mlir::Builder* builder);
35 
36 // Converts the scatter dimensions to attributes.
37 mlir::mhlo::ScatterDimensionNumbers ConvertScatterDimensionNumbers(
38     const xla::ScatterDimensionNumbers& dnums, mlir::Builder* builder);
39 
40 // Converts the dot dimensions to attributes.
41 mlir::mhlo::DotDimensionNumbers ConvertDotDimensionNumbers(
42     const DotDimensionNumbers& dnums, mlir::Builder* builder);
43 
44 // Converts the conv dimensions to attributes.
45 mlir::mhlo::ConvDimensionNumbers ConvertConvDimensionNumbers(
46     const xla::ConvolutionDimensionNumbers& dnums, mlir::Builder* builder);
47 
48 StatusOr<mlir::mhlo::FftType> ConvertFftType(FftType type);
49 StatusOr<mlir::mhlo::Transpose> ConvertTranspose(
50     TriangularSolveOptions_Transpose transpose);
51 
52 }  // namespace xla
53 
54 #endif  // TENSORFLOW_COMPILER_MLIR_XLA_ATTRIBUTE_IMPORTER_H_
55