[Mlir-commits] [mlir] [mlir][arith] Add constraints to the MulIOp for preventing type mismatch while folding (PR #136093)
Mehdi Amini
llvmlistbot at llvm.org
Thu Apr 17 09:18:04 PDT 2025
joker-eph wrote:
We should fix them all in all likeliness. I tried to prevent constant where the attribute type mismatches the SSA value in the past, but it's a rabbit hole :(
I wrote a verifier for it at some point, but many cases are problematic:
`complex.constant` doesn't return a TypedAttribute:
```
%0 = "complex.constant"() <{value = [1.200000e+00 : f32, 2.300000e+00 : f32]}> : () -> complex<f32>
````
`tosa.const` returns a TypedAttribute and mismatches:
```
# %input = "tosa.const"() {values = dense<-127> : tensor<2x1x1x2xi8>} : () -> tensor<2x1x1x2x!quant.uniform<i8<-127:127>:f32:3, {1.000000e-01,1.000000e-01}>>
```
`llvm.constant` accepts index for the attribute value:
```
%0 = llvm.mlir.constant(1 : index) : i64
```
https://github.com/llvm/llvm-project/pull/136093
More information about the Mlir-commits
mailing list