[vectorIntrinsics+mask] RFR: 8272971: Intrinsification of VectorMask.cast operation for all compatible vector species [v3]

Jatin Bhateja jbhateja at openjdk.java.net
Mon Aug 30 10:42:25 UTC 2021


On Mon, 30 Aug 2021 07:36:56 GMT, Ningsheng Jian <njian at openjdk.org> wrote:

>> Hi @nsjian, 
>> Optimization handles casting operation b/w all compatible mask species i.e. having same vector lengths. 
>> And we see around 2X speedup over AVX512. IR fragment created for non-predicated targets uses existing VectorCast[B/S/I/L] nodes with appropriate insertion of VectorMaskCast for floating point types but they operate over regular vector operands, should be ok for AARCH64 NEON.
>> Do you plan to extend the SVE backend to handle VectorMaskCast operations for various compatible species?  
>> Alternatively as an interim solution I can add a target specific matcher routine Matcher::supports_predicate_reg_cast()  and re-write above check as follows.
>> 
>> 
>>   if (is_mask && dst_type->isa_vectmask() && src_type->isa_vectmask() && !Matcher::supports_predicate_reg_cast()) {
>>     return false; // elem size mismatch
>>   }
>
>> Optimization handles casting operation b/w all compatible mask species i.e. having same vector lengths.
>> And we see around 2X speedup over AVX512. IR fragment created for non-predicated targets uses existing VectorCast[B/S/I/L] nodes with appropriate insertion of VectorMaskCast for floating point types but they operate over regular vector operands, should be ok for AARCH64 NEON.
>> Do you plan to extend the SVE backend to handle VectorMaskCast operations for various compatible species?
> 
> Yes. Currently we don't have different sized mask types conversion support for SVE backend. We can handle that in a follow-up patch. It's unfortunate that existing vector api cases cannot trigger this failure, but your JMH tests did hit that assertion of element size mismatch on SVE system.
> 
>> Alternatively as an interim solution I can add a target specific matcher routine Matcher::supports_predicate_reg_cast() and re-write above check as follows.
>> 
>> ```
>>   if (is_mask && dst_type->isa_vectmask() && src_type->isa_vectmask() && !Matcher::supports_predicate_reg_cast()) {
>>     return false; // elem size mismatch
>>   }
>> ```
> 
> I think you can also leave it to us to add the SVE backend code and simply fix (remove?) the assertion in https://github.com/openjdk/panama-vector/blob/vectorIntrinsics%2Bmask/src/hotspot/share/opto/vectornode.hpp#L1427

@nsjian , removed assertion as suggested.

-------------

PR: https://git.openjdk.java.net/panama-vector/pull/113


More information about the panama-dev mailing list