Issue |
154332
|
Summary |
[MLIR]Inconsistent Results from `tosa.arithmetic_right_shift` Operation
|
Labels |
mlir
|
Assignees |
|
Reporter |
sweead
|
test commit: [98e8f01](https://github.com/llvm/llvm-project/commit/98e8f01d183177a4f54187c23183da50a7cf6daf)
## Description:
The `tosa.arithmetic_right_shift` operation should always yield a consistent result when applied to the same inputs. However, executing the same lowering sequence multiple times produces inconsistent results.
## Steps to Reproduce:
### Minimal MLIR program (test.mlir):
```
module {
func.func private @printMemrefI16(tensor<*xi16>) attributes {llvm.emit_c_interface}
func.func @main() {
%0 = "tosa.const"() <{values = dense<53> : tensor<2xi16>}> : () -> tensor<2xi16>
%1 = "tosa.const"() <{values = dense<10> : tensor<2xi16>}> : () -> tensor<2xi16>
%2 = tosa.arithmetic_right_shift %1, %0 {round = true} : (tensor<2xi16>, tensor<2xi16>) -> tensor<2xi16>
%cast = tensor.cast %2 : tensor<2xi16> to tensor<*xi16>
call @printMemrefI16(%cast) : (tensor<*xi16>) -> ()
return
}
}
```
#### Command:
```
/home/workdir/llvm-project/build/bin/mlir-opt test.mlir -pass-pipeline="builtin.module(func.func(tosa-to-linalg))" | \
/home/workdir/llvm-project-latest/build/bin/mlir-opt -tosa-to-arith \
-one-shot-bufferize="bufferize-function-boundaries=1" \
-convert-linalg-to-affine-loops \
-lower-affine \
-convert-scf-to-cf \
-convert-to-llvm | \
/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:
```
[0, 0]
```
```
[7134, -31124]
```
```
[10, 0]
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs