[Mlir-commits] [mlir] [mlir][tosa]-Edit the verifier of tosa constShapeOp (PR #126962)

Amir Bishara llvmlistbot at llvm.org
Wed Feb 12 12:49:23 PST 2025


================
@@ -2618,6 +2618,10 @@ OpTrait::tosa::verifyTosaShapeOperatorWithSameRanks(Operation *op) {
 //===----------------------------------------------------------------------===//
 
 LogicalResult tosa::ConstShapeOp::verify() {
+  // check one dimensional rank
+  auto valuesRank = getValue().getType().getRank();
+  if (valuesRank != 1)
+    return emitOpError("expect elements in attribute value with rank 1");
----------------
amirBish wrote:

It's already being validated with the type of the type of Value being declared in the td file.

take a look at  `mlir/include/mlir/Dialect/Tosa/IR/TosaShapeOps.td` line 70:
`  let arguments = (ins IndexElementsAttr : $value);`

https://github.com/llvm/llvm-project/pull/126962


More information about the Mlir-commits mailing list