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

Igor Kirillov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 7 05:01:01 PST 2021


igor.kirillov marked an inline comment as done.
igor.kirillov added a comment.

In D110235#3072725 <https://reviews.llvm.org/D110235#3072725>, @david-arm wrote:

> Hi @igor.kirillov, is it also possible to get this working for ordered reductions, i.e.
>
>   float sum = 0;
>   for(i=0..N) {
>     sum += src[i];
>     dst[42] = sum;
>   }
>
> when building with -O3? I think it might mean updating checkOrderedReductions to look through the store. If it looks too difficult to do as part of this patch we can always follow-up with a patch later.

Yes, I added a check to `LoopVectorizationLegality::canVectorizeFPMath` so as not to allow this reduction when math is strict. Enabling it requires some work and it is better to do it separately.



================
Comment at: llvm/test/Transforms/LoopVectorize/reduction.ll:471
+; CHECK-LABEL: @reduc_store
+define void @reduc_store(i32* %dst, i32* readonly %src) {
+entry:
----------------
david-arm wrote:
> Is it possible to add a simple floating point test with "fadd fast"?
Added! see **reduc_store_fadd_fast** function


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