[Mlir-commits] [mlir] b727cfe - [MLIR][LinAlg] Use AnyTypeOf for LinalgOperand for better error msg.
Alex Zinenko
llvmlistbot at llvm.org
Wed Aug 5 11:13:53 PDT 2020
Author: Vincent Zhao
Date: 2020-08-05T20:13:45+02:00
New Revision: b727cfed5e765d099f47e6785f962695408977c0
URL: https://github.com/llvm/llvm-project/commit/b727cfed5e765d099f47e6785f962695408977c0
DIFF: https://github.com/llvm/llvm-project/commit/b727cfed5e765d099f47e6785f962695408977c0.diff
LOG: [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
Added:
Modified:
mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
index 1e3321af981e..dad6f4597e62 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
@@ -443,8 +443,7 @@ def PoolingSumOp: SingleInputPoolingBase_Op<"pooling_sum"> {
//===----------------------------------------------------------------------===//
// Generic Linalg ops.
//===----------------------------------------------------------------------===//
-def LinalgOperand: Type<
- Or<[AnyRankedTensor.predicate, AnyStridedMemRef.predicate]>>;
+def LinalgOperand: AnyTypeOf<[AnyRankedTensor, AnyStridedMemRef]>;
class LinalgOperandOfRank<int rank>: Type<
And<[
More information about the Mlir-commits
mailing list