13 #ifndef MLIR_DIALECT_TOSA_IR_TOSAOPS_H
14 #define MLIR_DIALECT_TOSA_IR_TOSAOPS_H
30 #include "mlir/Dialect/Tosa/IR/TosaOpsDialect.h.inc"
33 class PatternRewriter;
42 #include "mlir/Dialect/Tosa/IR/TosaInterfaces.h.inc"
51 template <
typename ConcreteType>
53 :
public TraitBase<ConcreteType, MulOperandsAndResultElementType> {
60 if (llvm::isa<FloatType>(resElemType))
63 if (
auto resIntType = dyn_cast<IntegerType>(resElemType)) {
64 IntegerType lhsIntType =
66 IntegerType rhsIntType =
68 if (lhsIntType != rhsIntType)
69 return op->emitOpError(
70 "requires the same element type for all operands");
75 if (lhsIntType.getWidth() > resIntType.getWidth())
76 return op->emitOpError(
"invalid data type size for operands or result");
89 template <
typename ConcreteType>
91 :
public TraitBase<ConcreteType, TosaElementwiseOperator> {};
98 #define GET_ATTRDEF_CLASSES
99 #include "mlir/Dialect/Tosa/IR/TosaAttributes.h.inc"
101 #define GET_OP_CLASSES
102 #include "mlir/Dialect/Tosa/IR/TosaOps.h.inc"
Helper class for implementing traits.
static LogicalResult verifyTrait(Operation *op)
This class indicates that an op is tosa-elementwise (permits broadcasting, unlike Elementwise trait).
Operation is the basic unit of execution within MLIR.
LogicalResult verifySameOperandsAndResultElementType(Operation *op)
ParseResult parseTypeOrAttr(OpAsmParser &parser, TypeAttr &typeAttr, Attribute &attr)
void printTypeOrAttr(OpAsmPrinter &p, Operation *op, TypeAttr type, Attribute attr)
Include the generated interface declarations.
Type getElementTypeOrSelf(Type type)
Return the element type or return the type itself.