[llvm] [LoopVectorizer] Add support for partial reductions (PR #92418)
Sam Tebbs via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 7 09:32:31 PST 2024
================
@@ -2266,6 +2275,39 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe,
bool isInLoop() const { return IsInLoop; }
};
+/// A recipe for forming partial reductions. In the loop, an accumulator and
+/// vector operand are added together and passed to the next iteration as the
+/// next accumulator. After the loop body, the accumulator is reduced to a
+/// scalar value.
+class VPPartialReductionRecipe : public VPRecipeWithIRFlags {
+ unsigned Opcode;
+
+public:
+ template <typename IterT>
+ VPPartialReductionRecipe(unsigned ReductionOpcode,
+ iterator_range<IterT> Operands)
----------------
SamTebbs33 wrote:
I wanted to do that but couldn't figure out how to create the operands list in the call to the `VPRecipeWithIRFlags` constructor if we just have the two operand values. Do let me know if you know how to do that.
https://github.com/llvm/llvm-project/pull/92418
More information about the llvm-commits
mailing list