[vector] RFR: Support non power-of-two and 2048-bit vector length for gather load/scatter store

Paul Sandoz paul.sandoz at oracle.com
Wed Mar 4 16:16:21 UTC 2020



> On Mar 4, 2020, at 2:50 AM, Yang Zhang <Yang.Zhang at arm.com> wrote:
> 
> Hi Paul
> 
>> ByteVector & ShortVector
>>>> Also change the mask accepting gather implementation to use the internal mask accepting stOp.  That implementation currently fails if any of the mask bits are not set.
> 
> I don't quite understand this. Could you explain more about it? Which implementation fails if any of the mask bits are not set?
> 
> 

I mixed up gather vs scatter which may have confused you.

Here is the implementation on ByteVector:

@ForceInline
public final
void intoArray(byte[] a, int offset,
               int[] indexMap, int mapOffset,
               VectorMask<Byte> m) {
    ByteSpecies vsp = vspecies();
    if (m.allTrue()) {
        intoArray(a, offset, indexMap, mapOffset);
        return;
    }
    throw new AssertionError("fixme");
}


We can replace the implementation with:

stOp(a, offset, m, 
    (arr, off, i, v) -> {
        int j = indexMap[mapOffset + i];
        arr[off + j] = e;
    }
);

Paul.


More information about the panama-dev mailing list