1 /* Copyright 2020 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_HLO_INCLUDE_MLIR_HLO_DIALECT_MHLO_TRANSFORMS_MAP_HLO_TO_LHLO_OP_H_ 17 #define TENSORFLOW_COMPILER_MLIR_HLO_INCLUDE_MLIR_HLO_DIALECT_MHLO_TRANSFORMS_MAP_HLO_TO_LHLO_OP_H_ 18 19 #include <type_traits> 20 21 #include "mlir-hlo/Dialect/mhlo/IR/hlo_ops.h" 22 #include "mlir-hlo/Dialect/mhlo/IR/lhlo_ops.h" 23 24 namespace mlir { 25 namespace mhlo { 26 27 template <typename HloOpTy> 28 struct HloToLhloOpImpl { 29 using Type = std::false_type; 30 }; 31 template <typename HloOpTy> 32 using HloToLhloOp = typename HloToLhloOpImpl<HloOpTy>::Type; 33 34 #define MAP_HLO_TO_LHLO(OpName) \ 35 template <> \ 36 struct HloToLhloOpImpl<mhlo::OpName> { \ 37 using Type = lmhlo::OpName; \ 38 } 39 40 MAP_HLO_TO_LHLO(AbsOp); 41 MAP_HLO_TO_LHLO(AddOp); 42 MAP_HLO_TO_LHLO(AndOp); 43 MAP_HLO_TO_LHLO(Atan2Op); 44 MAP_HLO_TO_LHLO(BroadcastInDimOp); 45 MAP_HLO_TO_LHLO(CeilOp); 46 MAP_HLO_TO_LHLO(ClampOp); 47 MAP_HLO_TO_LHLO(ConstOp); 48 MAP_HLO_TO_LHLO(CompareOp); 49 MAP_HLO_TO_LHLO(ComplexOp); 50 MAP_HLO_TO_LHLO(ConvOp); 51 MAP_HLO_TO_LHLO(ConvertOp); 52 MAP_HLO_TO_LHLO(CopyOp); 53 MAP_HLO_TO_LHLO(CosOp); 54 MAP_HLO_TO_LHLO(CustomCallOp); 55 MAP_HLO_TO_LHLO(DivOp); 56 MAP_HLO_TO_LHLO(DotOp); 57 MAP_HLO_TO_LHLO(ExpOp); 58 MAP_HLO_TO_LHLO(Expm1Op); 59 MAP_HLO_TO_LHLO(FloorOp); 60 MAP_HLO_TO_LHLO(GatherOp); 61 MAP_HLO_TO_LHLO(ImagOp); 62 MAP_HLO_TO_LHLO(IotaOp); 63 MAP_HLO_TO_LHLO(IsFiniteOp); 64 MAP_HLO_TO_LHLO(LogOp); 65 MAP_HLO_TO_LHLO(LogisticOp); 66 MAP_HLO_TO_LHLO(Log1pOp); 67 MAP_HLO_TO_LHLO(MaxOp); 68 MAP_HLO_TO_LHLO(MinOp); 69 MAP_HLO_TO_LHLO(MulOp); 70 MAP_HLO_TO_LHLO(NegOp); 71 MAP_HLO_TO_LHLO(NotOp); 72 MAP_HLO_TO_LHLO(OrOp); 73 MAP_HLO_TO_LHLO(PowOp); 74 MAP_HLO_TO_LHLO(RealOp); 75 MAP_HLO_TO_LHLO(ReduceOp); 76 MAP_HLO_TO_LHLO(ReshapeOp); 77 MAP_HLO_TO_LHLO(RemOp); 78 MAP_HLO_TO_LHLO(RsqrtOp); 79 MAP_HLO_TO_LHLO(SelectOp); 80 MAP_HLO_TO_LHLO(ShiftLeftOp); 81 MAP_HLO_TO_LHLO(ShiftRightArithmeticOp); 82 MAP_HLO_TO_LHLO(ShiftRightLogicalOp); 83 MAP_HLO_TO_LHLO(SignOp); 84 MAP_HLO_TO_LHLO(SinOp); 85 MAP_HLO_TO_LHLO(SliceOp); 86 MAP_HLO_TO_LHLO(SqrtOp); 87 MAP_HLO_TO_LHLO(SubOp); 88 MAP_HLO_TO_LHLO(TanhOp); 89 MAP_HLO_TO_LHLO(TransposeOp); 90 MAP_HLO_TO_LHLO(XorOp); 91 92 #undef MAP_HLO_TO_LHLO 93 94 } // namespace mhlo 95 } // namespace mlir 96 97 #endif // TENSORFLOW_COMPILER_MLIR_HLO_INCLUDE_MLIR_HLO_DIALECT_MHLO_TRANSFORMS_MAP_HLO_TO_LHLO_OP_H_ 98