[vectorIntrinsics] RFR: Load store memory segment [v3]

Paul Sandoz psandoz at openjdk.java.net
Wed Mar 30 19:18:06 UTC 2022


On Wed, 30 Mar 2022 08:15:54 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Paul Sandoz has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Use assertThrows.
>
> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Vector.java line 3546:
> 
>> 3544:      *         or if access occurs from a thread other than the thread owning the session.
>> 3545:      */
>> 3546:     public abstract void intoMemorySegment(MemorySegment ms, long offset, ByteOrder bo);
> 
> Just a note - in the memory segment API we used to have API points taking an explicit byte order (e.g. dereference methods) and it turned out these were just specific instances of a more general API method accepting a full layout. I sense the same might apply here - e.g. if you take a segment, an offset and a layout, then you might be able to generalize the API to more than byte[]-backed memory segment. But for now it's fine. Or - maybe, in this case the vector instance should have a lane layout somewhere, which can be used here.

I need to think more thoroughly about this. The vector/species can have a layout (perhaps two, a value for the bits, and a sequence for lane element values), and the segment has a value layout for its elements, and the segment may be backed by a primitive array that also has an element value layout. Further complicating matters is the offset will be in units of byte.
(Separately it got me thinking if a segment should expose its "source" elemental layout, for native it would be `JAVA_BYTE`, for a heap covering `int[]` it would be `JAVA_INT`.)

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

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


More information about the panama-dev mailing list