[PATCH] D142445: [mlir][tensor|memref] Harden the checks on dim op

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 03:38:34 PST 2023


qcolombet added inline comments.


================
Comment at: mlir/include/mlir/IR/OpBase.td:757-766
+class Non0RankedTensorOf<list<Type> allowedTypes>
+  : TensorOf<allowedTypes, [HasRankGreaterOrEqualPred<1>],
+      "non-0-ranked.tensor">;
+
 def AnyRankedTensor : RankedTensorOf<[AnyType]>;
+def AnyNon0RankedTensor  : Non0RankedTensorOf<[AnyType]>;
+def AnyUnrankedTensor  : UnrankedTensorOf<[AnyType]>;
----------------
springerm wrote:
> Side note: Adding a manual check to the op verifier would just be two lines. Are there any other ops that could benefit from `Non0RankedTensorOf` etc.?
Not that I know of on top of my head.

For some reasons, I feel that having the check in the td file is easier to discover (the "documentation" is all in one place), but I'm happy to move it to pure C++ in the verifier if that's what people prefer.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142445/new/

https://reviews.llvm.org/D142445



More information about the llvm-commits mailing list