[llvm] [LV][EVL] Support in-loop reduction using tail folding with EVL. (PR #90184)
Kolya Panchenko via llvm-commits
llvm-commits at lists.llvm.org
Fri May 3 07:00:27 PDT 2024
================
@@ -422,6 +436,11 @@ CallInst *IRBuilderBase::CreateFAddReduce(Value *Acc, Value *Src) {
return CreateCall(Decl, Ops);
}
+CallInst *IRBuilderBase::CreateFAddReduce(Value *Acc, Value *Src, Value *EVL,
+ Value *Mask) {
+ return getReductionIntrinsic(Intrinsic::vp_reduce_fadd, Acc, Src, Mask, EVL);
----------------
nikolaypanchenko wrote:
> But wouldn't it be sufficient to handle the case where VP intrinsics are generated and the one where regular intrinsics are generated? When !EVL && Mask, EVL = VF could be used
To me !EVL & Mask should really generate "masked" llvm.vector.reduce, i.e. llvm.vector.reduce(splat(identity) & !mask) | (reduce_operand & mask).
> similarly if EVL && !Mask, Mask = splat true? (At least the latter is done now manually I think in the LV code)
Currently it's done by builder itself at the line 424.
Overall, I do think Mel's https://github.com/llvm/llvm-project/commit/172745025d81388ef8104006ffd7e6faa3d1b04a change + no change in IRBuilder make more sense, unless you think IRBuilder::create*Reduction should be able to create vp-intrinsics too
https://github.com/llvm/llvm-project/pull/90184
More information about the llvm-commits
mailing list