[vector] masked loads and stores

Paul Sandoz paul.sandoz at oracle.com
Thu Nov 7 00:59:08 UTC 2019


An overview of the masked loads and stores:

- The linear masked fromArray and intoArray are implemented but not optimal when the load or store covers the end of the array, although there is some effort to efficiently check the mask.

- The masked fromByteBuffer is not implemented correctly when any one or more masked lanes are unset. The bounds checks look incorrect and the access ignores the mask.  If the load is intrinsified it could result in access beyond the end of the buffer region.

- The masked fromByteArray looks correct and can be used as a template for the masked fromByteBuffer.

- The masked intoByteBuffer throws an assertion error (stating unimplemented) if any masked lane is unset and the store covers the end of the buffer region.

- The masked intoByteArray looks correct and can be used as a template for the masked intoByteBuffer.

- To complete the set the indirect (gather/scatter) fromArray and intoArray are, as as you highlighted, not implemented correctly.  

The quickest approach is to get something functional, but not optimal, working for all of the above verified with some tests. Then we can optimize with some confidence.
 
Testing wise we have to induce the out of bound exceptions when interpreted and when possibly intrinsic.  Meaning for the latter we need to warm up with a valid load or store before tickling it with inputs that should produce the out of bounds exception.  It’s easy to go overboard with all the permutations and it might be expensive to test in such cases, so using pseudo random mask values might be justifiable (e.g. pseudo random byte[], use the bit string representation for the suffix of a mask that for any lanes set should induce the exception).

Paul. 

> On Nov 5, 2019, at 6:00 PM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> 
>> The following are still open:
>> https://bugs.openjdk.java.net/browse/JDK-8223367
>> https://bugs.openjdk.java.net/browse/JDK-8221816
>> The problem in both is the gather/scatter with mask (fromArray, intoArray) is not implemented. Need your help on this one.
>> 
> 
> It’s clear I overlooked things when staring at the code,  I’ll take another more detailed look.



More information about the panama-dev mailing list