[PATCH] D156471: [mlir] Support fast-math friendly constants for identity value

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 28 08:25:49 PDT 2023


qcolombet added a comment.

Thanks for the link @rengolin !



================
Comment at: mlir/include/mlir/Dialect/Arith/IR/Arith.h:147
 Value getIdentityValue(AtomicRMWKind op, Type resultType, OpBuilder &builder,
-                       Location loc);
+                       Location loc, bool useOnlyFiniteValue);
 
----------------
rengolin wrote:
> Can we make these getters to set a default value? then we don't need to override on all calls, only when we know we need, for instance, when the front-end / pass knows what it's doing.
Yes we could. I decided against it because I wanted people to think about this problem when they use this API.
Now, since this may be a temporary solution, it may be better to limit the changes.

WDYT?


================
Comment at: mlir/test/Dialect/Linalg/transform-op-decompose.mlir:213
 // CHECK-DAG:        %[[D1:.+]] = tensor.empty() : tensor<2x16xf32>
-// CHECK-DAG:        %[[CST:.+]] = arith.constant 0xFF800000 : f32
+// CHECK-DAG:        %[[CST:.+]] = arith.constant -1.401300e-45 : f32
 // CHECK:        %[[D2:.+]] = linalg.fill ins(%[[CST]] : f32) outs(%[[D1]] : tensor<2x16xf32>) -> tensor<2x16xf32>
----------------
rengolin wrote:
> With no way to currently pass the flag through `mlir-opt`, it's hard to test the `inf` case...
Good point, maybe we'll want a sort of index-width option equivalent for fast math handling.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156471/new/

https://reviews.llvm.org/D156471



More information about the llvm-commits mailing list