Skip to content

Commit b727cfe

Browse files
kumasentoftynse
authored andcommitted
[MLIR][LinAlg] Use AnyTypeOf for LinalgOperand for better error msg.
Previously, `LinalgOperand` is defined with `Type<Or<..,>>`, which produces not very readable error messages when it is not matched, e.g., ``` 'linalg.generic' op operand #0 must be anonymous_326, but got .... ``` It is simply because the `description` property is not properly set. This diff switches to use `AnyTypeOf` for `LinalgOperand`, which automatically generates a description based on the allowed types provided. As a result, the error message now becomes: ``` 'linalg.generic' op operand #0 must be ranked tensor of any type values or strided memref of any type values, but got ... ``` Which is clearer and more informative. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D84428
1 parent 4f20f5e commit b727cfe

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,7 @@ def PoolingSumOp: SingleInputPoolingBase_Op<"pooling_sum"> {
443443
//===----------------------------------------------------------------------===//
444444
// Generic Linalg ops.
445445
//===----------------------------------------------------------------------===//
446-
def LinalgOperand: Type<
447-
Or<[AnyRankedTensor.predicate, AnyStridedMemRef.predicate]>>;
446+
def LinalgOperand: AnyTypeOf<[AnyRankedTensor, AnyStridedMemRef]>;
448447

449448
class LinalgOperandOfRank<int rank>: Type<
450449
And<[

0 commit comments

Comments
 (0)