[llvm] [LoopVectorizer] Add support for partial reductions (PR #92418)

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 26 02:15:31 PST 2024


================
@@ -2067,6 +2085,19 @@ class TargetTransformInfo::Concept {
   /// \return if target want to issue a prefetch in address space \p AS.
   virtual bool shouldPrefetchAddressSpace(unsigned AS) const = 0;
 
+  /// \return The cost of a partial reduction, which is a reduction from a
+  /// vector to another vector with fewer elements of larger size. They are
+  /// represented by the llvm.experimental.partial.reduce.add intrinsic, which
+  /// takes an accumulator and a binary operation operand that itself is fed by
+  /// two extends. An example of an operation that uses a partial reduction is a
+  /// dot product, which reduces a vector to another of 4 times larger but fewer
----------------
huntergr-arm wrote:

The instructions we're targeting so far are 4 -> 1, but there are 2 -> 1 variants as well that we can add support for later. Mostly we're just looking for the extend->multiply->add pattern for dot products. X86 has similar instructions, e.g. `VPDPBUSD`.

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


More information about the llvm-commits mailing list