[llvm] [LV][EVL] Support in-loop reduction using tail folding with EVL. (PR #90184)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 28 01:31:40 PDT 2024


================
@@ -2144,16 +2151,67 @@ class VPReductionRecipe : public VPSingleDefRecipe {
              VPSlotTracker &SlotTracker) const override;
 #endif
 
+  /// Return the recurrence decriptor for the in-loop reduction.
+  const RecurrenceDescriptor &getRecurrenceDescriptor() const {
+    return RdxDesc;
+  }
+  /// Return true if the in-loop reduction is ordered.
+  bool isOrdered() const { return IsOrdered; };
   /// The VPValue of the scalar Chain being accumulated.
   VPValue *getChainOp() const { return getOperand(0); }
   /// The VPValue of the vector value to be reduced.
   VPValue *getVecOp() const { return getOperand(1); }
   /// The VPValue of the condition for the block.
-  VPValue *getCondOp() const {
+  virtual VPValue *getCondOp() const {
----------------
Mel-Chen wrote:

It's challenging for `VPReduction*`, I think. That's because not all reduction recipes have a `CondOp`. If I put the EVL as *the last* operand, it would be operand(3) if there's a `CondOp`, and operand(2) if there isn't no `CondOp`. Overall, it would be difficult to statically decide whether EVL is operand(2) or operand(3).

https://github.com/llvm/llvm-project/pull/90184


More information about the llvm-commits mailing list