[llvm] [LV, VP]VP intrinsics support for the Loop Vectorizer + adding new tail-folding mode using EVL. (PR #76172)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 7 14:07:57 PST 2024
================
@@ -1521,6 +1525,36 @@ class LoopVectorizationCostModel {
if (ForceTailFoldingStyle.getNumOccurrences()) {
ChosenTailFoldingStyle.first = ChosenTailFoldingStyle.second =
ForceTailFoldingStyle;
+ if (ChosenTailFoldingStyle.first == TailFoldingStyle::DataWithEVL) {
+ // FIXME: use actual opcode/data type for analysis here.
+ // FIXME: Investigate opportunity for fixed vector factor.
+ bool EVLIsLegal =
+ IsScalableVF && UserIC <= 1 &&
+ TTI.hasActiveVectorLength(0, nullptr, Align()) &&
+ !EnableVPlanNativePath &&
+ // FIXME: implement support for max safe dependency distance.
+ Legal->isSafeForAnyVectorWidth() &&
+ // FIXME: remove this once reductions are supported.
+ Legal->getReductionVars().empty() &&
+ // FIXME: remove this once vp_reverse is supported.
+ none_of(WideningDecisions,
+ [](const std::pair<std::pair<Instruction *, ElementCount>,
+ std::pair<InstWidening, InstructionCost>>
+ &Data) {
+ return Data.second.first == CM_Widen_Reverse;
+ });
+ if (!EVLIsLegal) {
+ ChosenTailFoldingStyle.first = ChosenTailFoldingStyle.second =
+ TailFoldingStyle::DataWithoutLaneMask;
+ LLVM_DEBUG(dbgs()
+ << "LV: Preference for VP intrinsics indicated. Will "
+ "not try to generate VP Intrinsics since "
+ << (UserIC > 1
+ ? "interleave count specified is greater than 1.\n"
+ : "the target does not support vector length "
----------------
ayalz wrote:
nit: the reason for failure, if not UserIC>1, is not necessarily lack of target support, i.e., TTI.hasActiveVectorLength(). Can state more generally but accurately, e.g., "due to non-interleaving reasons".
https://github.com/llvm/llvm-project/pull/76172
More information about the llvm-commits
mailing list