diff options
| author | Matthias Springer <springerm@google.com> | 2022-10-27 10:17:31 +0200 |
|---|---|---|
| committer | Matthias Springer <springerm@google.com> | 2022-10-27 10:25:04 +0200 |
| commit | ec2ea41073b629e404ab1ff57fdbc3945d5e8a06 (patch) | |
| tree | 577ac9a51d16a997a6650a6079b313279de282d6 /mlir/lib/Interfaces/DestinationStyleOpInterface.cpp | |
| parent | 826f38534816ff2890639e3a75d9d7381ffde5ac (diff) | |
[mlir][interfaces] Allow only ranked tensors/memrefs in DestinationStyleOpInterface
We have currently no need for unranked tensors/memrefs.
Differential Revision: https://reviews.llvm.org/D136588
Diffstat (limited to 'mlir/lib/Interfaces/DestinationStyleOpInterface.cpp')
| -rw-r--r-- | mlir/lib/Interfaces/DestinationStyleOpInterface.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/mlir/lib/Interfaces/DestinationStyleOpInterface.cpp b/mlir/lib/Interfaces/DestinationStyleOpInterface.cpp index 104b0fa4cb37..d89914e6585a 100644 --- a/mlir/lib/Interfaces/DestinationStyleOpInterface.cpp +++ b/mlir/lib/Interfaces/DestinationStyleOpInterface.cpp @@ -29,10 +29,15 @@ LogicalResult detail::verifyDestinationStyleOpInterface(Operation *op) { SmallVector<OpOperand *> outputBufferOperands, outputTensorOperands; for (OpOperand *operand : dstStyleOp.getOutputOperands()) { Type type = operand->get().getType(); - if (type.isa<MemRefType>()) + if (type.isa<MemRefType>()) { outputBufferOperands.push_back(operand); - if (type.isa<RankedTensorType>()) + } else if (type.isa<RankedTensorType>()) { outputTensorOperands.push_back(operand); + } else { + return op->emitOpError("expected that operand #") + << operand->getOperandNumber() + << " is a ranked tensor or a ranked memref"; + } } // Expect at least one output operand. |
