[PATCH] D126363: [VPlan, VP] 1/4 Introduce new recipes to support predicated vectorization
yanming via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 26 20:23:18 PDT 2022
ym1813382441 added a comment.
We need to generate code to compute the EVL, its operand should be application vector length ,and EVL maybe depends on the canonical induction recipes.
For example,
for (i = 0; i < n; ++i)
c[i] = a[i] + b[i];
VPlan should be modeled as:
n = trip count
vector loop: {
EMIT i = canonical induction
EMIT avl = n - i
EMIT evl = set.evl(avl, ...) (generate explicit vector length)
EMIT mask = (all true mask)
WIDEN t0 = vp.load(a, mask, evl)
WIDEN t1 = vp.load(b, mask, evl)
WIDEN t2 = vp.add(t0, t1, mask, evl)
WIDEN vp.store(t2, c, mask, evl)
EMIT i.next = i + evl
EMIT i < n (branch-on-count)
}
EVL may be different in each vector iteration, and set.evl may also require more parameters, such as the upper limit of the vector length or the width of the data type.
Various situations show that we need to model it as recipe.
And "llvm.set.evl" intrinsic need to be added.
We may refer to RVV architecture to set some restrictions for "llvm.set.evl", like...
evl = 0 if avl = 0
evl > 0 if avl > 0
evl ≤ VF
evl ≤ avl
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126363/new/
https://reviews.llvm.org/D126363
More information about the llvm-commits
mailing list