ConstantOp conversion pattern

This commit is contained in:
Yan Da
2022-05-04 15:35:43 +08:00
parent b9279d2e3b
commit 2d281cbc0a
3 changed files with 34 additions and 21 deletions

View File

@@ -11,6 +11,10 @@ include "mlir/Interfaces/InferTypeOpInterface.td" // SameOperandsAndResultType
def TT_BoolTensor : TensorOf<[I1]>;
def TT_BoolLike : AnyTypeOf<[I1, TT_BoolTensor]>;
def TT_IntegerLike : AnyTypeOf<[TT_Int, TT_IntegerTensor]>;
def TT_FloatLike : AnyTypeOf<[TT_Float, TT_FloatTensor]>;
class TTG_Op<string mnemonic, list<Trait> traits = []> :
Op<TritonGPU_Dialect, mnemonic, traits>;
@@ -38,10 +42,10 @@ def TTG_CmpIOp : TTG_Op<"cmpi"> {
let description = [{}];
let arguments = (ins Arith_CmpIPredicateAttr:$predicate,
TT_IntegerTensor:$lhs,
TT_IntegerTensor:$rhs);
TT_IntegerLike:$lhs,
TT_IntegerLike:$rhs);
let results = (outs TT_BoolTensor:$result);
let results = (outs TT_BoolLike:$result);
}
def TTG_CmpFOp : TTG_Op<"cmpf"> {
@@ -50,10 +54,10 @@ def TTG_CmpFOp : TTG_Op<"cmpf"> {
let description = [{}];
let arguments = (ins Arith_CmpFPredicateAttr:$predicate,
TT_FloatTensor:$lhs,
TT_FloatTensor:$rhs);
TT_FloatLike:$lhs,
TT_FloatLike:$rhs);
let results = (outs TT_BoolTensor:$result);
let results = (outs TT_BoolLike:$result);
}
#endif