[PATCH] D126363: [VPlan, VP] 1/4 Introduce new recipes to support predicated vectorization
Simon Moll via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 27 04:53:23 PDT 2022
simoll added a comment.
In D126363#3541663 <https://reviews.llvm.org/D126363#3541663>, @ym1813382441 wrote:
> 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
Thanks for the example! We seem to converge on the `VPWidenEVL` recipe among all active participants in the discussion. To make a concrete proposal:
`evl = ExplicitVectorLength(TripCount, CanonicalInduction)`
That's just pulled and rephrased from your example. This should be sufficient for RVV, right?
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