[PATCH] D154157: [LV] Cost model for out-of-loop reductions
Anna Thomas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 20 07:04:37 PDT 2023
anna added a comment.
In D154157#4648096 <https://reviews.llvm.org/D154157#4648096>, @nikic wrote:
> Would you mind testing whether this also fixes https://github.com/llvm/llvm-project/issues/57476 and adding it as a test case if so?
Unfortunately, it doesn't help when the trip count is exactly specified at compile time. However, if it is through a branch weight profile (having same behaviour as trip-count=2), with this patch we no longer vectorize ctpop. The reason is that when exact trip count =2, we clamp the max VF to be exactly 2, the reduction cost = 1 and we still vectorize. With branch profile stating trip count will be 2, we go through VF=4 and without the patch we end up vectorizing with masked vector instructions. With the patch, the vector reduce.add with VF=4 ends up being costlier for the small trip count loop and we avoid vectorizing. I will add both test cases to show the difference.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154157/new/
https://reviews.llvm.org/D154157
More information about the llvm-commits
mailing list