From e4c6f288d4983bbe541afc656ac74b924b4550df Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 22 Apr 2020 09:04:41 -0700 Subject: [PATCH] [XLA][MLIR] Add complex unary elementwise op definitions to LHLO dialect. PiperOrigin-RevId: 307828261 Change-Id: I62c10002cd79209449a2c7b00122b59df829678a --- tensorflow/compiler/mlir/xla/ir/lhlo_ops.td | 25 +++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/tensorflow/compiler/mlir/xla/ir/lhlo_ops.td b/tensorflow/compiler/mlir/xla/ir/lhlo_ops.td index 7613f1e0ffc..f0c84dbc862 100644 --- a/tensorflow/compiler/mlir/xla/ir/lhlo_ops.td +++ b/tensorflow/compiler/mlir/xla/ir/lhlo_ops.td @@ -37,13 +37,12 @@ def LHLO_IntBuffer : MemRefOf<[HLO_Int]>; // Any floating-point tensor types def LHLO_FpBuffer : MemRefOf<[AnyFloat]>; - def LHLO_PredBuffer : MemRefOf<[HLO_Pred]>; // Any integer or floating-point tensor types def LHLO_IntOrFpBuffer : MemRefOf<[HLO_Int, AnyFloat]>; -def LHLO_Buffer : MemRefOf<[AnyFloat, AnySignlessInteger]>; +def LHLO_Buffer : MemRefOf<[AnyFloat, AnySignlessInteger, AnyComplex]>; def LHLO_TupleBuffer : NestedTupleOf<[LHLO_Buffer]>; @@ -105,9 +104,31 @@ def LHLO_SignOp: LHLO_UnaryElementwiseOp<"sign">, BASE_HLO_SignOp; def LHLO_TanhOp: LHLO_UnaryElementwiseOp<"tanh">, BASE_HLO_TanhOp; +//===----------------------------------------------------------------------===// +// XLA complex unary elementwise op definitions. +//===----------------------------------------------------------------------===// +// See https://www.tensorflow.org/xla/operation_semantics#element-wise_unary_functions + +def LHLO_ComplexOp: LHLO_Op<"complex", [SameOperandsShape]>, BASE_HLO_ComplexOp { + let arguments = (ins Arg:$lhs, + Arg:$rhs, + Arg:$output); +} + +def LHLO_ImagOp: LHLO_Op<"imag", [SameOperandsShape]>, BASE_HLO_ImagOp { + let arguments = (ins Arg:$input, + Arg:$output); +} + +def LHLO_RealOp: LHLO_Op<"real", [SameOperandsShape]>, BASE_HLO_RealOp { + let arguments = (ins Arg:$input, + Arg:$output); +} + //===----------------------------------------------------------------------===// // XLA binary elementwise op definitions. //===----------------------------------------------------------------------===// +// See https://www.tensorflow.org/xla/operation_semantics#element-wise_binary_arithmetic_operations class LHLO_BinaryElementwiseOp traits> : LHLO_Op {