[llvm] [SLP] Support ordered FAdd reductions in SLPVectorizer (PR #146570)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 20 10:13:42 PDT 2025
================
@@ -21774,6 +21784,8 @@ class HorizontalReduction {
/// signedness.
SmallVector<std::tuple<Value *, unsigned, bool>> VectorValuesAndScales;
+ SmallVector<Value *, 2> InitialFAddValues;
+
----------------
sc-clulzze wrote:
We need this for cases like: `(v1 + (v2 + ... + (vn-1 + vn)))))`, and we vectorized only part of this values starting at some position i != 1: `(v1 + (v2 + ... + vi-1 <vi,...vn>))`, so we need to pass some value to reduction intrinsic to preserve ordering: `reduce(vi-1, <vi...vn>)`. Additionally we can have multiple vectorized trees which results in multiple separate reductions: `<v1...v32> + <v33...v40> + <v41...v44> -> reduce1(-0.0f, <v1...v32>); reduce2(reduce1, <v33...v40>); reduce3(reduce2, <v41...v44>)`. This is demonstrated in test_reduce_multiple_use and test_reduce_multiple_reductions test cases inside fadd-vectorize.ll. Also instead of SmallVector it is now just one Value.
https://github.com/llvm/llvm-project/pull/146570
More information about the llvm-commits
mailing list