[Mlir-commits] [mlir] [mlir][tensor] Remove assertion in ExpandShapeOp::build (PR #91361)

Han-Chung Wang llvmlistbot at llvm.org
Tue May 7 11:12:51 PDT 2024


hanhanW wrote:

Sorry that my comment was not clear.. It is true that it is hard to test c++ builder code. My point is that the build methods and verify methods should be aligned in some sense. It is okay to generate invalid op, but the verifier should signal it. In the case we've seen in torch-mlir repo, it is generating something like:

```mlir
tensor.expand_shape %arg0 [[0, 1]] output_shape [%sz0, %sz1] : tensor<?xf32> into tensor<?x?xf32>
```

So I'd suggest add the invalid op to `invalid.mlir`, and signal some errors from the verifier. I'm concerned that an invalid op is generated silently but not captured. With the test, at least we can inform users that such invalid op is generated.

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


More information about the Mlir-commits mailing list