diff --git a/mlir/include/mlir/Interfaces/DestinationStyleOpInterface.td b/mlir/include/mlir/Interfaces/DestinationStyleOpInterface.td --- a/mlir/include/mlir/Interfaces/DestinationStyleOpInterface.td +++ b/mlir/include/mlir/Interfaces/DestinationStyleOpInterface.td @@ -233,12 +233,12 @@ llvm::all_of($_op->getOpOperands(), [&](OpOperand &opOperand) { return isScalar(&opOperand) || - opOperand.get().getType().template isa(); + opOperand.get().getType().template isa(); }); }] >, InterfaceMethod< - /*desc=*/"Return whether the op has only RankedTensor input and outputs.", + /*desc=*/"Return whether the op has only tensor input and outputs.", /*retTy=*/"bool", /*methodName=*/"hasTensorSemantics", /*args=*/(ins), @@ -247,7 +247,7 @@ return llvm::all_of($_op->getOpOperands(), [&](OpOperand &opOperand) { return isScalar(&opOperand) || - opOperand.get().getType().template isa(); + opOperand.get().getType().template isa(); }); }] >, diff --git a/mlir/lib/Interfaces/DestinationStyleOpInterface.cpp b/mlir/lib/Interfaces/DestinationStyleOpInterface.cpp --- a/mlir/lib/Interfaces/DestinationStyleOpInterface.cpp +++ b/mlir/lib/Interfaces/DestinationStyleOpInterface.cpp @@ -29,10 +29,14 @@ SmallVector outputBufferOperands, outputTensorOperands; for (OpOperand *operand : dstStyleOp.getOutputOperands()) { Type type = operand->get().getType(); - if (type.isa()) + if (type.isa()) { outputBufferOperands.push_back(operand); - if (type.isa()) + } else if (type.isa()) { outputTensorOperands.push_back(operand); + } else { + return op->emitOpError("expected that operand #") + << operand->getOperandNumber() << " is a tensor or a memref"; + } } // Expect at least one output operand.