[vector] ByteVector swizzle

Paul Sandoz paul.sandoz at oracle.com
Wed May 30 19:05:56 UTC 2018


Hi Richard,

Your email is timely. I was just proposing to change this part of the API to more generally convert a vector to a shuffle and vice versa. The current approach is too limiting, see:

  http://cr.openjdk.java.net/~psandoz/panama/shuffle-shuffle/webrev/


Vivek is working on the swizzle intrinsic, see:

  http://cr.openjdk.java.net/~vdeshpande/VectorAPI_swizzle/webrev.00/

he can talk more about the code generation. I suspect we may need a few iterations to get more optimal (including optimal runtime representations of Shuffle itself). Any help/analysis would be greatly appreciated.


I want to reimplement the cross-lane operations rotateEL/rotateER/shiftEL/shiftER using swizzle. The current plan is to focus on a set of *Vector methods that are intrinsic and can be developed with our current engineering resources, and in addition include useful methods composed from those intrinsics that generate good code.

I am not familiar with the algorithms for vector bit counts but if we can compose vector bit count from existing intrinsics then it's a strong candidate to add to the API now (otherwise we will need to evaluate the work required for a specific intrinsic and consider deferring to a later revision, and possibly add the non-optimal method to the helper classes).

Thanks,
Paul. 

> On May 29, 2018, at 8:46 AM, Richard Startin <richard at openkappa.co.uk> wrote:
> 
> I would like to permute the elements of a ByteVector<Shapes.S256Bit>. I would expect the semantics to be similar to _mm256_shuffle_epi8/VPSHUFB, which would entail the use of a ByteVector<Shapes.S256Bit> to specify the permutation. Currently Species.shuffleFromVector only supports Vector<Integer, Shape> as an argument. Is there a plan to expand this? 
> 
> Will swizzle in its current state use VPSHUFD/_mm256_shiffle_epi32?
> 
> For what it’s worth my aim is to implement a bit count for a 256 bit integral vector, where for a DIY implementation a ByteVector.shiftLeft would be ideal, but without access to VPSHUFB it’s impossible. There are well known algorithms for vector bitcounts, perhaps this would be a useful addition to the API?
> 
> Kind regards,
> Richard Startin



More information about the panama-dev mailing list