RFR: 8319111: Mismatched MemorySegment heap access is not consistently intrinsified
Paul Sandoz
psandoz at openjdk.org
Thu Nov 30 23:53:05 UTC 2023
On Wed, 29 Nov 2023 17:49:45 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
> Patch enables intrinsification of fromMemorySegment, intoMemorySegment APIs and their masked variants for mismatched memory segments i.e. heap based memory segments whose backing storage type differs from the vector type in which they are loaded to or stored from.
>
> A load from a mismatched segment first moves the contents into type compatible vector followed by reinterpretation to desired vector type. This facilitates value forwarding from a preceding vector store as alias indices are computed using backing storage type.
>
> Mismatched masked vector loads and stores are performed at byte granularity, this handles both narrowing and widening scenarios where vector lane size is smaller than backing storage element type and vice versa.
>
> Following are the performance numbers of and existing JMH micro.
>
> 
>
> Please review and share your feedback.
>
> Best Regards,
> Jatin
src/hotspot/share/opto/vectorIntrinsics.cpp line 954:
> 952: // VM load(Class<? extends VM> vmClass, Class<E> elementType, int length,
> 953: // Object base, long offset, // Unsafe addressing
> 954: // C container, long index, S s, boolean from_ms, // Arguments for default implementation
It's misleading to place the new argument at the end because it's not part of the default implementation. Place it just after the unsafe addressing part? Also i recommend renaming it to `fromSegment` here and in the Java code (but no need in the C++ code).
src/hotspot/share/opto/vectorIntrinsics.cpp line 1162:
> 1160: // int length, Object base, long offset,
> 1161: // M m, int offsetInRange,
> 1162: // C container, long index, S s, boolean from_m, // Arguments for default implementation
Suggestion:
// C container, long index, S s, boolean from_ms, // Arguments for default implementation
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16888#discussion_r1411425278
PR Review Comment: https://git.openjdk.org/jdk/pull/16888#discussion_r1411419701
More information about the hotspot-compiler-dev
mailing list