VectorAPI and C2 compiler
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Tue Jan 12 19:19:02 UTC 2021
Thanks for the test case, Jose.
I see the following intrinsification failure when running it:
572 69 b Cast::vectorCastIntToShort (28 bytes)
** missing constant: opr=ConI vclass_from=ConP etype_from=ConP
vlen_from=ConI vclass_to=ConP etype_to=ConP vlen_to=LoadI
...
128 jdk.internal.vm.vector.VectorSupport::convert (39 bytes) failed
to inline (intrinsic)
I'll take a look why it happens.
Best regards,
Vladimir Ivanov
[1] java --add-modules jdk.incubator.vector -Xbatch
-XX:+PrintCompilation -XX:-TieredCompilation -XX:CICompilerCount=1
-XX:+PrintInlining -XX:CompileCommand=quiet
-XX:CompileCommand=compileonly,*::vectorCastIntToShort
-XX:+PrintIntrinsics Cast
On 12.01.2021 22:11, joserz at linux.ibm.com wrote:
> Hi Paul,
>
> Thank you for your response!! :-)
>
> This is my test case for x86 (basically got from VectorReshapeTests.java).
> ```
> import java.io.IOException;
> import java.util.Arrays;
> import jdk.incubator.vector.IntVector;
> import jdk.incubator.vector.ShortVector;
> import jdk.incubator.vector.DoubleVector;
> import jdk.incubator.vector.VectorSpecies;
> import jdk.incubator.vector.LongVector;
>
> class Cast
> {
> static void vectorCastIntToShort(VectorSpecies<Integer> i,
> VectorSpecies<Short> s,
> int[] input,
> short[] output)
> {
> IntVector iv = IntVector.fromArray(i, input, 0);
> ShortVector sv = (ShortVector) iv.castShape(s, 0);
> sv.intoArray(output, 0);
> }
>
> public static void main(String[] args) throws IOException
> {
> for (int j = 0; j < 1_000_000; j++) {
> int[] iin128 = {25, -398, 415, Short.MAX_VALUE + 2};
> short[] sout64 = new short[ShortVector.SPECIES_64.length()];
>
> vectorCastIntToShort(IntVector.SPECIES_128,
> ShortVector.SPECIES_64,
> iin128, sout64);
> }
>
> //System.out.println(Arrays.toString(iin128));
> //System.out.println(Arrays.toString(sout64));
> }
> }
> ```
>
> Then, after compiling and running like:
> $ javac Cast.java
> $ java -Xcomp -XX:-TieredCompilation -XX:CompileThreshold=1 -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly -XX:+PrintOptoAssembly -XX:+UnlockExperimentalVMOptions -XX:+EnableVectorSupport -XX:+EnableVectorReboxing -XX:+EnableVectorAggressiveReboxing -XX:UseAVX=2 Cast
>
> I was expecting to see instructions from x86.ad, like "vector_cast_i2x" being printed but it seems that VectorCastI2X pattern isn't be generated because I see compiler C2 kicking in during the program execution.
>
> Thank you very much!
>
> Jose
>
>
> On Tue, Jan 12, 2021 at 09:07:49AM -0800, Paul Sandoz wrote:
>> Hi Jose,
>>
>> Shifting over to panama-dev (bcc’ing discuss at openjdk.java.net <mailto:discuss at openjdk.java.net>).
>>
>> Can you share a complete example on x86 that is not producing what you expect?
>>
>> I suspect in the PPC case some wiring up to the vector intrinsics are missing.
>>
>> Paul.
>>
>>> On Jan 11, 2021, at 1:07 PM, joserz at linux.ibm.com wrote:
>>>
>>> Hello team,
>>>
>>> I'm currently working on the VectorAPI support to PowerPC64 but none of my instructions, defined in ppc64.ad, gets executed. I decided to take a look at x86, but again no Vector instructions printed.
>>>
>>> Basically, I have a test case like this:
>>> for (int j = 0; j < 1_000_000; j++) {
>>> int[] iin128 = {25, -398, 415, Short.MAX_VALUE + 2};
>>> short[] sout64 = new short[ShortVector.SPECIES_64.length()];
>>>
>>> vectorCastIntToShort(IntVector.SPECIES_128,
>>> ShortVector.SPECIES_64,
>>> iin128, sout64);
>>> }
>>>
>>> That I execute like:
>>> java -Xcomp -XX:-TieredCompilation -XX:CompileThreshold=1 \
>>> -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly \
>>> -XX:+PrintOptoAssembly -XX:+UnlockExperimentalVMOptions \
>>> -XX:+EnableVectorSupport -XX:+EnableVectorReboxing \
>>> -XX:+EnableVectorAggressiveReboxing -XX:UseAVX=2 Cast
>>>
>>> And expected to see any of `format %{ "vector_* ... %}` instructions, defined in x86.ad, being printed.
>>>
>>> Am I missing anything?
>>>
>>> Thank you,
>>>
>>> Jose R Ziviani
>>
More information about the panama-dev
mailing list