[PATCH] D110235: [LoopVectorize] Support reductions that store intermediary result
Igor Kirillov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 9 07:24:47 PST 2021
igor.kirillov 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;
----------------
david-arm wrote:
> 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.
You are right! It can be done much simpler and the check is needed only when ordered reduction is present.
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