On Tue, 17 Sep 2024 07:02:12 GMT, Jatin Bhateja <[email protected]> wrote:
>> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template
>> line 2974:
>>
>>> 2972: final $abstractvectortype$ selectFromTemplate(Class<? extends
>>> Vector<$Boxbitstype$>> indexVecClass,
>>> 2973:
>>> $abstractvectortype$ v1, $abstractvectortype$ v2) {
>>> 2974: int twoVectorLen = length() * 2;
>>
>> We should assert that the length is a power of two.
>
> API only accepts vector parameters and there is no means though public facing
> API to create a vector of NPOT sizes.
> https://github.com/openjdk/jdk/blob/master/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Vector.java#L842C58-L843C27
You missed the first bit of the sentence linked to "With the possible exception
of the {@linkplain VectorShape#S_Max_BIT maximum shape}".
In generally the specification avoids assuming POT where it is not explicitly
stated (i.e., the constant shapes). In this case we align with the
specification of `VectorShuffle::wrapIndex`. We don't need to implement NPOT
but we need a reminder in the implementation where we make that assumption.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20508#discussion_r1763587293