Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v7]

2023-04-11 Thread Quan Anh Mai
On Tue, 11 Apr 2023 17:47:56 GMT, Jatin Bhateja wrote: >> Quan Anh Mai has updated the pull request incrementally with one additional >> commit since the last revision: >> >> special case iotaShuffle > > Marked as reviewed by jbhateja (Reviewer). @jatin-bhateja @iwanowww Thanks a lot for you

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v7]

2023-04-11 Thread Vladimir Ivanov
On Fri, 7 Apr 2023 17:13:50 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffici

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v6]

2023-04-11 Thread Jatin Bhateja
On Tue, 11 Apr 2023 09:36:06 GMT, Quan Anh Mai wrote: >> Hi @merykitty , Agree with you that SPECIES_PREFERRED is preferred for >> vector algorithms intercepting both integral and floating point vectors. >> >> FTR, we see a perf regression with Float256 based micro now on AVX=1 targets, >> >>

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v7]

2023-04-11 Thread Jatin Bhateja
On Fri, 7 Apr 2023 17:13:50 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffici

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v6]

2023-04-11 Thread Quan Anh Mai
On Mon, 10 Apr 2023 15:16:59 GMT, Jatin Bhateja wrote: >> Yes I think it is a drawback of this approach, however currently we do not >> support shuffling for 256-bit vectors on AVX1 machines either, and AVX1 >> seems to be a special case in this regard. This species of float and double >> may

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v6]

2023-04-10 Thread Quan Anh Mai
On Mon, 10 Apr 2023 15:16:59 GMT, Jatin Bhateja wrote: >> Yes I think it is a drawback of this approach, however currently we do not >> support shuffling for 256-bit vectors on AVX1 machines either, and AVX1 >> seems to be a special case in this regard. This species of float and double >> may

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v6]

2023-04-10 Thread Quan Anh Mai
On Mon, 10 Apr 2023 15:11:55 GMT, Jatin Bhateja wrote: >> Thanks a lot for your review, I think that transforming a multiplication by >> a power of 2 into a shift can be done by the C2 compiler. I have added the >> special case for `start = 0 && step == 1` since it may be more common and >> ca

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v6]

2023-04-10 Thread Jatin Bhateja
On Fri, 7 Apr 2023 18:04:16 GMT, Quan Anh Mai wrote: >> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractShuffle.java >> line 96: >> >>> 94: } >>> 95: Vector shufvec = this.toBitsVector(); >>> 96: VectorMask vecmask = shufvec.compare(VectorOperators.LT

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v6]

2023-04-10 Thread Jatin Bhateja
On Fri, 7 Apr 2023 17:12:08 GMT, Quan Anh Mai wrote: >> Power of two step count may be replaced by logical right shifts. But special >> handling may impact generic path >> , currently c2 inline expander handles these special cases. >> >> Alternatively we can keep this implementation at its and

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v6]

2023-04-07 Thread Quan Anh Mai
On Fri, 7 Apr 2023 11:51:21 GMT, Jatin Bhateja wrote: >> Quan Anh Mai has updated the pull request incrementally with one additional >> commit since the last revision: >> >> small cosmetics > > src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractShuffle.java > line 96: > >>

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v6]

2023-04-07 Thread Quan Anh Mai
On Fri, 7 Apr 2023 13:36:22 GMT, Jatin Bhateja wrote: >> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractVector.java >> line 226: >> >>> 224: >>> 225: AbstractSpecies species = vspecies().asIntegral(); >>> 226: Vector iota = species.iota(); >> >> we can do

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v7]

2023-04-07 Thread Quan Anh Mai
> Hi, > > This patch reimplements `VectorShuffle` implementations to be a vector of the > bit type. Currently, VectorShuffle is stored as a byte array, and would be > expanded upon usage. This poses several drawbacks: > > 1. Inefficient conversions between a shuffle and its corresponding vector

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v6]

2023-04-07 Thread Jatin Bhateja
On Fri, 7 Apr 2023 12:36:04 GMT, Jatin Bhateja wrote: >> Quan Anh Mai has updated the pull request incrementally with one additional >> commit since the last revision: >> >> small cosmetics > > src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractVector.java > line 226: > >>

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v6]

2023-04-07 Thread Jatin Bhateja
On Fri, 31 Mar 2023 12:25:16 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffic

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v6]

2023-04-03 Thread Paul Sandoz
On Tue, 4 Apr 2023 00:56:09 GMT, Quan Anh Mai wrote: > Thanks, may I integrate the changes now? You might need another HotSpot reviewer? @vnkozlov is that correct? - PR Comment: https://git.openjdk.org/jdk/pull/13093#issuecomment-1495198225

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v6]

2023-04-03 Thread Quan Anh Mai
On Fri, 31 Mar 2023 12:25:16 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffic

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v6]

