Issue 149962
Summary [MLIR]Non-deterministic results from repeated JIT executions
Labels mlir
Assignees
Reporter sweead
    test commit: [f3a3270](https://github.com/llvm/llvm-project/commit/f3a3270dbca3649b7d56aaa42cb8481fb34e2d67)


## Description:

Each JIT compilation yields different output tensors, even though the program and input are unchanged.

## Steps to Reproduce:


### Minimal MLIR program (test.mlir):

```
module {
 func.func private @printMemrefI32(tensor<*xi32>)
  func.func @main() {
 %0 = "tosa.const"() <{values = dense<false> : tensor<7x5x10xi1>}> : () -> tensor<7x5x10xi1>
    %1 = tosa.argmax %0 {axis = 0 : i32} : (tensor<7x5x10xi1>) -> tensor<5x10xi32>
    %cast = tensor.cast %1 : tensor<5x10xi32> to tensor<*xi32>
    call @printMemrefI32(%cast) : (tensor<*xi32>) -> ()
    return
  }
}
```

### Command:
Execute first:
```
mlir-opt test.mlir --pass-pipeline="builtin.module(func.func(tosa-to-linalg))"  | \
mlir-opt --tosa-to-tensor --sparsification-and-bufferization="parallelization-strategy=any-storage-any-loop" \
--sparsification-and-bufferization="parallelization-strategy=any-storage-any-loop" --test-linalg-transform-patterns=test-patterns \
--tosa-to-arith --sparsifier -o output3.mlir |  \
```
Next, run the JIT compilation:
```
mlir-runner output3.mlir -e main -entry-point-result=void -shared-libs=/home/workdir/llvm-project/build/lib/libmlir_runner_utils.so
```
### Possible Output(across runs):

```
[[0,   0,   0,   0,   0,   0,   0,   0, 0,   0], 
 [0,   0,   0,   0,   0,   0,   0,   0,   0,   0], 
 [0,   0, 0,   0,   0,   1,   0,   0,   0,   0], 
 [0,   0,   0,   1,   0,   0,   0, 0,   0,   0], 
 [0,   0,   0,   0,   0,   0,   0,   0,   2, 0]]
```

```
[[0,   0,   0,   1,   0,   1,   0,   0,   0,   0], 
 [0, 0,   0,   0,   0,   0,   0,   3,   3,   0], 
 [0,   0,   0,   0,   0,   0, 0,   0,   1,   1], 
 [0,   0,   0,   0,   0,   0,   0,   0,   0,   0], 
 [0,   0,   0,   0,   0,   0,   0,   0,   0,   0]]
```
```
[[0,   0,   3, 0,   1,   1,   0,   0,   0,   0], 
 [0,   0,   1,   1,   0,   0,   0,   0, 0,   0], 
 [0,   0,   0,   0,   0,   0,   0,   0,   0,   0], 
 [0,   0, 0,   0,   0,   0,   0,   0,   0,   0], 
 [0,   0,   3,   0,   1,   1,   0, 0,   0,   0]]
```
....





_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to