Issue 149954
Summary [MLIR]`tosa.exp` on large constant produces inf
Labels mlir
Assignees
Reporter sweead
    test commit: [f3a3270](https://github.com/llvm/llvm-project/commit/f3a3270dbca3649b7d56aaa42cb8481fb34e2d67)

## Description:

When applying `tosa.exp` to a large constant value such as 187.84, the resulting value becomes `inf` due to floating-point overflow. 

## Steps to Reproduce:

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

```
module {
  func.func private @printMemrefF32(tensor<*xf32>)
  func.func @main() {
    %0 = "tosa.const"() <{values = dense<1.878400e+02> : tensor<f32>}> : () -> tensor<f32>
    %1 = tosa.exp %0 : (tensor<f32>) -> tensor<f32>
    %cast = tensor.cast %1 : tensor<f32> to tensor<*xf32>
    call @printMemrefF32(%cast) : (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

Reply via email to