Skip to content

Commit

Permalink
[mlir] Remove traits that require vector type support from ops in Com…
Browse files Browse the repository at this point in the history
…plex dialect.

Actually, no vector types are supported so far. We should add the traits once
the vector types are supported (e.g. ElementwiseMappable.traits).
Instead add Elementwise trait to each op.

Differential Revision: https://reviews.llvm.org/D104103
  • Loading branch information
akuegel committed Jun 14, 2021
1 parent 046922e commit 2116ead
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#define COMPLEX_OPS

include "mlir/Dialect/Complex/IR/ComplexBase.td"
include "mlir/Interfaces/VectorInterfaces.td"
include "mlir/Interfaces/SideEffectInterfaces.td"

class Complex_Op<string mnemonic, list<OpTrait> traits = []>
Expand All @@ -21,8 +20,7 @@ class Complex_Op<string mnemonic, list<OpTrait> traits = []>
// one result, all of which must be complex numbers of the same type.
class ComplexArithmeticOp<string mnemonic, list<OpTrait> traits = []> :
Complex_Op<mnemonic, traits # [NoSideEffect, SameOperandsAndResultType,
DeclareOpInterfaceMethods<VectorUnrollOpInterface>] #
ElementwiseMappable.traits> {
Elementwise]> {
let arguments = (ins Complex<AnyFloat>:$lhs, Complex<AnyFloat>:$rhs);
let results = (outs Complex<AnyFloat>:$result);
let assemblyFormat = "$lhs `,` $rhs attr-dict `:` type($result)";
Expand All @@ -33,7 +31,7 @@ class ComplexArithmeticOp<string mnemonic, list<OpTrait> traits = []> :
// floating-point element type. These operations take one operand and return
// one result; the operand must be a complex number.
class ComplexUnaryOp<string mnemonic, list<OpTrait> traits = []> :
Complex_Op<mnemonic, traits # [NoSideEffect]> {
Complex_Op<mnemonic, traits # [NoSideEffect, Elementwise]> {
let arguments = (ins Complex<AnyFloat>:$complex);
let assemblyFormat = "$complex attr-dict `:` type($complex)";
let verifier = ?;
Expand Down Expand Up @@ -131,9 +129,7 @@ def DivOp : ComplexArithmeticOp<"div"> {
//===----------------------------------------------------------------------===//

def EqualOp : Complex_Op<"eq",
[NoSideEffect, AllTypesMatch<["lhs", "rhs"]>,
DeclareOpInterfaceMethods<VectorUnrollOpInterface>] #
ElementwiseMappable.traits> {
[NoSideEffect, AllTypesMatch<["lhs", "rhs"]>, Elementwise]> {
let summary = "computes whether two complex values are equal";
let description = [{
The `eq` op takes two complex numbers and returns whether they are equal.
Expand Down Expand Up @@ -219,9 +215,7 @@ def MulOp : ComplexArithmeticOp<"mul"> {
//===----------------------------------------------------------------------===//

def NotEqualOp : Complex_Op<"neq",
[NoSideEffect, AllTypesMatch<["lhs", "rhs"]>,
DeclareOpInterfaceMethods<VectorUnrollOpInterface>] #
ElementwiseMappable.traits> {
[NoSideEffect, AllTypesMatch<["lhs", "rhs"]>, Elementwise]> {
let summary = "computes whether two complex values are not equal";
let description = [{
The `neq` op takes two complex numbers and returns whether they are not
Expand Down

0 comments on commit 2116ead

Please sign in to comment.