[llvm] [LoopVectorizer] Add support for partial reductions (PR #92418)
Graham Hunter via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 13 03:25:48 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(),
----------------
huntergr-arm wrote:
I dislike adding these to ignore, since it means we discard the values for both determining max VF (which we want to do, since we're hoping for a higher VF) and cost modelling (which we'd prefer to keep at least some of, so we can more accurately compare the scalar vs. vector plans). I don't have a nice solution to this at present, so maybe it just requires the vplan-based cost model to be fully implemented so we can do modelling properly in a future patch.
https://github.com/llvm/llvm-project/pull/92418
More information about the llvm-commits
mailing list