2023-04-03 Thread Paul Sandoz
On Fri, 31 Mar 2023 12:25:16 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffic

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v6]

2023-04-03 Thread Paul Sandoz
On Fri, 31 Mar 2023 12:25:16 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffic

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v6]

2023-04-02 Thread Xiaohong Gong
On Fri, 31 Mar 2023 12:25:16 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffic

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v2]

2023-03-31 Thread Paul Sandoz
On Tue, 21 Mar 2023 16:29:44 GMT, Paul Sandoz wrote: >> I have moved most of the methods to `AbstractVector` and `AbstractShuffle`, >> I have to resort to raw types, though, since there seems to be no way to do >> the same with wild cards, and the generics mechanism is not powerful enough >> f

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v5]

2023-03-31 Thread Paul Sandoz
On Fri, 31 Mar 2023 12:17:49 GMT, Quan Anh Mai wrote: >> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template >> line 1106: >> >>> 1104: @Override >>> 1105: @ForceInline >>> 1106: public int laneSource(int i) { >> >> Can this method be

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v5]

2023-03-31 Thread Quan Anh Mai
On Fri, 31 Mar 2023 00:18:21 GMT, Paul Sandoz wrote: >> Quan Anh Mai has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 14 commits: >> >> - move implementations up >> - Merge branch 'master' into shufflerefactor >> - Merge branch

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v2]

2023-03-31 Thread Quan Anh Mai
On Tue, 21 Mar 2023 16:29:44 GMT, Paul Sandoz wrote: >> I have moved most of the methods to `AbstractVector` and `AbstractShuffle`, >> I have to resort to raw types, though, since there seems to be no way to do >> the same with wild cards, and the generics mechanism is not powerful enough >> f

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v6]

2023-03-31 Thread Quan Anh Mai
> Hi, > > This patch reimplements `VectorShuffle` implementations to be a vector of the > bit type. Currently, VectorShuffle is stored as a byte array, and would be > expanded upon usage. This poses several drawbacks: > > 1. Inefficient conversions between a shuffle and its corresponding vector

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v5]

2023-03-30 Thread Xiaohong Gong
On Thu, 30 Mar 2023 14:30:17 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffic

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v5]

2023-03-30 Thread Xiaohong Gong
On Thu, 30 Mar 2023 14:41:29 GMT, Quan Anh Mai wrote: >> Yeah, I agree that saving a node have some benefits like what you said. My >> concern is there are more and more methods added into `Matcher::` and each >> platform has to do the different implementation. There is not too much >> meaning

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v5]

2023-03-30 Thread Paul Sandoz
On Thu, 30 Mar 2023 14:30:17 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffic

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v5]

2023-03-30 Thread Paul Sandoz
On Thu, 30 Mar 2023 14:30:17 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffic

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v5]

2023-03-30 Thread Paul Sandoz
On Thu, 30 Mar 2023 14:30:17 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffic

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v5]

2023-03-30 Thread Paul Sandoz
On Thu, 30 Mar 2023 14:30:17 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffic

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v5]

2023-03-30 Thread Quan Anh Mai
On Thu, 23 Mar 2023 02:23:20 GMT, Xiaohong Gong wrote: >> I think not emitting `VectorLoadShuffleNode` is more common so it is better >> to emit them only when needed, as it will simplify the graph and may allow >> better inspections of the indices in the future. Additionally, a do-nothing >>

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v5]

2023-03-30 Thread Quan Anh Mai
On Thu, 23 Mar 2023 07:13:55 GMT, Xiaohong Gong wrote: >> Quan Anh Mai has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 14 commits: >> >> - move implementations up >> - Merge branch 'master' into shufflerefactor >> - Merge branc

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v5]

2023-03-30 Thread Quan Anh Mai
> Hi, > > This patch reimplements `VectorShuffle` implementations to be a vector of the > bit type. Currently, VectorShuffle is stored as a byte array, and would be > expanded upon usage. This poses several drawbacks: > > 1. Inefficient conversions between a shuffle and its corresponding vector

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v4]

2023-03-23 Thread Xiaohong Gong
On Wed, 22 Mar 2023 12:46:33 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffic

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v3]

2023-03-22 Thread Xiaohong Gong
On Wed, 22 Mar 2023 08:09:03 GMT, Xiaohong Gong wrote: >> Quan Anh Mai has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - missing casts >> - clean up > > Please also update the copyright to 2023 for some touched files like > `vectorSupp

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v4]

2023-03-22 Thread Xiaohong Gong
On Wed, 22 Mar 2023 12:42:15 GMT, Quan Anh Mai wrote: >> src/hotspot/share/opto/vectorIntrinsics.cpp line 2059: >> >>> 2057: if (need_load_shuffle) { >>> 2058: shuffle = gvn().transform(new VectorLoadShuffleNode(shuffle, vt)); >>> 2059: } >> >> How about generating `VectorLoadShuffleNod

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v4]

