# [llvm-dev] [RFC] Vector Predication

David Greene via llvm-dev llvm-dev at lists.llvm.org
Thu Feb 7 08:50:12 PST 2019

```Simon Moll <moll at cs.uni-saarland.de> writes:

>         You are referring to the sub-vector sizes, if i am understanding
> correctly. I'd assume that the mask sub-vector length always has to be
> either 1 or the same as the data sub-vector length. For example, this
> is ok:
>
> %result = call <scalable 3 x float> @llvm.evl.fsub.v4f32(<scalable 3 x
> float> %x, <scalable 3 x float> %y, <scalable 1 x i1> %M, i32 %L)
>
>
> What does <scalable 1 x i1> applied to <scalable 3 x float> mean?  I
> would expect a requirement of <scalable 3 x i1>.  At least that's how I
> understood the SVE proposal .  The n's in <scalable n x type> have to
> match.
>
> It would mean that the each mask bit M[i] applies to data lanes D[3*i] to D[3*i+2]. It has applications in graphics codes where the vector element type would be a short vector as in :
>
> for(int i = 0; i < 1000; i++)
> {
>     vec4 color = colors[i];    // <scalable 4 x float>
>     vec3 normal = normals[i];  // <scalable 3 x float>
>     color.rgb *= fmax(0.0, dot(normal, light_dir));
>     colors[i] = color;
> }

Ok, thanks.  The notation seems ambiguous to me.  With SVE we have types
like <scalable 4 x float>.  I would expect a scalable "vector of
vectors" type to be something like <scalable 1 x <3 x float>>, where "1"
could take on various values, for example <scalable 4 x <3 x float>>,
indicating the vector is at least 4 short vectors long.  So in the
example:

%result = call <scalable 1 x <3 x float>> @llvm.evl.fsub.v4f32(
<scalable 1 x <3 x float>> %x, <scalable 1 x <3 x float>> %y,
<scalable 1 x i1> %M, i32 %L)

Does this make sense?

-David
```