[Mlir-commits] [mlir] [mlir][linalg] Use maximumf with a finite neutral element in softmax decomposition (PR #213797)

Charitha Saumya llvmlistbot at llvm.org
Mon Aug 17 11:47:45 PDT 2026


================
@@ -369,12 +369,12 @@ func.func @softmax(%arg0: tensor<2x16x32xf32>, %dst: tensor<2x16x32xf32>) -> ten
 // CHECK-LABEL:      func.func @softmax(
 // CHECK-SAME:           %[[ARG0:[a-zA-Z0-9_]+]]: tensor<2x16x32xf32>, %[[DST:[a-zA-Z0-9_]+]]: tensor<2x16x32xf32>) -> tensor<2x16x32xf32> {
 // CHECK-DAG:        %[[D1:.+]] = tensor.empty() : tensor<2x16xf32>
-// CHECK-DAG:        %[[CST:.+]] = arith.constant 0xFFC00000 : f32
+// CHECK-DAG:        %[[CST:.+]] = arith.constant -3.40282347E+38 : f32
----------------
charithaintc wrote:

I think this is determined by

```
 Value neutralForMaxF = arith::getIdentityValue(arith::AtomicRMWKind::maximumf,
                                                 elementType, b, loc,
                                                 /*useOnlyFiniteValue=*/true);
```
`useOnlyFiniteValue` is set to true in original implementation. I did not change this behavior. 

https://github.com/llvm/llvm-project/pull/213797


More information about the Mlir-commits mailing list