2023-03-22 Thread Xiaohong Gong
On Wed, 22 Mar 2023 12:39:27 GMT, Quan Anh Mai wrote: >> src/hotspot/share/opto/vectorIntrinsics.cpp line 2426: >> >>> 2424: if (is_vector_shuffle(vbox_klass_from)) { >>> 2425: return false; // vector shuffles aren't supported >>> 2426: } >> >> Is it better to change this as an "asserti

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v4]

2023-03-22 Thread Quan Anh Mai
On Wed, 22 Mar 2023 07:59:40 GMT, Xiaohong Gong wrote: >> Quan Anh Mai has updated the pull request incrementally with one additional >> commit since the last revision: >> >> reviews > > src/hotspot/share/opto/vectorIntrinsics.cpp line 2059: > >> 2057: if (need_load_shuffle) { >> 2058:

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v3]

2023-03-22 Thread Quan Anh Mai
On Wed, 22 Mar 2023 08:09:03 GMT, Xiaohong Gong wrote: >> Quan Anh Mai has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - missing casts >> - clean up > > Please also update the copyright to 2023 for some touched files like > `vectorSupp

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v4]

2023-03-22 Thread Quan Anh Mai
> Hi, > > This patch reimplements `VectorShuffle` implementations to be a vector of the > bit type. Currently, VectorShuffle is stored as a byte array, and would be > expanded upon usage. This poses several drawbacks: > > 1. Inefficient conversions between a shuffle and its corresponding vector

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v3]

2023-03-22 Thread Xiaohong Gong
On Tue, 21 Mar 2023 16:16:31 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffic

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v3]

2023-03-22 Thread Xiaohong Gong
On Tue, 21 Mar 2023 16:16:31 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffic

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v3]

2023-03-22 Thread Xiaohong Gong
On Tue, 21 Mar 2023 16:16:31 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffic

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v2]

2023-03-21 Thread Quan Anh Mai
On Tue, 21 Mar 2023 16:29:44 GMT, Paul Sandoz wrote: >> I have moved most of the methods to `AbstractVector` and `AbstractShuffle`, >> I have to resort to raw types, though, since there seems to be no way to do >> the same with wild cards, and the generics mechanism is not powerful enough >> f

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v2]

2023-03-21 Thread Paul Sandoz
On Tue, 21 Mar 2023 16:11:50 GMT, Quan Anh Mai wrote: > Apart from the mask implementation, shuffle implementation definitely has to > take into consideration the element type. Yes, the way you have implemented shuffle is tightly connected, that looks ok. I am wondering if we can make the mask

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v2]

2023-03-21 Thread Paul Sandoz
On Tue, 21 Mar 2023 16:11:50 GMT, Quan Anh Mai wrote: > I have moved most of the methods to `AbstractVector` and `AbstractShuffle`, I > have to resort to raw types, though, since there seems to be no way to do the > same with wild cards, and the generics mechanism is not powerful enough for >

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v2]

2023-03-21 Thread Paul Sandoz
On Tue, 21 Mar 2023 10:18:19 GMT, Quan Anh Mai wrote: > Note that generics are erased, so from the VM point of view, a > `VectorMask` and a `VectorMask` is indifferent. Yes, that's the easy bit :-) The mask implementation is specialized by the species of vectors it operates on, but does it hav

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v2]

2023-03-21 Thread Quan Anh Mai
On Sun, 19 Mar 2023 19:38:04 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffic

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v2]

2023-03-21 Thread Paul Sandoz
On Sun, 19 Mar 2023 19:38:04 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1. Ineffic

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v3]

2023-03-21 Thread Quan Anh Mai
> Hi, > > This patch reimplements `VectorShuffle` implementations to be a vector of the > bit type. Currently, VectorShuffle is stored as a byte array, and would be > expanded upon usage. This poses several drawbacks: > > 1. Inefficient conversions between a shuffle and its corresponding vector

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v2]

2023-03-19 Thread Quan Anh Mai
> Hi, > > This patch reimplements `VectorShuffle` implementations to be a vector of the > bit type. Currently, VectorShuffle is stored as a byte array, and would be > expanded upon usage. This poses several drawbacks: > > 1. Inefficient conversions between a shuffle and its corresponding vector

RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation

2023-03-19 Thread Quan Anh Mai
Hi, This patch reimplements `VectorShuffle` implementations to be a vector of the bit type. Currently, VectorShuffle is stored as a byte array, and would be expanded upon usage. This poses several drawbacks: 1. Inefficient conversions between a shuffle and its corresponding vector. This hinder