Intrinsics For Vector API

Viswanathan, Sandhya sandhya.viswanathan at intel.com
Thu Aug 17 16:30:58 UTC 2017


The VectorBox node is being created at every intrinsic output eagerly. If the output is consumed by another intrinsic then we bypass the VectorBox of the input otherwise the VectorBox remains. This logic is currently part of the patch. The couple of things that are to be done is to include handling expansion of VectorBox in macro.cpp and special handling for safepoints as you suggest using your code for VBox as a guideline. Please do let us know if we are missing something.

Best Regards,
Sandhya


-----Original Message-----
From: Vladimir Ivanov [mailto:vladimir.x.ivanov at oracle.com] 
Sent: Thursday, August 17, 2017 4:23 AM
To: Deshpande, Vivek R <vivek.r.deshpande at intel.com>
Cc: Paul Sandoz <paul.sandoz at oracle.com>; Viswanathan, Sandhya <sandhya.viswanathan at intel.com>; panama-dev at openjdk.java.net; Lupusoru, Razvan A <razvan.a.lupusoru at intel.com>
Subject: Re: Intrinsics For Vector API

> I have updated the patch with  the things you suggested for flags.
> The webrev is here:
>   http://cr.openjdk.java.net/~vdeshpande/Panama/webrev.02/
> Would you please to take a look and sponsor the patch in the mean time in the panama sources.

Sure, I'll do some testing and push the patch.

> I have been working on more of the Vector APIs intrinsics. I am also looking at logic for Vbox and using it for VectorBox for safepoints and other cases.
> I am looking at case where vector is created using broadcast and used inside a loop and handle the VectorBox with LoopPredicates.

Glad to hear that.

My concern is that there's no box allocation handling logic once a 
vector operation is intrinsified. There's no such logic for VBox, but 
for machine code snippets, boxes are explicitly allocated and then 
eliminated during EA (it doesn't always work smoothly).

With intrinsics, box allocation is part of intrinsified method, so you 
completely eliminate it once you intrinsify the method.

My concern is that there's no way to definitely say in advance that the 
vector box won't be needed later. So, you have to either pre-allocate 
the box (and try to eliminate it later during EA) or (lazily) allocate 
it only when it is needed (but then you need full JVM state for the 
point where you insert the allocation),

Best regards,
Vladimir Ivanov

> -----Original Message-----
> From: Vladimir Ivanov [mailto:vladimir.x.ivanov at oracle.com]
> Sent: Friday, August 11, 2017 3:46 AM
> To: Deshpande, Vivek R <vivek.r.deshpande at intel.com>
> Cc: Paul Sandoz <paul.sandoz at oracle.com>; Viswanathan, Sandhya <sandhya.viswanathan at intel.com>; panama-dev at openjdk.java.net
> Subject: Re: Intrinsics For Vector API
> 
> Nice work, Vivek & Razvan!
> 
> Overall, looks really nice.
> 
> VectorBox is almost the same as VBox, except there's no vector box instance associated with it. I'm curious what happens if vector box is
> needed: either it "escapes" or an identity-sensitive operation is performed on it. In some cases, intrinsification is disabled, but I don't think it is always possible to say in advance the box is needed or not.
> 
> Also, I suggest to look at VBox usages and consider adding corresponding logic for VectorBox. For example, there are special cases in deoptimization logic which avoid vector boxing at safepoints by keeping the vector values alive across safepoints and performing lazy rematerialization when deoptimization is needed.
> 
> Some other suggestions:
> 
> +  diagnostic(bool, UseVectorApiIntrinsics, true,
>       +          "Enables intrinsification of Vector API")
>            +
>                 +  diagnostic(bool, DebugVectorApi, false,
>                      +          "Enables printing of debug messages for
> Vector API")              +
> 
> 
> In a longer term, experimental (w/ default = false) for UseVectorApiIntrinsics is a better option. But while it's baking in Panama, just a product flag is fine.
> 
> Also, DebugVectorApi is actually notproduct (the tracing code isn't part of release build):
> 
> +#ifndef PRODUCT
> +  if (DebugVectorApi) {
> +    tty->print_cr("Trying to intrinsify vector op %s",
> +NodeClassNames[op]);
> +  }
> +#endif
> 
> Best regards,
> Vladimir Ivanov
> 
> On 8/9/17 7:40 AM, Deshpande, Vivek R wrote:
>> Hi Paul
>>
>> I have uploaded the rebased patch at this location:
>>    http://cr.openjdk.java.net/~vdeshpande/Panama/webrev.01/
>> Please take a look and let us know.
>>
>> Regards,
>> Vivek
>>
>> -----Original Message-----
>> From: Paul Sandoz [mailto:paul.sandoz at oracle.com]
>> Sent: Thursday, August 03, 2017 3:22 PM
>> To: Deshpande, Vivek R <vivek.r.deshpande at intel.com>
>> Cc: panama-dev at openjdk.java.net; Viswanathan, Sandhya
>> <sandhya.viswanathan at intel.com>
>> Subject: Re: Intrinsics For Vector API
>>
>> Hi,
>>
>> Nice work.
>>
>> Would you mind updating the patch to be in sync with the recent refactoring i made to the draft spec API?
>>
>> Notably, all classes are now under one package, com.oracle.vector, and the methods to create vector instance have been moved to the species e.g.:
>>
>> FloatVector.FloatSpecies<Shapes.S256Bit> species = (FloatVector.FloatSpecies<Shapes.S256Bit>)
>>     Vector.speciesInstance(Float.class, Shapes.S_256_BIT); for (int i = 0; i < a.length; i += species.length()) {
>>       FloatVector<Shapes.S256Bit> av = species.fromArray(a, i);
>>       FloatVector<Shapes.S256Bit> bv = species.fromArray(b, i);
>>       av.add(bv).intoArray(c, i);
>> }
>>
>> Thanks,
>> Paul.
>>
>>> On 1 Aug 2017, at 17:12, Deshpande, Vivek R <vivek.r.deshpande at intel.com> wrote:
>>>
>>> Hi All
>>>
>>> We would like to share the webrev for the Intrinsics for Vector APIs, which add the partial intrinsification support to the APIs.
>>> Webrev: http://cr.openjdk.java.net/~vdeshpande/Panama/webrev.00/
>>> Code Contributed by:
>>> Razvan Lupusoru
>>> (razvan.a.lupusoru at intel.com<mailto:razvan.a.lupusoru at intel.com>)
>>> Vivek Deshpande(vivek.r.deshpande at intel.com)
>>>
>>> The AddTest.java in jdk\test\panama\vector-draft-spec\src\test\java can be run like this:
>>> java -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation
>>> -XX:-CheckIntrinsics -XX:TypeProfileLevel=121
>>> -XX:+UseVectorApiIntrinsics -XX:+DebugVectorApi AddTest
>>>
>>> Thanks.
>>> Regards,
>>> Vivek
>>>
>>>
>>>
>>


More information about the panama-dev mailing list