[llvm] [LoopVectorizer] Add support for partial reductions (PR #92418)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 13 06:18:10 PDT 2024
================
@@ -6871,6 +6974,18 @@ void LoopVectorizationCostModel::collectValuesToIgnore() {
const SmallVectorImpl<Instruction *> &Casts = IndDes.getCastInsts();
VecValuesToIgnore.insert(Casts.begin(), Casts.end());
}
+
+ // Ignore any values that we know will be flattened
+ for (auto It : getPartialReductionChains()) {
+ PartialReductionChain Chain = It.second;
+ SmallVector<Value *> PartialReductionValues{Chain.Reduction, Chain.BinOp,
+ Chain.ExtendA, Chain.ExtendB,
+ Chain.Accumulator};
+ ValuesToIgnore.insert(PartialReductionValues.begin(),
+ PartialReductionValues.end());
+ VecValuesToIgnore.insert(PartialReductionValues.begin(),
----------------
fhahn wrote:
I might be missing something, but at least for NEON we seem to already consider VF = 16 for loops that perform dot-products without this change? https://godbolt.org/z/nqqM7Gxvv
It looks like its just that the lowering doesn't make use of dot products for those cases yet
https://github.com/llvm/llvm-project/pull/92418
More information about the llvm-commits
mailing list