[flang-commits] [flang] [mlir] [RFC][mlir] Conditional support for fast-math attributes. (PR #125620)
Slava Zakharin via flang-commits
flang-commits at lists.llvm.org
Tue Feb 4 13:23:02 PST 2025
vzakhari wrote:
> I think we could do something like this:
>
> * add a new op, say `%y = arith.assumef %x fastmath<nnan> : f32` (or `ub.assumef`?) whose sole purpose is to apply fast math flags to its operand
> * teach arith to llvm conversion to convert `arith.select(arith.assumef(x), arith.assumef(y))` to apply fast math flags to the produced `llvm.select` (and potentially other ops)
> * teach the frontend to produce these `arith.assumef` ops when emitting selects with fast math enabled
Can you please explain how this is better than having fast-math flags on the select itself? It seems that what you are proposing depends on whether the operands' `arith.assume` definitions are always reachable from `arith.select`, but it may not be true with block arguments. So having `arith.select` to carry fast-math seems more robust to me.
Please also note that this patch does not add fast-math support to `arith.select`, it just adds support for conditional fast-math support in general and for operations of HLFIR dialect. I appreciate the discussion about `arith.select`, but I just want to understand if you are also proposing some changes to the current patch - can you please clarify?
https://github.com/llvm/llvm-project/pull/125620
More information about the flang-commits
mailing list