[Mlir-commits] [mlir] [MLIR][Vector] Add fast-math flags to vector.multi_reduction (PR #233546)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Mon Oct 26 09:48:23 PDT 2026
================
----------------
banach-space wrote:
> For contract this is the same rule LLVM uses to fuse a multiply and an add into an FMA: both ops **must** carry it.
(extra emphasis by me)
Note that in `@multidimreduction_contract_fastmath_intersect` only one of the ops carries `contract`- it is not clear to me whether both ops should carry `contract`. Langref docs are not particularly helpful here:
* https://llvm.org/docs/LangRef.html#rewrite-based-flags
There is, in fact, an example demonstrating that one flag might be enough:
* https://github.com/llvm/llvm-project/blob/b8b5e88aa9eda612bb1321bc8a9fef0370c1de0a/llvm/test/CodeGen/AArch64/neon-fma-FMF.ll?plain=1#L14-L20
Note that it's target-specific. I doubt this is universally applicable. There's a recent presentation on `fastmath` - confirms that that this is a bit under-defined:
* https://www.youtube.com/watch?v=4Ag4fyjcaGA
To be on the safe side, I'd rather require both ops to carry `contract`. WDYT?
https://github.com/llvm/llvm-project/pull/233546
More information about the Mlir-commits
mailing list