[vectorIntrinsics] RFR: 8287289: Gather/Scatter with Index Vector
Joshua Zhu
jzhu at openjdk.java.net
Thu Jun 2 10:55:47 UTC 2022
On Wed, 25 May 2022 08:35:53 GMT, Joshua Zhu <jzhu at openjdk.org> wrote:
> When I assist engineers to apply VectorAPI in real business scenarios, I realize that Gather/Scatter APIs depend on indexMap residing in memory.
>
> When an index map is acquired by vector operations, it is represented by IntVector. To do Gather/Scatter operations, an extra integer array must be introduced and an explicit vector store is also required ahead of each Gather/Scatter. Furthermore, the redundant memory store may cause a performance penalty.
>
> Hence I submit this change for discussion. I propose to provide Gather/Scatter API supporting index vector. This patch only includes the change for Gather API.
> It passed the jtreg tests for VectorAPI.
John, thanks a lot for your comments.
> If we can figure out how to do scatter-gather over memory segments, that would support Java arrays (perhaps via convenience methods) and also support more general native programming scenarios, including ones which are not limited to 31-bit indexes into the Java heap.
Make sense, I will follow your suggestion and implement Gather/Scatter operation over memory segments by int/long index.
I think besides Gather/Scatter API on MemorySegment, the existing proof-of-concept APIs over Java arrays are still needed, right? As for the implementation of them, I will figure out whether the way that depends on memory segments is better.
> As a side note, I'd also like to see uniform support of subword types for scatter and gather. This is messy, but part of the value of Java is tastefully hiding such messes.
OK. Thanks.
-------------
PR: https://git.openjdk.java.net/panama-vector/pull/201
More information about the panama-dev
mailing list