RFR: 8287289: Gather/Scatter with Index Vector [v3]

Quan Anh Mai qamai at openjdk.org
Tue Apr 11 18:22:08 UTC 2023


On Tue, 11 Apr 2023 17:03:17 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

>> I'm wondering whether it's better to also keep the original array APIs as well?
>
>> I'm wondering whether it's better to also keep the original array APIs as well?
> 
> My recommendation is to shrink the API down to the key primitives and then see if should build things back up with helper methods or with documentation. I suspect we don't need so many methods for this use-case.
> 
> A useful performance test could be to operate on the same arguments as the original array APIs implemented using the mapped index vector.
> 
> Paul.

@PaulSandoz 

- I have tried adding operations on `MemorySegment` but encountered failures possibly due to mismatched element types. I have not taken a closer look but notably currently our loads/stores with respect to `MemorySegment` only work on native segments of heap segments backed by byte arrays.

- It turns out that adding an offset complicates the range check quite a lot as we have to take into consideration overflow of addition/subtraction. The users can easily simulate this operation by adding/subtracting from the index vector, albeit without the guarantees in cases of overflow, but I think in reality application code does not require such strong guarantees as the JDK itself, maybe a separate helper method to perform strict range checks would be desirable.

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

PR Comment: https://git.openjdk.org/panama-vector/pull/213#issuecomment-1503877333


More information about the panama-dev mailing list