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

Xiaohong Gong xgong at openjdk.org
Tue Apr 11 03:21:59 UTC 2023


On Sat, 8 Apr 2023 13:49:57 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> Hi,
>> 
>> This patch implements gather/scatter operations using an index vector in the form of an `IntVector` or a `LongVector` on arrays. According to the rationales in the [original PR](https://github.com/openjdk/panama-vector/pull/201), gathering/scattering using a vector is more flexible and can be used to implement the original interface of using an index array easily. Furthermore, 64-bit indexing is necessary for operating on `MemorySegment`s in the future, which can span a larger-than-4GiB space.
>> 
>> Please take a look and leave reviews.
>> Thanks a lot.
>
> Quan Anh Mai has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - remove memory segment support
>  - load store from memory segment

src/hotspot/share/opto/vectorIntrinsics.cpp line 1417:

> 1415:   const TypeInstPtr* idx_vector_klass = gvn().type(argument(4))->isa_instptr();
> 1416:   const TypeInstPtr* idx_elem_klass   = gvn().type(argument(5))->isa_instptr();
> 1417:   const TypeLong*    scale_type       = gvn().type(argument(10))->isa_long();

Can we caculate the scale value from the `elem_bt` instead of adding such a constant argument?

src/hotspot/share/opto/vectornode.hpp line 893:

> 891:     : GatherNode(c, mem, adr, at, vt, indices, scale) {
> 892:     assert(indices->bottom_type()->is_vect()->element_basic_type() == T_LONG, "");
> 893:   }

We can also get the index type info from the index vector. So is it possible that we use a single node for the gather op, and do the different codegen in ad files based on the index element type? The same to the scatter op.

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

PR Review Comment: https://git.openjdk.org/panama-vector/pull/213#discussion_r1162257543
PR Review Comment: https://git.openjdk.org/panama-vector/pull/213#discussion_r1162258815


More information about the panama-dev mailing list