[Mlir-commits] [mlir] [mlir][tosa] Add ERROR_IF checks to TRANSPOSE_CONV2D verifier (PR #133234)

Elen Kalda llvmlistbot at llvm.org
Thu Apr 3 01:48:09 PDT 2025


ekalda wrote:

Hi @lhutton1, you didn't respond to my counter argument for checking `inputType` and `weightType` in this function :)

The `verifyConvOp` function that is [called in the beginning](https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp#L2897) of the transpose conv2d verifier contains these checks:
```
  auto inputType = llvm::dyn_cast<RankedTensorType>(op.getInput().getType());
  if (!inputType) {
    op.emitOpError("expect a ranked tensor for input, got ") << op.getInput();
    return failure();
  }

  auto weightType = llvm::dyn_cast<RankedTensorType>(op.getWeight().getType());
  if (!weightType) {
    op.emitOpError("expect a ranked tensor for weight, got ") << op.getWeight();
    return failure();
  }
```
So unless I am missing something, if either `inputType` or `weightType` are not ranked tensors, we would not reach the code where the tensor dimensions are accessed. 

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


More information about the Mlir-commits mailing list