[PATCH] D134605: [SLP] Add ScalarizationOverheadBuilder helper to track vector extractions
Alexey Bataev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 26 05:45:19 PDT 2022
ABataev added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6115
}
- Cost -= TTIRef.getVectorInstrCost(*EE, EE->getVectorOperandType(), Idx);
- }
- // Add a cost for subvector extracts/inserts if required.
- for (const auto &Data : ExtractVectorsTys) {
- auto *EEVTy = cast<FixedVectorType>(Data.first->getType());
- unsigned NumElts = VecTy->getNumElements();
- if (Data.second % NumElts == 0)
- continue;
- if (TTIRef.getNumberOfParts(EEVTy) > TTIRef.getNumberOfParts(VecTy)) {
- unsigned Idx = (Data.second / NumElts) * NumElts;
- unsigned EENumElts = EEVTy->getNumElements();
- if (Idx + NumElts <= EENumElts) {
- Cost +=
- TTIRef.getShuffleCost(TargetTransformInfo::SK_ExtractSubvector,
- EEVTy, None, CostKind, Idx, VecTy);
- } else {
- // Need to round up the subvector type vectorization factor to avoid a
- // crash in cost model functions. Make SubVT so that Idx + VF of SubVT
- // <= EENumElts.
- auto *SubVT =
- FixedVectorType::get(VecTy->getElementType(), EENumElts - Idx);
- Cost +=
- TTIRef.getShuffleCost(TargetTransformInfo::SK_ExtractSubvector,
- EEVTy, None, CostKind, Idx, SubVT);
- }
- } else {
- Cost += TTIRef.getShuffleCost(TargetTransformInfo::SK_InsertSubvector,
- VecTy, None, CostKind, 0, EEVTy);
- }
+ ScalarizationCost.addExtract(EE->getVectorOperand(), Idx);
}
----------------
Does it support extract subvector?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134605/new/
https://reviews.llvm.org/D134605
More information about the llvm-commits
mailing list