Issue |
148812
|
Summary |
[MLIR] Inconsistent output when executing MLIR program with and without `-convert-math-to-llvm`
|
Labels |
mlir
|
Assignees |
|
Reporter |
sweead
|
test commit: [87e39c3](https://github.com/llvm/llvm-project/commit/87e39c399c96128307a826fd9168679f7c8c8d10)
## Description:
I am experiencing an inconsistent result when executing the same MLIR program with and without the `-convert-arith-to-llvm`.
## Steps to Reproduce:
### Minimal MLIR program (test.mlir):
```
#map = affine_map<(d0, d1) -> (d0, d1)>
module {
func.func @main() -> () {
%0 = "tosa.const"() <{values = dense<-170> : tensor<3x4xi64>}> : () -> tensor<3x4xi64>
%1 = "tosa.const"() <{values = dense<0> : tensor<1x4xi64>}> : () -> tensor<1x4xi64>
%2 = tosa.arithmetic_right_shift %0, %1 {round = true} : (tensor<3x4xi64>, tensor<1x4xi64>) -> tensor<3x4xi64>
%cast = tensor.cast %2 : tensor<3x4xi64> to tensor<*xi64>
call @printMemrefI64(%cast) : (tensor<*xi64>) -> ()
return
}
func.func private @printMemrefI64(tensor<*xi64>)
}
```
### 1. Without -convert-arith-to-llvm:
#### Command:
```
/home/workdir/llvm-project/build/bin/mlir-opt test.mlir --pass-pipeline="builtin.module(func.func(tosa-to-linalg))"| \
/home/workdir/llvm-project/build/bin/mlir-opt -sparsifier | \
/home/workdir/llvm-project/build/bin/mlir-runner -e main -entry-point-result=void -shared-libs=/home/workdir/llvm-project/build/lib/libmlir_runner_utils.so
```
#### Output:
```
[[-170, -170, -170, -170],
[-170, -170, -170, -170],
[-170, -170, -170, -170]]
```
### 2. With -convert-arith-to-llvm:
```
/home/workdir/llvm-project/build/bin/mlir-opt test.mlir --pass-pipeline="builtin.module(func.func(tosa-to-linalg))"| \
/home/workdir/llvm-project/build/bin/mlir-opt -convert-arith-to-llvm -sparsifier | \
/home/workdir/llvm-project/build/bin/mlir-runner -e main -entry-point-result=void -shared-libs=/home/workdir/llvm-project/build/lib/libmlir_runner_utils.so
```
#### Output:
The results are inconsistent. Possible output include:
```
[[93942316279653, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]]
```
```
[[94258813645071, 0, 140648166016064, 140648166015632],
[2, 0, 0, 0],
[3, 0, 0, 0]]
```
```
[[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]]
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs