[llvm-dev] Loop-vectorizer prototype for the EPI Project based on the RISC-V Vector Extension (Scalable vectors)

Roger Ferrer Ibáñez via llvm-dev llvm-dev at lists.llvm.org
Thu Nov 5 23:49:06 PST 2020


Hi Sjoerd,


> Trying to remember how everything fits together here, but could
> get.active.lane.mask not create the %mask of the VP intrinsics? Or in other
> words, in the vectoriser, who's producing the %mask and %evl that is
> consumed by the VP intrinsics?
>
> I'm not sure what would be the best way here. I think about the Loop
Vectorizer. I imagine at some point we can teach LV to emit VPred for the
widening. VPred IR needs two additional operands, as you mentioned, %evl
and %mask.

One option is make %evl the max-vector-length of the type being operated
and %mask (that is the "outer block mask" in this context) be
get.active.lane.mask. This maps well for SVE and MVE not so much for VE and
RISC-V (I don't think it is incorrect but it is not an efficient thing to
do).  Perhaps VE and RISC-V can work in this scenario if at some point they
replace the %evl with something like "%n - %base" operands of
get.active.lane.mask, and %mask (the outer block mask) is replaced with a
splat of "i1 1".

Another option here is make "%n - %base" be the %evl (or at least an
operand of some target hook because "computing" the %evl is
target-specific, targets without evl could compute the identity here) and
%mask (the outer block mask) be a splat of "i1 1". This maps well VE and
RISC-V but makes life harder for AVX-512, SVE and MVE (in general any
target where TargetTransformInfo::hasActiveVectorLength returns false).
Those targets could replace the %evl with the max-vector-length of the
operated type and then use get.active.lane.mask(0, %evl) as the outer block
mask. My understanding is that Simon used this approach in
https://reviews.llvm.org/D78203 but in a more general setting, that would
be independent of what Loop Vectorizer does.

Looks to me the second option makes a more effective use of vpred and
D78203 shows that we can always soften vpred into a shape that is
reasonable for lowering in targets without active vector length.

Thoughts?

Kind regards,
-- 
Roger Ferrer Ibáñez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201106/94e80330/attachment.html>


More information about the llvm-dev mailing list