Issue |
151322
|
Summary |
[MLIR] Unexpected inf output from `tosa.rsqrt` on zero input
|
Labels |
mlir
|
Assignees |
|
Reporter |
sweead
|
test commit: [9164d20](https://github.com/llvm/llvm-project/commit/9164d206b33d61c93f5fc4628797485f96d654ca)
## Description:
When applying `tosa.rsqrt` to a tensor containing the value 0.0, the resulting value becomes `inf`.
## Steps to Reproduce:
### Minimal MLIR program (test.mlir):
```
module {
func.func private @printMemrefF32(tensor<*xf32>)
func.func @main() -> () {
%arg0 = "tosa.const"() {values = dense<0.0> : tensor<1xf32>} : () -> tensor<1xf32>
%3 = tosa.rsqrt %arg0 : (tensor<1xf32>) -> tensor<1xf32>
%rtn1 = tensor.cast %3 : tensor<1xf32> to tensor<*xf32>
call @printMemrefF32(%rtn1) : (tensor<*xf32>) -> ()
return
}
}
```
### Command:
```
mlir-opt test.mlir --tosa-to-linalg-pipeline --sparsifier | \
mlir-runner -e main -entry-point-result=void -shared-libs=/home/workdir/llvm-project/build/lib/libmlir_runner_utils.so
```
### Output:
```
[inf]
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs