[llvm] [SystemZ, LoopVectorizer] Enable vectorization of epilogue loops after VF16. (PR #172925)
Jonas Paulsson via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 21 08:31:04 PST 2026
================
@@ -4383,13 +4383,8 @@ bool LoopVectorizationCostModel::isEpilogueVectorizationProfitable(
// account. For now we apply a very crude heuristic and only consider loops
// with vectorization factors larger than a certain value.
- // Allow the target to opt out entirely.
- if (!TTI.preferEpilogueVectorization())
- return false;
-
- // We also consider epilogue vectorization unprofitable for targets that don't
- // consider interleaving beneficial (eg. MVE).
- if (TTI.getMaxInterleaveFactor(VF) <= 1)
+ // Allow the target to opt out.
+ if (!TTI.preferEpilogueVectorization(VF))
----------------
JonPsson1 wrote:
ok, I see.
Wouldn't it still be better to let all targets that implement getMaxInterleaveFactor() be able to fine tune this with proper benchmarking rather than we change this for them blindly by passing VF*IC instead of VF? Or do you think this would be harmless here?
I would suggest doing this as a clean refactoring (in common code), that let's SystemZ (and any other target) enable this in a clean way, so that no performance surprises happens anywhere. But then again, I don't have the full picture as to how the heuristic for it, or how benchmarking across targets have been affected.
If you are confident we can just pass VF * IC to preferEpilogueVectorization(), I agree it would be good, especially as this might have to be tuned on SystemZ in which case it would be good to get it right on first try. Otherwise, maybe we could pass it as a separate parameter for now?
I think I've made my point - what would you suggest? :)
https://github.com/llvm/llvm-project/pull/172925
More information about the llvm-commits
mailing list