Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange() [v2]

2023-02-09 Thread Xiaohong Gong
On Mon, 6 Feb 2023 17:39:42 GMT, Paul Sandoz wrote: >> Xiaohong Gong has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Add smaller array size for benchmark tests > > I think it would be useful to adjust the naming and comments of some meth

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange() [v3]

2023-02-09 Thread Paul Sandoz
On Tue, 7 Feb 2023 09:51:19 GMT, Xiaohong Gong wrote: >> The Vector API `"indexInRange(int offset, int limit)"` is used >> to compute a vector mask whose lanes are set to true if the >> index of the lane is inside the range specified by the `"offset"` >> and `"limit"` arguments, otherwise the lan

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange() [v2]

2023-02-08 Thread Xiaohong Gong
On Mon, 6 Feb 2023 17:39:42 GMT, Paul Sandoz wrote: >> Xiaohong Gong has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Add smaller array size for benchmark tests > > I think it would be useful to adjust the naming and comments of some meth

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange() [v3]

2023-02-07 Thread Xiaohong Gong
On Tue, 7 Feb 2023 09:51:19 GMT, Xiaohong Gong wrote: >> The Vector API `"indexInRange(int offset, int limit)"` is used >> to compute a vector mask whose lanes are set to true if the >> index of the lane is inside the range specified by the `"offset"` >> and `"limit"` arguments, otherwise the lan

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange() [v3]

2023-02-07 Thread Xiaohong Gong
> The Vector API `"indexInRange(int offset, int limit)"` is used > to compute a vector mask whose lanes are set to true if the > index of the lane is inside the range specified by the `"offset"` > and `"limit"` arguments, otherwise the lanes are set to false. > > There are two special cases for th

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange() [v2]

2023-02-06 Thread Xiaohong Gong
On Mon, 6 Feb 2023 17:39:42 GMT, Paul Sandoz wrote: >> Xiaohong Gong has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Add smaller array size for benchmark tests > > I think it would be useful to adjust the naming and comments of some meth

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange() [v2]

2023-02-06 Thread Paul Sandoz
On Fri, 3 Feb 2023 07:13:10 GMT, Xiaohong Gong wrote: >> The Vector API `"indexInRange(int offset, int limit)"` is used >> to compute a vector mask whose lanes are set to true if the >> index of the lane is inside the range specified by the `"offset"` >> and `"limit"` arguments, otherwise the lan

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange() [v2]

2023-02-05 Thread Xiaohong Gong
On Fri, 3 Feb 2023 02:03:14 GMT, Jatin Bhateja wrote: >> Xiaohong Gong has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Add smaller array size for benchmark tests > > LGTM Thanks for the review @jatin-bhateja @merykitty ! -

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange() [v2]

2023-02-03 Thread Quan Anh Mai
On Fri, 3 Feb 2023 07:13:10 GMT, Xiaohong Gong wrote: >> The Vector API `"indexInRange(int offset, int limit)"` is used >> to compute a vector mask whose lanes are set to true if the >> index of the lane is inside the range specified by the `"offset"` >> and `"limit"` arguments, otherwise the lan

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-02-02 Thread Xiaohong Gong
On Fri, 3 Feb 2023 02:54:32 GMT, Quan Anh Mai wrote: >> The Vector API `"indexInRange(int offset, int limit)"` is used >> to compute a vector mask whose lanes are set to true if the >> index of the lane is inside the range specified by the `"offset"` >> and `"limit"` arguments, otherwise the lane

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange() [v2]

