[vectorIntrinsics+mask] RFR: 8273057: [vector] New VectorAPI "SelectiveStore"
Jatin Bhateja
jbhateja at openjdk.java.net
Tue Sep 7 06:26:52 UTC 2021
On Mon, 6 Sep 2021 07:15:37 GMT, Joshua Zhu <jzhu at openjdk.org> wrote:
> > In summary, from the discussion, compress/expand are:
> >
> > * important conceptually, even if the same functionality could be composed from shuffles (such as used by an implementation); and
> > * at the right level to reliably optimize on supporting hardware.
> >
> > So specification-wise we introduce expanding/compressing cross-lane operations. API-wise I prefer two distinct methods rather that one that accepts boolean indicating expansion or compression. We can declare one intrinsic method in VectorSupport.
>
> Thanks Paul for bringing the deep design thinking.
> John Rose's encompassing knowledge impresses me a lot.
> Also thank Sandhya and Ningsheng for comments.
>
> I will refactor my codes and implement these two cross-lane data movement primitives: mask-based compression & expansion.
> They will work on general vectors and be declared:
>
> ```
> $abstractvectortype$ compress(VectorMask<$Boxtype$> m);
> $abstractvectortype$ expand(VectorMask<$Boxtype$> m);
> ```
>
> These two vector-to-vector operations together with a store/load and prefix mask could be optimized further into single memory version instruction on supported architecture.
Hi @JoshuaZhuwj ,
While adding new macro level APIs is appealing, we can also extend following existing vectorAPIs to accept another boolean flag "is_selective" under which compression/expansion triggers. In this use case its difficult to infer COMPRESSION through Auto-vectorizer though we made attempts in past to infer complex loop patterns for VNNI instruction.
```
public static IntVector fromArray(VectorSpecies<Integer> species,
int[] a,
int offset,
VectorMask<Integer> m)
public final void intoArray(int[] a,
int offset,
VectorMask<Integer> m)
This way we can also share common optimizations as you suggested earlier to convert masked COMPRESS to unmasked vector move for ALLTRUE mask, some work[1][2] is already in place on this front.
Best Regards,
Jatin
[1] https://github.com/openjdk/panama-vector/blob/master/src/hotspot/share/opto/vectornode.cpp#L752
[2] https://github.com/openjdk/panama-vector/blob/master/src/hotspot/share/opto/vectornode.cpp#L771
-------------
PR: https://git.openjdk.java.net/panama-vector/pull/115
More information about the panama-dev
mailing list