Vector.shiftER, Vector.shiftEL not working as expected.
Richard Startin
richard at openkappa.co.uk
Tue Oct 10 19:01:25 UTC 2017
Hi Razvan, Paul,
Thanks, I was expecting PSLLD/PSRLD for packed integers as per the start of my email. I am experimenting to see how fast integer compression algorithms such as [1] can go in Java. I'll keep an eye on the project and have another go when more has been intrinsified.
Thanks for pushing the fix.
[1] <http://boytsov.info/pubs/simdcompressionarxiv.pdf> https://arxiv.org/pdf/1401.6399.pdf
Thanks,
Richard
________________________________
From: Lupusoru, Razvan A <razvan.a.lupusoru at intel.com>
Sent: 10 October 2017 19:34:14
To: Paul Sandoz; Richard Startin
Cc: panama-dev at openjdk.java.net
Subject: RE: Vector.shiftER, Vector.shiftEL not working as expected.
Hi Richard,
As Paul noted, there is currently no x86 implementation for these and the operation is done with Java implementation. The work to support all of the API in a performant manner is ongoing and will occur through next few months.
Once implemented, Elemental shifting will be supported using x86 instructions vpslld and vpsrld (for Integers). http://www.felixcloutier.com/x86/PSLLW:PSLLD:PSLLQ.html
Elemental rotate will be supported using a mix of vpslld and vpsrld plus vpand.
--Razvan
-----Original Message-----
From: panama-dev [mailto:panama-dev-bounces at openjdk.java.net] On Behalf Of Paul Sandoz
Sent: Tuesday, October 10, 2017 11:23 AM
To: Richard Startin <richard at openkappa.co.uk>
Cc: panama-dev at openjdk.java.net
Subject: Re: Vector.shiftER, Vector.shiftEL not working as expected.
Hi Richard,
Thanks for reporting. It's a silly bug in the Java implementation as these are not intensified (they lack the @HotSpotIntrinsicCandidate annotation). I just pushed a fix. We currently lack docs and testing, the latter should be easily amenable to some combinator approach.
These methods shift elements left or right into different lanes. I am not familiar with specific Intel instructions that might do this can you provide some links?
They are not btiwise operations that shift the bits of the elements. The bitwise and logical operations reside on the bitwise compatible vectors (namely for byte, short, int and long [*])
Paul.
[*] It's an open question whether we should have a BitWise and FloatingPoint type in the hierarchy.
> On 8 Oct 2017, at 11:03, Richard Startin <richard at openkappa.co.uk> wrote:
>
> What are the methods shiftEL and shiftER supposed to do? I read these as "shift elements left/right" and expect them to behave like the PS[L|R]L[W|D|Q] instructions.
>
>
> Specifically, I expected the code below to print:
>
>
> [2, 3, 4, 5, 6, 7, 8, 0]
>
> [0, 1, 2, 3, 4, 5, 6, 7]
>
>
> int[] ymmword = new int[] {1, 2, 3, 4, 5, 6, 7, 8};
>
> int[] result = new int[8];
>
> IntVector.IntSpecies<Shapes.S256Bit> species = (IntVector.IntSpecies<Shapes.S256Bit>)Vector.speciesInstance(Integer.class, Shapes.S_256_BIT);
>
> IntVector<Shapes.256Bit> vector1 = (IntVector<Shapes.256Bit>)species.fromArray(ymmword, 0).shiftEL(1);
>
> vector1.intoArray(result, 0);
>
> System.out.println(Arrays.toString(result));// This prints [0, 1, 2, 3, 4, 5, 6, 7]
>
>
> IntVector<Shapes.256Bit> vector2 = (IntVector<Shapes.256Bit>)species.fromArray(ymmword, 0).shiftER(1);
>
> vector2.intoArray(result, 0);
>
> System.out.println(Arrays.toString(result)); // This prints [2, 2, 2, 2, 2, 2, 2, 0]
>
>
> To build the Panama code I followed the instructions at https://software.intel.com/en-us/articles/vector-api-developer-program-for-java
>
>
> Have I understood the purpose of these methods correctly and is the observed output as expected? For reference is it possible to access the intended assembly snippets for a given method?
>
>
> Thanks,
> Richard
>
>
>
>
>
>
>
>
>
>
> Richard Startin
>
More information about the panama-dev
mailing list