2023-02-02 Thread Xiaohong Gong
> The Vector API `"indexInRange(int offset, int limit)"` is used > to compute a vector mask whose lanes are set to true if the > index of the lane is inside the range specified by the `"offset"` > and `"limit"` arguments, otherwise the lanes are set to false. > > There are two special cases for th

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-02-02 Thread Xiaohong Gong
On Wed, 18 Jan 2023 08:58:42 GMT, Xiaohong Gong wrote: > The Vector API `"indexInRange(int offset, int limit)"` is used > to compute a vector mask whose lanes are set to true if the > index of the lane is inside the range specified by the `"offset"` > and `"limit"` arguments, otherwise the lanes

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-02-02 Thread Quan Anh Mai
On Wed, 18 Jan 2023 08:58:42 GMT, Xiaohong Gong wrote: > The Vector API `"indexInRange(int offset, int limit)"` is used > to compute a vector mask whose lanes are set to true if the > index of the lane is inside the range specified by the `"offset"` > and `"limit"` arguments, otherwise the lanes

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-02-02 Thread Jatin Bhateja
On Wed, 18 Jan 2023 08:58:42 GMT, Xiaohong Gong wrote: > The Vector API `"indexInRange(int offset, int limit)"` is used > to compute a vector mask whose lanes are set to true if the > index of the lane is inside the range specified by the `"offset"` > and `"limit"` arguments, otherwise the lanes

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-02-02 Thread Xiaohong Gong
On Thu, 2 Feb 2023 18:07:59 GMT, Jatin Bhateja wrote: >> Hi, I modified a version by using the old implementation for the tail loop >> instead of adding the new intrinsics. The code looks like: >> >> public VectorMask indexInRange(int offset, int limit) { >> int vlength = length(); >>

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-02-02 Thread Jatin Bhateja
On Thu, 2 Feb 2023 08:15:14 GMT, Xiaohong Gong wrote: >> While you talked about Java side changes, I found another opportunity for >> optimization in checkIndex0 implementation, in the following code snippet >> from checkIndex0 method, indexLimit is guaranteed to be a +ve value. >> >> >>

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-02-02 Thread Xiaohong Gong
On Thu, 2 Feb 2023 06:38:58 GMT, Jatin Bhateja wrote: >>> Thanks for the review @jatin-bhateja ! >>> >>> > Have you tried introducing just case 3 (first) and then case 2 in >>> > existing indexInRange implementation. >>> >>> Yes, I tried with this way as well, together with the performance tes

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-02-01 Thread Jatin Bhateja
On Thu, 2 Feb 2023 03:42:34 GMT, Xiaohong Gong wrote: >> Your patch re-organized the code to take care of following cases :- >> 1. offset < 0 : Still falling over to old code. >> 2. offset >= limit : Special case optimized >> 3. (limit - offset) >=

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-02-01 Thread Xiaohong Gong
On Wed, 1 Feb 2023 14:20:05 GMT, Jatin Bhateja wrote: >> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractMask.java >> line 236: >> >>> 234: } else if (offset >= limit) { >>> 235: return vectorSpecies().maskAll(false); >>> 236: } else if (limit - o

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-02-01 Thread Xiaohong Gong
On Thu, 2 Feb 2023 01:59:09 GMT, Xiaohong Gong wrote: >> Your patch re-organized the code to take care of following cases :- >> 1. offset < 0 : Still falling over to old code. >> 2. offset >= limit : Special case optimized >> 3. (limit - offset) >=

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-02-01 Thread Xiaohong Gong
On Wed, 1 Feb 2023 14:20:05 GMT, Jatin Bhateja wrote: >> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractMask.java >> line 236: >> >>> 234: } else if (offset >= limit) { >>> 235: return vectorSpecies().maskAll(false); >>> 236: } else if (limit - o

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-02-01 Thread Xiaohong Gong
On Wed, 1 Feb 2023 13:22:07 GMT, Jatin Bhateja wrote: >> The Vector API `"indexInRange(int offset, int limit)"` is used >> to compute a vector mask whose lanes are set to true if the >> index of the lane is inside the range specified by the `"offset"` >> and `"limit"` arguments, otherwise the lan

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-02-01 Thread Jatin Bhateja
On Wed, 1 Feb 2023 12:30:36 GMT, Jatin Bhateja wrote: >> The Vector API `"indexInRange(int offset, int limit)"` is used >> to compute a vector mask whose lanes are set to true if the >> index of the lane is inside the range specified by the `"offset"` >> and `"limit"` arguments, otherwise the lan

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-02-01 Thread Jatin Bhateja
On Wed, 18 Jan 2023 08:58:42 GMT, Xiaohong Gong wrote: > The Vector API `"indexInRange(int offset, int limit)"` is used > to compute a vector mask whose lanes are set to true if the > index of the lane is inside the range specified by the `"offset"` > and `"limit"` arguments, otherwise the lanes

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-01-29 Thread Xiaohong Gong
On Wed, 18 Jan 2023 08:58:42 GMT, Xiaohong Gong wrote: > The Vector API `"indexInRange(int offset, int limit)"` is used > to compute a vector mask whose lanes are set to true if the > index of the lane is inside the range specified by the `"offset"` > and `"limit"` arguments, otherwise the lanes

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-01-18 Thread Xiaohong Gong
On Thu, 19 Jan 2023 03:51:28 GMT, Quan Anh Mai wrote: >> This "offset < 0" path can be optimized out by compiler if the "offset >= 0" >> in the common cases (i.e. normal loop with no tail loop). > > Yes but I don't think it is common enough to deserve special treatment. A > fast path should be

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-01-18 Thread Quan Anh Mai
On Thu, 19 Jan 2023 03:45:43 GMT, Xiaohong Gong wrote: >> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractMask.java >> line 219: >> >>> 217: @ForceInline >>> 218: public VectorMask indexInRange(int offset, int limit) { >>> 219: if (offset < 0) { >> >> These

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-01-18 Thread Xiaohong Gong
On Thu, 19 Jan 2023 03:37:33 GMT, Quan Anh Mai wrote: >> The Vector API `"indexInRange(int offset, int limit)"` is used >> to compute a vector mask whose lanes are set to true if the >> index of the lane is inside the range specified by the `"offset"` >> and `"limit"` arguments, otherwise the lan

Re: RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-01-18 Thread Quan Anh Mai
On Wed, 18 Jan 2023 08:58:42 GMT, Xiaohong Gong wrote: > The Vector API `"indexInRange(int offset, int limit)"` is used > to compute a vector mask whose lanes are set to true if the > index of the lane is inside the range specified by the `"offset"` > and `"limit"` arguments, otherwise the lanes

RFR: 8293198: [vectorapi] Improve the implementation of VectorMask.indexInRange()

2023-01-18 Thread Xiaohong Gong
The Vector API `"indexInRange(int offset, int limit)"` is used to compute a vector mask whose lanes are set to true if the index of the lane is inside the range specified by the `"offset"` and `"limit"` arguments, otherwise the lanes are set to false. There are two special cases for this API: 1)