[llvm] [VPlan] Impl VPlan-based pattern match for ExtendedRed and MulAccRed (PR #113903)
Elvis Wang via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 21 16:19:57 PDT 2025
================
@@ -9515,6 +9458,25 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
// Adjust the recipes for any inloop reductions.
adjustRecipesForReductions(Plan, RecipeBuilder, Range.Start);
+ // Transform recipes to abstract recipes if it is leagal and beneficial and
+ // clamp the range for better cost estimation.
+ // TODO: Enable following transform when the EVL-version of extended-reduction
+ // and mulacc-reduction are implemented.
+ if (!CM.foldTailWithEVL()) {
+ VPCostContext CostCtx(CM.TTI, *CM.TLI, Legal->getWidestInductionType(), CM,
+ CM.CostKind);
+ VPlanTransforms::runPass(VPlanTransforms::convertToAbstractRecipes, *Plan,
+ CostCtx, Range);
+ }
+
+ // Update VF after convertToAbstractRecipes. Cannot set the VF here since
+ // `handleUncountableEarlyExit` will check the VF of the plan, need to set
+ // before it and update.
+ // TODO: Use a better method that only set the VF for plan once.
+ Plan->clearVF();
+ for (ElementCount VF : Range)
+ Plan->addVF(VF);
----------------
ElvisWang123 wrote:
No, I just move addVF to plan after `convertToAbstractRecipe()`. Don't need to update the VF anymore.
https://github.com/llvm/llvm-project/pull/113903/files#diff-da321d454a7246f8ae276bf1db2782bf26b5210b8133cb59e4d7fd45d0905decL9760-L9763
https://github.com/llvm/llvm-project/pull/113903
More information about the llvm-commits
mailing list