[PATCH] D110235: [LoopVectorize] Support reductions that store intermediary result

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 8 06:05:08 PST 2021


david-arm added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp:964
+  // address exists in the loop
+  if (any_of(getReductionVars(), [&](auto &Reduction) -> bool {
+        const RecurrenceDescriptor &RdxDesc = Reduction.second;
----------------
Maybe this can be folded into the `all_of` case below, i.e.

    return (all_of(getReductionVars(), [&](auto &Reduction) -> bool {
      const RecurrenceDescriptor &RdxDesc = Reduction.second;
      return !RdxDesc.hasExactFPMath() ||
             (RdxDesc.isOrdered() && !RdxDesc.IntermediateStore);
    }));

Also, the problem with this code at the moment is that you could have a mixture of fast and ordered reductions in the same loop. There could be an intermediate store for one of the fast reductions, but not for the ordered ones. At the moment with your code we will just bail out in this case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110235/new/

https://reviews.llvm.org/D110235



More information about the llvm-commits mailing list