Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v10]

2022-05-31 Thread Jatin Bhateja
On Wed, 25 May 2022 06:29:23 GMT, Jatin Bhateja  wrote:

>> Hi All,
>> 
>> Patch adds the planned support for new vector operations and APIs targeted 
>> for [JEP 426: Vector API (Fourth 
>> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
>> 
>> Following is the brief summary of changes:-
>> 
>> 1)  Extends the scope of existing lanewise API for following new vector 
>> operations.
>>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
>> bits
>>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
>> zero bits
>>- VectorOperations.REVERSE: reversing the order of bits
>>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>>- compress and expand bits: Semantics are based on Hacker's Delight 
>> section 7-4 Compress, or Generalized Extract.
>> 
>> 2)  Adds following new APIs to perform cross lane vector compress and 
>> expansion operations under the influence of a mask.
>>- Vector.compress
>>- Vector.expand 
>>- VectorMask.compress
>> 
>> 3) Adds predicated and non-predicated versions of following new APIs to load 
>> and store the contents of vector from foreign MemorySegments. 
>>   - Vector.fromMemorySegment
>>   - Vector.intoMemorySegment
>> 
>> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
>> for each newly added operation.
>> 
>> 
>>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
>> 
>>  Kindly review and share your feedback.
>> 
>>  Best Regards,
>>  Jatin
>
> Jatin Bhateja has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains 20 commits:
> 
>  - 8284960: Post merge cleanups.
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: Review comments resolved.
>  - 8284960: Integrating incremental patches.
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: Changes to enable jdk.incubator.vector to be treated as preview 
> participant. Code re-organization related to Reverse/ReverseByte IR 
> transforms.
>  - 8284960: Adding --enable-preview in vectorAPI benchmarks.
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: Review comments resolution.
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - ... and 10 more: 
> https://git.openjdk.java.net/jdk/compare/742644e2...0f6e1584

Thanks reviewers for your comments.

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v8]

2022-05-26 Thread Vladimir Kozlov
On Thu, 26 May 2022 06:19:40 GMT, Jatin Bhateja  wrote:

>> Yes.
>
>> @jatin-bhateja something wrong with merge. `vpadd()` is removed. It was 
>> added by #8778 and still is used in `x86.ad`.
> 
> Hi @vnkozlov , after integration of PR 8778 there were there were two copies 
> of vpadd with same signature, so removed one of them.

Okay. Got it.

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v10]

2022-05-26 Thread Vladimir Kozlov
On Wed, 25 May 2022 06:29:23 GMT, Jatin Bhateja  wrote:

>> Hi All,
>> 
>> Patch adds the planned support for new vector operations and APIs targeted 
>> for [JEP 426: Vector API (Fourth 
>> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
>> 
>> Following is the brief summary of changes:-
>> 
>> 1)  Extends the scope of existing lanewise API for following new vector 
>> operations.
>>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
>> bits
>>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
>> zero bits
>>- VectorOperations.REVERSE: reversing the order of bits
>>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>>- compress and expand bits: Semantics are based on Hacker's Delight 
>> section 7-4 Compress, or Generalized Extract.
>> 
>> 2)  Adds following new APIs to perform cross lane vector compress and 
>> expansion operations under the influence of a mask.
>>- Vector.compress
>>- Vector.expand 
>>- VectorMask.compress
>> 
>> 3) Adds predicated and non-predicated versions of following new APIs to load 
>> and store the contents of vector from foreign MemorySegments. 
>>   - Vector.fromMemorySegment
>>   - Vector.intoMemorySegment
>> 
>> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
>> for each newly added operation.
>> 
>> 
>>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
>> 
>>  Kindly review and share your feedback.
>> 
>>  Best Regards,
>>  Jatin
>
> Jatin Bhateja has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains 20 commits:
> 
>  - 8284960: Post merge cleanups.
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: Review comments resolved.
>  - 8284960: Integrating incremental patches.
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: Changes to enable jdk.incubator.vector to be treated as preview 
> participant. Code re-organization related to Reverse/ReverseByte IR 
> transforms.
>  - 8284960: Adding --enable-preview in vectorAPI benchmarks.
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: Review comments resolution.
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - ... and 10 more: 
> https://git.openjdk.java.net/jdk/compare/742644e2...0f6e1584

Good.

-

Marked as reviewed by kvn (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v8]

2022-05-25 Thread Jatin Bhateja
On Wed, 25 May 2022 06:25:53 GMT, Jatin Bhateja  wrote:

>> src/hotspot/cpu/x86/assembler_x86.cpp line 8173:
>> 
>>> 8171: 
>>> 8172: void Assembler::vinsertf32x4(XMMRegister dst, XMMRegister nds, 
>>> XMMRegister src, uint8_t imm8) {
>>> 8173:   assert(VM_Version::supports_evex(), "");
>> 
>> Hmm, did we never trigger this wrong assert because the use was guarded by 
>> correct check?
>
> Yes.

> @jatin-bhateja something wrong with merge. `vpadd()` is removed. It was added 
> by #8778 and still is used in `x86.ad`.

Hi @vnkozlov , after integration of PR 8778 there were there were two copies of 
vpadd with same signature, so removed one of them.

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v9]

2022-05-25 Thread Vladimir Kozlov
On Wed, 25 May 2022 06:29:06 GMT, Jatin Bhateja  wrote:

>> Jatin Bhateja has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   8284960: Review comments resolved.
>
> Hi @vnkozlov , Your comments have been addressed.

@jatin-bhateja something wrong with merge. `vpadd()` is removed. It was added 
by #8778 and still is used in `x86.ad`.

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v9]

2022-05-24 Thread Jatin Bhateja
On Wed, 25 May 2022 05:50:23 GMT, Jatin Bhateja  wrote:

>> Hi All,
>> 
>> Patch adds the planned support for new vector operations and APIs targeted 
>> for [JEP 426: Vector API (Fourth 
>> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
>> 
>> Following is the brief summary of changes:-
>> 
>> 1)  Extends the scope of existing lanewise API for following new vector 
>> operations.
>>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
>> bits
>>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
>> zero bits
>>- VectorOperations.REVERSE: reversing the order of bits
>>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>>- compress and expand bits: Semantics are based on Hacker's Delight 
>> section 7-4 Compress, or Generalized Extract.
>> 
>> 2)  Adds following new APIs to perform cross lane vector compress and 
>> expansion operations under the influence of a mask.
>>- Vector.compress
>>- Vector.expand 
>>- VectorMask.compress
>> 
>> 3) Adds predicated and non-predicated versions of following new APIs to load 
>> and store the contents of vector from foreign MemorySegments. 
>>   - Vector.fromMemorySegment
>>   - Vector.intoMemorySegment
>> 
>> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
>> for each newly added operation.
>> 
>> 
>>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
>> 
>>  Kindly review and share your feedback.
>> 
>>  Best Regards,
>>  Jatin
>
> Jatin Bhateja has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8284960: Review comments resolved.

Hi @vnkozlov , Your comments have been addressed.

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v8]

2022-05-24 Thread Jatin Bhateja
On Mon, 23 May 2022 22:17:40 GMT, Vladimir Kozlov  wrote:

>> Jatin Bhateja has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   8284960: Integrating incremental patches.
>
> src/hotspot/cpu/x86/assembler_x86.cpp line 8173:
> 
>> 8171: 
>> 8172: void Assembler::vinsertf32x4(XMMRegister dst, XMMRegister nds, 
>> XMMRegister src, uint8_t imm8) {
>> 8173:   assert(VM_Version::supports_evex(), "");
> 
> Hmm, did we never trigger this wrong assert because the use was guarded by 
> correct check?

Yes.

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v10]

2022-05-24 Thread Jatin Bhateja
> Hi All,
> 
> Patch adds the planned support for new vector operations and APIs targeted 
> for [JEP 426: Vector API (Fourth 
> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
> 
> Following is the brief summary of changes:-
> 
> 1)  Extends the scope of existing lanewise API for following new vector 
> operations.
>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
> bits
>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
> zero bits
>- VectorOperations.REVERSE: reversing the order of bits
>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>- compress and expand bits: Semantics are based on Hacker's Delight 
> section 7-4 Compress, or Generalized Extract.
> 
> 2)  Adds following new APIs to perform cross lane vector compress and 
> expansion operations under the influence of a mask.
>- Vector.compress
>- Vector.expand 
>- VectorMask.compress
> 
> 3) Adds predicated and non-predicated versions of following new APIs to load 
> and store the contents of vector from foreign MemorySegments. 
>   - Vector.fromMemorySegment
>   - Vector.intoMemorySegment
> 
> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
> for each newly added operation.
> 
> 
>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
> 
>  Kindly review and share your feedback.
> 
>  Best Regards,
>  Jatin

Jatin Bhateja has updated the pull request with a new target base due to a 
merge or a rebase. The pull request now contains 20 commits:

 - 8284960: Post merge cleanups.
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - 8284960: Review comments resolved.
 - 8284960: Integrating incremental patches.
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - 8284960: Changes to enable jdk.incubator.vector to be treated as preview 
participant. Code re-organization related to Reverse/ReverseByte IR transforms.
 - 8284960: Adding --enable-preview in vectorAPI benchmarks.
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - 8284960: Review comments resolution.
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - ... and 10 more: https://git.openjdk.java.net/jdk/compare/742644e2...0f6e1584

-

Changes: https://git.openjdk.java.net/jdk/pull/8425/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8425&range=09
  Stats: 38021 lines in 228 files changed: 16652 ins; 16924 del; 4445 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8425.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8425/head:pull/8425

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v9]

2022-05-24 Thread Jatin Bhateja
> Hi All,
> 
> Patch adds the planned support for new vector operations and APIs targeted 
> for [JEP 426: Vector API (Fourth 
> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
> 
> Following is the brief summary of changes:-
> 
> 1)  Extends the scope of existing lanewise API for following new vector 
> operations.
>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
> bits
>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
> zero bits
>- VectorOperations.REVERSE: reversing the order of bits
>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>- compress and expand bits: Semantics are based on Hacker's Delight 
> section 7-4 Compress, or Generalized Extract.
> 
> 2)  Adds following new APIs to perform cross lane vector compress and 
> expansion operations under the influence of a mask.
>- Vector.compress
>- Vector.expand 
>- VectorMask.compress
> 
> 3) Adds predicated and non-predicated versions of following new APIs to load 
> and store the contents of vector from foreign MemorySegments. 
>   - Vector.fromMemorySegment
>   - Vector.intoMemorySegment
> 
> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
> for each newly added operation.
> 
> 
>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
> 
>  Kindly review and share your feedback.
> 
>  Best Regards,
>  Jatin

Jatin Bhateja has updated the pull request incrementally with one additional 
commit since the last revision:

  8284960: Review comments resolved.

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8425/files
  - new: https://git.openjdk.java.net/jdk/pull/8425/files/17a0e38c..a2c9673d

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8425&range=08
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8425&range=07-08

  Stats: 110 lines in 7 files changed: 42 ins; 31 del; 37 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8425.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8425/head:pull/8425

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v8]

2022-05-23 Thread Vladimir Kozlov
On Fri, 20 May 2022 09:51:24 GMT, Jatin Bhateja  wrote:

>> Hi All,
>> 
>> Patch adds the planned support for new vector operations and APIs targeted 
>> for [JEP 426: Vector API (Fourth 
>> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
>> 
>> Following is the brief summary of changes:-
>> 
>> 1)  Extends the scope of existing lanewise API for following new vector 
>> operations.
>>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
>> bits
>>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
>> zero bits
>>- VectorOperations.REVERSE: reversing the order of bits
>>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>>- compress and expand bits: Semantics are based on Hacker's Delight 
>> section 7-4 Compress, or Generalized Extract.
>> 
>> 2)  Adds following new APIs to perform cross lane vector compress and 
>> expansion operations under the influence of a mask.
>>- Vector.compress
>>- Vector.expand 
>>- VectorMask.compress
>> 
>> 3) Adds predicated and non-predicated versions of following new APIs to load 
>> and store the contents of vector from foreign MemorySegments. 
>>   - Vector.fromMemorySegment
>>   - Vector.intoMemorySegment
>> 
>> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
>> for each newly added operation.
>> 
>> 
>>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
>> 
>>  Kindly review and share your feedback.
>> 
>>  Best Regards,
>>  Jatin
>
> Jatin Bhateja has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8284960: Integrating incremental patches.

src/hotspot/cpu/x86/assembler_x86.cpp line 7934:

> 7932: 
> 7933: void Assembler::evplzcntd(XMMRegister dst, KRegister mask, XMMRegister 
> src, bool merge, int vector_len) {
> 7934:   assert(VM_Version::supports_avx512cd() && (vector_len == AVX_512bit 
> || VM_Version::supports_avx512vl()), "");

Please, split assert as in other instructions - it will help to understand 
failure better.

src/hotspot/cpu/x86/assembler_x86.cpp line 7946:

> 7944: 
> 7945: void Assembler::evplzcntq(XMMRegister dst, KRegister mask, XMMRegister 
> src, bool merge, int vector_len) {
> 7946:   assert(VM_Version::supports_avx512cd() && (vector_len == AVX_512bit 
> || VM_Version::supports_avx512vl()), "");

Split assert.

src/hotspot/cpu/x86/assembler_x86.cpp line 8173:

> 8171: 
> 8172: void Assembler::vinsertf32x4(XMMRegister dst, XMMRegister nds, 
> XMMRegister src, uint8_t imm8) {
> 8173:   assert(VM_Version::supports_evex(), "");

Hmm, did we never trigger this wrong assert because the use was guarded by 
correct check?

src/hotspot/cpu/x86/assembler_x86.cpp line 11720:

> 11718: 
> 11719: void Assembler::evpcompressb(XMMRegister dst, KRegister mask, 
> XMMRegister src, bool merge, int vector_len) {
> 11720:   assert(VM_Version::supports_avx512_vbmi2() && (vector_len == 
> AVX_512bit || VM_Version::supports_avx512vl()), "");

Split assert in this and following new instructions.

src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 4455:

> 4453:   break;
> 4454: default:
> 4455:   fatal("Unsupported type");

Print wrong type: `fatal("Unsupported type : %s", type2name(type));`
Below too.

src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 4561:

> 4559:   case 4 : evpbroadcastd(dst, rtmp, vec_enc); break;
> 4560:   case 8 : evpbroadcastq(dst, rtmp, vec_enc); break;
> 4561:   default : ShouldNotReachHere(); break;

`ShouldNotReachHere` does not give any information in case of failure. Use 
`fatal()` which prints wrong `lane_size`.
Same below.

src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 4666:

> 4664:   break;
> 4665: default:
> 4666:   ShouldNotReachHere();

Use `fatal()`.

src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 4693:

> 4691:   break;
> 4692: default:
> 4693:   ShouldNotReachHere();

Use `fatal()`.

src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 4732:

> 4730: vector_reverse_byte(bt, dst, xtmp2, rtmp, vec_enc);
> 4731: 
> 4732:   } else if(!VM_Version::supports_avx512vlbw() && vec_enc == 
> Assembler::AVX_512bit) {

No need to check `!VM_Version::supports_avx512vlbw()`.

src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 4759:

> 4757: vpandn(xtmp2, xtmp2, xtmp1, vec_enc);
> 4758: vpsrlq(xtmp2, xtmp2, 1, vec_enc);
> 4759: vporq(xtmp1, dst, xtmp2, vec_enc);

All 3 code snippets are the same except constants. Also similar code in 
`vector_reverse_byte64` for `short` type.
Consider factoring out it into separate method.

src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 4819:

> 4817:   break;
> 4818: default:
> 4819:   fatal("Unsupported type");

Print wring type.

src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 4846:

> 4844:   break;
> 4845: default:
> 4846:   fatal("Un

Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v8]

2022-05-23 Thread Vladimir Ivanov
On Fri, 20 May 2022 09:51:24 GMT, Jatin Bhateja  wrote:

>> Hi All,
>> 
>> Patch adds the planned support for new vector operations and APIs targeted 
>> for [JEP 426: Vector API (Fourth 
>> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
>> 
>> Following is the brief summary of changes:-
>> 
>> 1)  Extends the scope of existing lanewise API for following new vector 
>> operations.
>>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
>> bits
>>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
>> zero bits
>>- VectorOperations.REVERSE: reversing the order of bits
>>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>>- compress and expand bits: Semantics are based on Hacker's Delight 
>> section 7-4 Compress, or Generalized Extract.
>> 
>> 2)  Adds following new APIs to perform cross lane vector compress and 
>> expansion operations under the influence of a mask.
>>- Vector.compress
>>- Vector.expand 
>>- VectorMask.compress
>> 
>> 3) Adds predicated and non-predicated versions of following new APIs to load 
>> and store the contents of vector from foreign MemorySegments. 
>>   - Vector.fromMemorySegment
>>   - Vector.intoMemorySegment
>> 
>> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
>> for each newly added operation.
>> 
>> 
>>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
>> 
>>  Kindly review and share your feedback.
>> 
>>  Best Regards,
>>  Jatin
>
> Jatin Bhateja has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8284960: Integrating incremental patches.

Looks good!

-

Marked as reviewed by vlivanov (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v3]

2022-05-23 Thread Jatin Bhateja
On Thu, 12 May 2022 23:56:49 GMT, Vladimir Ivanov  wrote:

>> Jatin Bhateja has updated the pull request with a new target base due to a 
>> merge or a rebase. The pull request now contains 11 commits:
>> 
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - 8284960: Correcting a typo.
>>  - 8284960: Integrating changes from panama-vector (Add @since 19 tags).
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - 8284960: AARCH64 backend changes.
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - ... and 1 more: 
>> https://git.openjdk.java.net/jdk/compare/3fa1c404...b021e082
>
> Overall, looks good.
> 
> Some minor questions/suggestions follow.

Hi @iwanowww , your comments have been addressed. kindly let me know if you 
have other comments on x86 side changes.

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v8]

2022-05-20 Thread Jan Lahoda
On Fri, 20 May 2022 09:51:24 GMT, Jatin Bhateja  wrote:

>> Hi All,
>> 
>> Patch adds the planned support for new vector operations and APIs targeted 
>> for [JEP 426: Vector API (Fourth 
>> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
>> 
>> Following is the brief summary of changes:-
>> 
>> 1)  Extends the scope of existing lanewise API for following new vector 
>> operations.
>>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
>> bits
>>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
>> zero bits
>>- VectorOperations.REVERSE: reversing the order of bits
>>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>>- compress and expand bits: Semantics are based on Hacker's Delight 
>> section 7-4 Compress, or Generalized Extract.
>> 
>> 2)  Adds following new APIs to perform cross lane vector compress and 
>> expansion operations under the influence of a mask.
>>- Vector.compress
>>- Vector.expand 
>>- VectorMask.compress
>> 
>> 3) Adds predicated and non-predicated versions of following new APIs to load 
>> and store the contents of vector from foreign MemorySegments. 
>>   - Vector.fromMemorySegment
>>   - Vector.intoMemorySegment
>> 
>> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
>> for each newly added operation.
>> 
>> 
>>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
>> 
>>  Kindly review and share your feedback.
>> 
>>  Best Regards,
>>  Jatin
>
> Jatin Bhateja has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8284960: Integrating incremental patches.

The javac changes look OK to me.

-

Marked as reviewed by jlahoda (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v8]

2022-05-20 Thread Maurizio Cimadamore
On Fri, 20 May 2022 09:51:24 GMT, Jatin Bhateja  wrote:

>> Hi All,
>> 
>> Patch adds the planned support for new vector operations and APIs targeted 
>> for [JEP 426: Vector API (Fourth 
>> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
>> 
>> Following is the brief summary of changes:-
>> 
>> 1)  Extends the scope of existing lanewise API for following new vector 
>> operations.
>>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
>> bits
>>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
>> zero bits
>>- VectorOperations.REVERSE: reversing the order of bits
>>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>>- compress and expand bits: Semantics are based on Hacker's Delight 
>> section 7-4 Compress, or Generalized Extract.
>> 
>> 2)  Adds following new APIs to perform cross lane vector compress and 
>> expansion operations under the influence of a mask.
>>- Vector.compress
>>- Vector.expand 
>>- VectorMask.compress
>> 
>> 3) Adds predicated and non-predicated versions of following new APIs to load 
>> and store the contents of vector from foreign MemorySegments. 
>>   - Vector.fromMemorySegment
>>   - Vector.intoMemorySegment
>> 
>> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
>> for each newly added operation.
>> 
>> 
>>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
>> 
>>  Kindly review and share your feedback.
>> 
>>  Best Regards,
>>  Jatin
>
> Jatin Bhateja has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8284960: Integrating incremental patches.

Javac changes look good

-

Marked as reviewed by mcimadamore (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v7]

2022-05-20 Thread Jatin Bhateja
On Thu, 19 May 2022 21:19:49 GMT, Paul Sandoz  wrote:

>> Jatin Bhateja has updated the pull request with a new target base due to a 
>> merge or a rebase. The pull request now contains 16 commits:
>> 
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - 8284960: Changes to enable jdk.incubator.vector to be treated as preview 
>> participant. Code re-organization related to Reverse/ReverseByte IR 
>> transforms.
>>  - 8284960: Adding --enable-preview in vectorAPI benchmarks.
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - 8284960: Review comments resolution.
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - 8284960: Correcting a typo.
>>  - 8284960: Integrating changes from panama-vector (Add @since 19 tags).
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - ... and 6 more: 
>> https://git.openjdk.java.net/jdk/compare/9f562ef7...311f3233
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java line 50:
> 
>> 48: import java.util.Set;
>> 49: 
>> 50: import static com.sun.tools.javac.code.Flags.PREVIEW_API;
> 
> Suggestion:
> 
> 
> Redundant import (sorry i should have checked before i sent you updates to 
> this area)

Merged

> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java line 132:
> 
>> 130:  * @return true if {@code s} is participating in the preview of 
>> {@code previewSymbol}
>> 131:  */
>> 132: public boolean isPreviewParticipating(Symbol s, Symbol 
>> previewSymbol) {
> 
> Some feedback from a colleague:
> Suggestion:
> 
> /**
>  * Returns true if {@code s} is deemed to participate in the preview of 
> {@code previewSymbol}, and
>  * therefore no warnings or errors will be produced.
>  *
>  * @param s the symbol depending on the preview symbol
>  * @param previewSymbol the preview symbol marked with @Preview
>  * @return true if {@code s} is participating in the preview of {@code 
> previewSymbol}
>  */
> public boolean participatesInPreview(Symbol s, Symbol previewSymbol) {

Merged.

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v8]

2022-05-20 Thread Jatin Bhateja
> Hi All,
> 
> Patch adds the planned support for new vector operations and APIs targeted 
> for [JEP 426: Vector API (Fourth 
> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
> 
> Following is the brief summary of changes:-
> 
> 1)  Extends the scope of existing lanewise API for following new vector 
> operations.
>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
> bits
>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
> zero bits
>- VectorOperations.REVERSE: reversing the order of bits
>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>- compress and expand bits: Semantics are based on Hacker's Delight 
> section 7-4 Compress, or Generalized Extract.
> 
> 2)  Adds following new APIs to perform cross lane vector compress and 
> expansion operations under the influence of a mask.
>- Vector.compress
>- Vector.expand 
>- VectorMask.compress
> 
> 3) Adds predicated and non-predicated versions of following new APIs to load 
> and store the contents of vector from foreign MemorySegments. 
>   - Vector.fromMemorySegment
>   - Vector.intoMemorySegment
> 
> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
> for each newly added operation.
> 
> 
>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
> 
>  Kindly review and share your feedback.
> 
>  Best Regards,
>  Jatin

Jatin Bhateja has updated the pull request incrementally with one additional 
commit since the last revision:

  8284960: Integrating incremental patches.

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8425/files
  - new: https://git.openjdk.java.net/jdk/pull/8425/files/311f3233..17a0e38c

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8425&range=07
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8425&range=06-07

  Stats: 32 lines in 7 files changed: 0 ins; 26 del; 6 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8425.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8425/head:pull/8425

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v7]

2022-05-19 Thread Paul Sandoz
On Thu, 19 May 2022 21:11:41 GMT, Jatin Bhateja  wrote:

>> Hi All,
>> 
>> Patch adds the planned support for new vector operations and APIs targeted 
>> for [JEP 426: Vector API (Fourth 
>> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
>> 
>> Following is the brief summary of changes:-
>> 
>> 1)  Extends the scope of existing lanewise API for following new vector 
>> operations.
>>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
>> bits
>>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
>> zero bits
>>- VectorOperations.REVERSE: reversing the order of bits
>>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>>- compress and expand bits: Semantics are based on Hacker's Delight 
>> section 7-4 Compress, or Generalized Extract.
>> 
>> 2)  Adds following new APIs to perform cross lane vector compress and 
>> expansion operations under the influence of a mask.
>>- Vector.compress
>>- Vector.expand 
>>- VectorMask.compress
>> 
>> 3) Adds predicated and non-predicated versions of following new APIs to load 
>> and store the contents of vector from foreign MemorySegments. 
>>   - Vector.fromMemorySegment
>>   - Vector.intoMemorySegment
>> 
>> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
>> for each newly added operation.
>> 
>> 
>>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
>> 
>>  Kindly review and share your feedback.
>> 
>>  Best Regards,
>>  Jatin
>
> Jatin Bhateja has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains 16 commits:
> 
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: Changes to enable jdk.incubator.vector to be treated as preview 
> participant. Code re-organization related to Reverse/ReverseByte IR 
> transforms.
>  - 8284960: Adding --enable-preview in vectorAPI benchmarks.
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: Review comments resolution.
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: Correcting a typo.
>  - 8284960: Integrating changes from panama-vector (Add @since 19 tags).
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - ... and 6 more: 
> https://git.openjdk.java.net/jdk/compare/9f562ef7...311f3233

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java line 132:

> 130:  * @return true if {@code s} is participating in the preview of 
> {@code previewSymbol}
> 131:  */
> 132: public boolean isPreviewParticipating(Symbol s, Symbol 
> previewSymbol) {

Some feedback from a colleague:
Suggestion:

/**
 * Returns true if {@code s} is deemed to participate in the preview of 
{@code previewSymbol}, and
 * therefore no warnings or errors will be produced.
 *
 * @param s the symbol depending on the preview symbol
 * @param previewSymbol the preview symbol marked with @Preview
 * @return true if {@code s} is participating in the preview of {@code 
previewSymbol}
 */
public boolean participatesInPreview(Symbol s, Symbol previewSymbol) {

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v7]

2022-05-19 Thread Paul Sandoz
On Thu, 19 May 2022 21:11:41 GMT, Jatin Bhateja  wrote:

>> Hi All,
>> 
>> Patch adds the planned support for new vector operations and APIs targeted 
>> for [JEP 426: Vector API (Fourth 
>> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
>> 
>> Following is the brief summary of changes:-
>> 
>> 1)  Extends the scope of existing lanewise API for following new vector 
>> operations.
>>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
>> bits
>>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
>> zero bits
>>- VectorOperations.REVERSE: reversing the order of bits
>>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>>- compress and expand bits: Semantics are based on Hacker's Delight 
>> section 7-4 Compress, or Generalized Extract.
>> 
>> 2)  Adds following new APIs to perform cross lane vector compress and 
>> expansion operations under the influence of a mask.
>>- Vector.compress
>>- Vector.expand 
>>- VectorMask.compress
>> 
>> 3) Adds predicated and non-predicated versions of following new APIs to load 
>> and store the contents of vector from foreign MemorySegments. 
>>   - Vector.fromMemorySegment
>>   - Vector.intoMemorySegment
>> 
>> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
>> for each newly added operation.
>> 
>> 
>>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
>> 
>>  Kindly review and share your feedback.
>> 
>>  Best Regards,
>>  Jatin
>
> Jatin Bhateja has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains 16 commits:
> 
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: Changes to enable jdk.incubator.vector to be treated as preview 
> participant. Code re-organization related to Reverse/ReverseByte IR 
> transforms.
>  - 8284960: Adding --enable-preview in vectorAPI benchmarks.
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: Review comments resolution.
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: Correcting a typo.
>  - 8284960: Integrating changes from panama-vector (Add @since 19 tags).
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - ... and 6 more: 
> https://git.openjdk.java.net/jdk/compare/9f562ef7...311f3233

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java line 50:

> 48: import java.util.Set;
> 49: 
> 50: import static com.sun.tools.javac.code.Flags.PREVIEW_API;

Suggestion:


Redundant import (sorry i should have checked before i sent you updates to this 
area)

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v3]

2022-05-19 Thread Jatin Bhateja
On Thu, 19 May 2022 15:33:49 GMT, Jatin Bhateja  wrote:

>> Do you mean it's important to apply the transformation at the right node 
>> (pick the right node as the root) and it is hard to make a decision during 
>> GVN?
>
> Yes, that what I meant, but with recently added 
> Node::Flag_is_predicated_using_blend it could be possible to move this 
> transformation ahead into idealization routines of reverse/reverse bytes IR 
> nodes.

Addressed this after internally discussing with Sandhya. Moved the transforms 
from final graph re-shaping back to vector intrinsic routines.

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v7]

2022-05-19 Thread Jatin Bhateja
> Hi All,
> 
> Patch adds the planned support for new vector operations and APIs targeted 
> for [JEP 426: Vector API (Fourth 
> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
> 
> Following is the brief summary of changes:-
> 
> 1)  Extends the scope of existing lanewise API for following new vector 
> operations.
>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
> bits
>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
> zero bits
>- VectorOperations.REVERSE: reversing the order of bits
>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>- compress and expand bits: Semantics are based on Hacker's Delight 
> section 7-4 Compress, or Generalized Extract.
> 
> 2)  Adds following new APIs to perform cross lane vector compress and 
> expansion operations under the influence of a mask.
>- Vector.compress
>- Vector.expand 
>- VectorMask.compress
> 
> 3) Adds predicated and non-predicated versions of following new APIs to load 
> and store the contents of vector from foreign MemorySegments. 
>   - Vector.fromMemorySegment
>   - Vector.intoMemorySegment
> 
> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
> for each newly added operation.
> 
> 
>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
> 
>  Kindly review and share your feedback.
> 
>  Best Regards,
>  Jatin

Jatin Bhateja has updated the pull request with a new target base due to a 
merge or a rebase. The pull request now contains 16 commits:

 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - 8284960: Changes to enable jdk.incubator.vector to be treated as preview 
participant. Code re-organization related to Reverse/ReverseByte IR transforms.
 - 8284960: Adding --enable-preview in vectorAPI benchmarks.
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - 8284960: Review comments resolution.
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - 8284960: Correcting a typo.
 - 8284960: Integrating changes from panama-vector (Add @since 19 tags).
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - ... and 6 more: https://git.openjdk.java.net/jdk/compare/9f562ef7...311f3233

-

Changes: https://git.openjdk.java.net/jdk/pull/8425/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8425&range=06
  Stats: 38049 lines in 228 files changed: 16683 ins; 16923 del; 4443 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8425.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8425/head:pull/8425

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v3]

2022-05-19 Thread Jatin Bhateja
On Wed, 18 May 2022 23:35:54 GMT, Vladimir Ivanov  wrote:

>> It was an attempt to facilitate in-lining of these APIs over targets which 
>> do not intrinsify them. I agree its not a generic fix since three APIs are 
>> piggybacking on same entry point and without the knowledge of opcode it will 
>> be inappropriate to take any call at this place, lazy intrinsification gives 
>> opportunity for some of the predications to concertize as compilation 
>> happens under closed world assumptions.
>
> Still not clear why the code is shaped the way it is.
> 
> `Matcher::match_rule_supported_vector()` already checks that there are 
> relevant matching rules.
> 
> The checks require both `CompressM` and `CompressV` to be present to enable 
> the intrinsic. Is it important?
> 
> Also, it doesn't take `EnableVectorSupport` into account while all other 
> vector intrinsics respect it.

Yes, the code was modified to accommodate your comments. 
https://github.com/openjdk/jdk/pull/8425/files#diff-a9dd7e411772c1ee37b54c5ab868a01fe82af905758350f0ba1c370f422c3fe6R718

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v3]

2022-05-19 Thread Jatin Bhateja
On Wed, 18 May 2022 23:28:22 GMT, Vladimir Ivanov  wrote:

>> Its more of a chicken-egg problem here, for masked reverse operation, 
>> Reverse IR node is followed by a Blend Node, thus in such a case doing an 
>> eager Identity transform in Reverse::Identity will not work, also deferring 
>> this to blend may also not work since it could be a non-masked reverse 
>> operation, we could have handled it as a special case in 
>> inline_vector_nary_operation, but handling such special case in final graph 
>> reshaping looked more appropriate.
>> 
>> https://github.com/openjdk/panama-vector/pull/182#discussion_r845678080
>
> Do you mean it's important to apply the transformation at the right node 
> (pick the right node as the root) and it is hard to make a decision during 
> GVN?

Yes, that what I meant.

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v6]

2022-05-19 Thread Xiaohong Gong
On Thu, 19 May 2022 08:53:31 GMT, Ningsheng Jian  wrote:

>>> LUT should be generated only if UsePopCountInsturction is false 
>> 
>> Should there be `!UsePopCountInsturction` check then?
>> 
>>> restrict the scope of flag to only scalar popcount operation
>> 
>> Interesting. But AArch64 code does cover vector cases which just adds 
>> confusion.
>
>> Interesting. But AArch64 code does cover vector cases which just adds 
>> confusion.
> 
> `UsePopCountInsturction` is always true in AArch64. @XiaohongGong removed the 
> `predicate` in aarch64 rules, and I think we can even remove the option check 
> in match_rule_supported().

Ok , I will remove the check for it. Thanks!

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v6]

2022-05-19 Thread Ningsheng Jian
On Wed, 18 May 2022 23:22:42 GMT, Vladimir Ivanov  wrote:

> Interesting. But AArch64 code does cover vector cases which just adds 
> confusion.

`UsePopCountInsturction` is always true in AArch64. @XiaohongGong removed the 
`predicate` in aarch64 rules, and I think we can even remove the option check 
in match_rule_supported().

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v3]

2022-05-18 Thread Vladimir Ivanov
On Fri, 13 May 2022 08:24:24 GMT, Jatin Bhateja  wrote:

>> src/hotspot/share/opto/c2compiler.cpp line 521:
>> 
>>> 519: if (!Matcher::match_rule_supported(Op_SignumF)) return false;
>>> 520: break;
>>> 521:   case vmIntrinsics::_VectorComExp:
>> 
>> Why `_VectorComExp` intrinsic is special? Other vector intrinsics are 
>> handled later and in a different manner.
>> 
>> What about `ExpandV` case?
>
> It was an attempt to facilitate in-lining of these APIs over targets which do 
> not intrinsify them. I agree its not a generic fix since three APIs are 
> piggybacking on same entry point and without the knowledge of opcode it will 
> be inappropriate to take any call at this place, lazy intrinsification gives 
> opportunity for some of the predications to concertize as compilation happens 
> under closed world assumptions.

Still not clear why the code is shaped the way it is.

`Matcher::match_rule_supported_vector()` already checks that there are relevant 
matching rules.

The checks require both `CompressM` and `CompressV` to be present to enable the 
intrinsic. Is it important?

Also, it doesn't take `EnableVectorSupport` into account while all other vector 
intrinsics respect it.

>> src/hotspot/share/opto/compile.cpp line 3416:
>> 
>>> 3414: 
>>> 3415:   case Op_ReverseBytesV:
>>> 3416:   case Op_ReverseV: {
>> 
>> Can you elaborate, please, why it is performed so late in the optimization 
>> phase (at the very end during graph reshaping) and not during GVN?
>
> Its more of a chicken-egg problem here, for masked reverse operation, Reverse 
> IR node is followed by a Blend Node, thus in such a case doing an eager 
> Identity transform in Reverse::Identity will not work, also deferring this to 
> blend may also not work since it could be a non-masked reverse operation, we 
> could have handled it as a special case in inline_vector_nary_operation, but 
> handling such special case in final graph reshaping looked more appropriate.
> 
> https://github.com/openjdk/panama-vector/pull/182#discussion_r845678080

Do you mean it's important to apply the transformation at the right node (pick 
the right node as the root) and it is hard to make a decision during GVN?

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v6]

2022-05-18 Thread Vladimir Ivanov
On Fri, 13 May 2022 08:24:21 GMT, Jatin Bhateja  wrote:

> LUT should be generated only if UsePopCountInsturction is false 

Should there be `!UsePopCountInsturction` check then?

> restrict the scope of flag to only scalar popcount operation

Interesting. But AArch64 code does cover vector cases which just adds confusion.

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v6]

2022-05-17 Thread Jatin Bhateja
> Hi All,
> 
> Patch adds the planned support for new vector operations and APIs targeted 
> for [JEP 426: Vector API (Fourth 
> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
> 
> Following is the brief summary of changes:-
> 
> 1)  Extends the scope of existing lanewise API for following new vector 
> operations.
>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
> bits
>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
> zero bits
>- VectorOperations.REVERSE: reversing the order of bits
>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>- compress and expand bits: Semantics are based on Hacker's Delight 
> section 7-4 Compress, or Generalized Extract.
> 
> 2)  Adds following new APIs to perform cross lane vector compress and 
> expansion operations under the influence of a mask.
>- Vector.compress
>- Vector.expand 
>- VectorMask.compress
> 
> 3) Adds predicated and non-predicated versions of following new APIs to load 
> and store the contents of vector from foreign MemorySegments. 
>   - Vector.fromMemorySegment
>   - Vector.intoMemorySegment
> 
> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
> for each newly added operation.
> 
> 
>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
> 
>  Kindly review and share your feedback.
> 
>  Best Regards,
>  Jatin

Jatin Bhateja has updated the pull request incrementally with one additional 
commit since the last revision:

  8284960: Adding --enable-preview in vectorAPI benchmarks.

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8425/files
  - new: https://git.openjdk.java.net/jdk/pull/8425/files/df7eb90e..0b7f84bb

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8425&range=05
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8425&range=04-05

  Stats: 21 lines in 10 files changed: 7 ins; 4 del; 10 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8425.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8425/head:pull/8425

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v5]

2022-05-17 Thread Jatin Bhateja
> Hi All,
> 
> Patch adds the planned support for new vector operations and APIs targeted 
> for [JEP 426: Vector API (Fourth 
> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
> 
> Following is the brief summary of changes:-
> 
> 1)  Extends the scope of existing lanewise API for following new vector 
> operations.
>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
> bits
>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
> zero bits
>- VectorOperations.REVERSE: reversing the order of bits
>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>- compress and expand bits: Semantics are based on Hacker's Delight 
> section 7-4 Compress, or Generalized Extract.
> 
> 2)  Adds following new APIs to perform cross lane vector compress and 
> expansion operations under the influence of a mask.
>- Vector.compress
>- Vector.expand 
>- VectorMask.compress
> 
> 3) Adds predicated and non-predicated versions of following new APIs to load 
> and store the contents of vector from foreign MemorySegments. 
>   - Vector.fromMemorySegment
>   - Vector.intoMemorySegment
> 
> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
> for each newly added operation.
> 
> 
>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
> 
>  Kindly review and share your feedback.
> 
>  Best Regards,
>  Jatin

Jatin Bhateja has updated the pull request with a new target base due to a 
merge or a rebase. The pull request now contains 13 commits:

 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - 8284960: Review comments resolution.
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - 8284960: Correcting a typo.
 - 8284960: Integrating changes from panama-vector (Add @since 19 tags).
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - 8284960: AARCH64 backend changes.
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - ... and 3 more: https://git.openjdk.java.net/jdk/compare/5e5500cb...df7eb90e

-

Changes: https://git.openjdk.java.net/jdk/pull/8425/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8425&range=04
  Stats: 38068 lines in 254 files changed: 16705 ins; 16921 del; 4442 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8425.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8425/head:pull/8425

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v4]

2022-05-13 Thread Jatin Bhateja
On Thu, 12 May 2022 22:48:26 GMT, Vladimir Ivanov  wrote:

>> Jatin Bhateja has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   8284960: Review comments resolution.
>
> src/hotspot/cpu/x86/stubGenerator_x86_64.cpp line 7953:
> 
>> 7951: StubRoutines::x86::_vector_iota_indices = 
>> generate_iota_indices("iota_indices");
>> 7952: 
>> 7953: if (UsePopCountInstruction && VM_Version::supports_avx2() && 
>> !VM_Version::supports_avx512_vpopcntdq()) {
> 
> Why is the LUT unconditionally generated? `UsePopCountInstruction` still 
> guides the usages.

LUT should be generated only if UsePopCountInsturction is false and iff target 
does not support necessary features, AVX512POPCNTDQ (for int/long vectors)  and 
AVX512_BITALG (for sub-word vectors).  Please refer to following discussion 
where it was suggested to restrict the scope of flag to only scalar popcount 
operation. 
https://github.com/openjdk/panama-vector/pull/185#discussion_r847758463

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v3]

2022-05-13 Thread Jatin Bhateja
On Thu, 12 May 2022 22:40:50 GMT, Vladimir Ivanov  wrote:

>> Jatin Bhateja has updated the pull request with a new target base due to a 
>> merge or a rebase. The pull request now contains 11 commits:
>> 
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - 8284960: Correcting a typo.
>>  - 8284960: Integrating changes from panama-vector (Add @since 19 tags).
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - 8284960: AARCH64 backend changes.
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>>  - ... and 1 more: 
>> https://git.openjdk.java.net/jdk/compare/3fa1c404...b021e082
>
> src/hotspot/cpu/x86/matcher_x86.hpp line 195:
> 
>> 193:   case Op_PopCountVI:
>> 194: return ((ety == T_INT && 
>> VM_Version::supports_avx512_vpopcntdq()) ||
>> 195:(is_subword_type(ety) && 
>> VM_Version::supports_avx512_bitalg())) ? 0 : 50;
> 
> Should be easier to read when the condition is split. E.g.:
> 
> if (is_subword_type(ety)) {
>   return VM_Version::supports_avx512_bitalg())) ? 0 : 50;
> } else {
>   assert(ety == T_INT, "sanity"); // for documentation purposes
>   return VM_Version::supports_avx512_vpopcntdq() ? 0 : 50;
> }

DONE

> src/hotspot/cpu/x86/vm_version_x86.hpp line 375:
> 
>> 373: decl(RDTSCP,"rdtscp",48) /* RDTSCP 
>> instruction */ \
>> 374: decl(RDPID, "rdpid", 49) /* RDPID 
>> instruction */ \
>> 375: decl(FSRM,  "fsrm",  50) /* Fast Short REP 
>> MOV */ \
> 
> `test/lib-test/jdk/test/whitebox/CPUInfoTest.java` should be adjusted as 
> well, shouldn't it?

Yes, test updated appropriately.

> src/hotspot/share/classfile/vmIntrinsics.hpp line 1152:
> 
>> 1150:   
>> "Ljdk/internal/vm/vector/VectorSupport$ComExpOperation;)"
>> \
>> 1151:   
>> "Ljdk/internal/vm/vector/VectorSupport$VectorPayload;")  
>> \
>> 1152:do_name(vector_comexp_op_name, "comExpOp")  
>> \
> 
> I don't see much value in trying to shorten the name by abbreviating it. I 
> find it easier to read in an expanded form:
> ` compressExpandOp`, `vector_compress_expand_op_name`, 
> `_VectorCompressExpand`, etc.

DONE

> src/hotspot/share/opto/c2compiler.cpp line 521:
> 
>> 519: if (!Matcher::match_rule_supported(Op_SignumF)) return false;
>> 520: break;
>> 521:   case vmIntrinsics::_VectorComExp:
> 
> Why `_VectorComExp` intrinsic is special? Other vector intrinsics are handled 
> later and in a different manner.
> 
> What about `ExpandV` case?

It was an attempt to facilitate in-lining of these APIs over targets which do 
not intrinsify them. I agree its not a generic fix since three APIs are 
piggybacking on same entry point and without the knowledge of opcode it will be 
inappropriate to take any call at this place, lazy intrinsification gives 
opportunity for some of the predications to concertize as compilation happens 
under closed world assumptions.

> src/hotspot/share/opto/compile.cpp line 3416:
> 
>> 3414: 
>> 3415:   case Op_ReverseBytesV:
>> 3416:   case Op_ReverseV: {
> 
> Can you elaborate, please, why it is performed so late in the optimization 
> phase (at the very end during graph reshaping) and not during GVN?

Its more of a chicken-egg problem here, for masked reverse operation, Reverse 
IR node is followed by a Blend Node, thus in such a case doing an eager 
Identity transform in Reverse::Identity will not work, also deferring this to 
blend may also not work since it could be a non-masked reverse operation, we 
could have handled it as a special case in inline_vector_nary_operation, but 
handling such special case in final graph reshaping looked more appropriate.

https://github.com/openjdk/panama-vector/pull/182#discussion_r845678080

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v4]

2022-05-13 Thread Jatin Bhateja
> Hi All,
> 
> Patch adds the planned support for new vector operations and APIs targeted 
> for [JEP 426: Vector API (Fourth 
> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
> 
> Following is the brief summary of changes:-
> 
> 1)  Extends the scope of existing lanewise API for following new vector 
> operations.
>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
> bits
>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
> zero bits
>- VectorOperations.REVERSE: reversing the order of bits
>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>- compress and expand bits: Semantics are based on Hacker's Delight 
> section 7-4 Compress, or Generalized Extract.
> 
> 2)  Adds following new APIs to perform cross lane vector compress and 
> expansion operations under the influence of a mask.
>- Vector.compress
>- Vector.expand 
>- VectorMask.compress
> 
> 3) Adds predicated and non-predicated versions of following new APIs to load 
> and store the contents of vector from foreign MemorySegments. 
>   - Vector.fromMemorySegment
>   - Vector.intoMemorySegment
> 
> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
> for each newly added operation.
> 
> 
>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
> 
>  Kindly review and share your feedback.
> 
>  Best Regards,
>  Jatin

Jatin Bhateja has updated the pull request incrementally with one additional 
commit since the last revision:

  8284960: Review comments resolution.

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8425/files
  - new: https://git.openjdk.java.net/jdk/pull/8425/files/b021e082..adf205f9

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8425&range=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8425&range=02-03

  Stats: 121 lines in 49 files changed: 8 ins; 5 del; 108 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8425.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8425/head:pull/8425

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v3]

2022-05-12 Thread Vladimir Ivanov
On Tue, 10 May 2022 12:48:25 GMT, Jatin Bhateja  wrote:

>> Hi All,
>> 
>> Patch adds the planned support for new vector operations and APIs targeted 
>> for [JEP 426: Vector API (Fourth 
>> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
>> 
>> Following is the brief summary of changes:-
>> 
>> 1)  Extends the scope of existing lanewise API for following new vector 
>> operations.
>>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
>> bits
>>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
>> zero bits
>>- VectorOperations.REVERSE: reversing the order of bits
>>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>>- compress and expand bits: Semantics are based on Hacker's Delight 
>> section 7-4 Compress, or Generalized Extract.
>> 
>> 2)  Adds following new APIs to perform cross lane vector compress and 
>> expansion operations under the influence of a mask.
>>- Vector.compress
>>- Vector.expand 
>>- VectorMask.compress
>> 
>> 3) Adds predicated and non-predicated versions of following new APIs to load 
>> and store the contents of vector from foreign MemorySegments. 
>>   - Vector.fromMemorySegment
>>   - Vector.intoMemorySegment
>> 
>> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
>> for each newly added operation.
>> 
>> 
>>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
>> 
>>  Kindly review and share your feedback.
>> 
>>  Best Regards,
>>  Jatin
>
> Jatin Bhateja has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains 11 commits:
> 
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: Correcting a typo.
>  - 8284960: Integrating changes from panama-vector (Add @since 19 tags).
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: AARCH64 backend changes.
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - ... and 1 more: 
> https://git.openjdk.java.net/jdk/compare/3fa1c404...b021e082

Overall, looks good.

Some minor questions/suggestions follow.

src/hotspot/cpu/aarch64/aarch64_neon.ad line 5700:

> 5698: as_FloatRegister($dst$$reg));
> 5699: }
> 5700: if (bt == T_INT) {

I find it hard to reason about the code in its current form.

Maybe make the second `if` (`bt == T_INT`) nested and move it under  `if (bt == 
T_SHORT || bt == T_INT)`?

src/hotspot/cpu/x86/macroAssembler_x86.cpp line 2587:

> 2585: 
> 2586: void MacroAssembler::vmovdqu(XMMRegister dst, AddressLiteral src, 
> Register scratch_reg, int vector_len) {
> 2587:   assert(vector_len <= AVX_512bit, "unexpected vector length");

The assert becomes redundant.

src/hotspot/cpu/x86/matcher_x86.hpp line 195:

> 193:   case Op_PopCountVI:
> 194: return ((ety == T_INT && 
> VM_Version::supports_avx512_vpopcntdq()) ||
> 195:(is_subword_type(ety) && 
> VM_Version::supports_avx512_bitalg())) ? 0 : 50;

Should be easier to read when the condition is split. E.g.:

if (is_subword_type(ety)) {
  return VM_Version::supports_avx512_bitalg())) ? 0 : 50;
} else {
  assert(ety == T_INT, "sanity"); // for documentation purposes
  return VM_Version::supports_avx512_vpopcntdq() ? 0 : 50;
}

src/hotspot/cpu/x86/stubGenerator_x86_64.cpp line 7953:

> 7951: StubRoutines::x86::_vector_iota_indices = 
> generate_iota_indices("iota_indices");
> 7952: 
> 7953: if (UsePopCountInstruction && VM_Version::supports_avx2() && 
> !VM_Version::supports_avx512_vpopcntdq()) {

Why is the LUT unconditionally generated? `UsePopCountInstruction` still guides 
the usages.

src/hotspot/cpu/x86/vm_version_x86.hpp line 375:

> 373: decl(RDTSCP,"rdtscp",48) /* RDTSCP 
> instruction */ \
> 374: decl(RDPID, "rdpid", 49) /* RDPID 
> instruction */ \
> 375: decl(FSRM,  "fsrm",  50) /* Fast Short REP 
> MOV */ \

`test/lib-test/jdk/test/whitebox/CPUInfoTest.java` should be adjusted as well, 
shouldn't it?

src/hotspot/cpu/x86/x86.ad line 2113:

> 2111: 
> 2112: case Op_CountLeadingZerosV:
> 2113:   if ((bt == T_INT || bt == T_LONG) && 
> VM_Version::supports_avx512cd()) {

Newly introduced `is_non_subword_integral_type(bt)` can be used here instead of 
`bt == T_INT || bt == T_LONG`.

src/hotspot/share/classfile/vmIntrinsics.hpp line 1152:

> 1150:   
> "Ljdk/internal/vm/vector/VectorSupport$ComExpOperation;)"  

Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v3]

2022-05-10 Thread Jatin Bhateja
> Hi All,
> 
> Patch adds the planned support for new vector operations and APIs targeted 
> for [JEP 426: Vector API (Fourth 
> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
> 
> Following is the brief summary of changes:-
> 
> 1)  Extends the scope of existing lanewise API for following new vector 
> operations.
>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
> bits
>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
> zero bits
>- VectorOperations.REVERSE: reversing the order of bits
>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>- compress and expand bits: Semantics are based on Hacker's Delight 
> section 7-4 Compress, or Generalized Extract.
> 
> 2)  Adds following new APIs to perform cross lane vector compress and 
> expansion operations under the influence of a mask.
>- Vector.compress
>- Vector.expand 
>- VectorMask.compress
> 
> 3) Adds predicated and non-predicated versions of following new APIs to load 
> and store the contents of vector from foreign MemorySegments. 
>   - Vector.fromMemorySegment
>   - Vector.intoMemorySegment
> 
> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
> for each newly added operation.
> 
> 
>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
> 
>  Kindly review and share your feedback.
> 
>  Best Regards,
>  Jatin

Jatin Bhateja has updated the pull request with a new target base due to a 
merge or a rebase. The pull request now contains 11 commits:

 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - 8284960: Correcting a typo.
 - 8284960: Integrating changes from panama-vector (Add @since 19 tags).
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - 8284960: AARCH64 backend changes.
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - ... and 1 more: https://git.openjdk.java.net/jdk/compare/3fa1c404...b021e082

-

Changes: https://git.openjdk.java.net/jdk/pull/8425/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8425&range=02
  Stats: 37901 lines in 214 files changed: 16527 ins; 16924 del; 4450 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8425.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8425/head:pull/8425

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v2]

2022-05-06 Thread Nick Gasson
On Thu, 5 May 2022 05:47:47 GMT, Jatin Bhateja  wrote:

>> Hi All,
>> 
>> Patch adds the planned support for new vector operations and APIs targeted 
>> for [JEP 426: Vector API (Fourth 
>> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
>> 
>> Following is the brief summary of changes:-
>> 
>> 1)  Extends the scope of existing lanewise API for following new vector 
>> operations.
>>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
>> bits
>>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
>> zero bits
>>- VectorOperations.REVERSE: reversing the order of bits
>>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>>- compress and expand bits: Semantics are based on Hacker's Delight 
>> section 7-4 Compress, or Generalized Extract.
>> 
>> 2)  Adds following new APIs to perform cross lane vector compress and 
>> expansion operations under the influence of a mask.
>>- Vector.compress
>>- Vector.expand 
>>- VectorMask.compress
>> 
>> 3) Adds predicated and non-predicated versions of following new APIs to load 
>> and store the contents of vector from foreign MemorySegments. 
>>   - Vector.fromMemorySegment
>>   - Vector.intoMemorySegment
>> 
>> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
>> for each newly added operation.
>> 
>> 
>>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
>> 
>>  Kindly review and share your feedback.
>> 
>>  Best Regards,
>>  Jatin
>
> Jatin Bhateja has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains 10 commits:
> 
>  - 8284960: Correcting a typo.
>  - 8284960: Integrating changes from panama-vector (Add @since 19 tags).
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: AARCH64 backend changes.
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: Integration of JEP 426: Vector API (Fourth Incubator)

`cpu/aarch64` changes look good.

-

Marked as reviewed by ngasson (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v2]

2022-05-05 Thread Jatin Bhateja
On Thu, 5 May 2022 05:47:47 GMT, Jatin Bhateja  wrote:

>> Hi All,
>> 
>> Patch adds the planned support for new vector operations and APIs targeted 
>> for [JEP 426: Vector API (Fourth 
>> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
>> 
>> Following is the brief summary of changes:-
>> 
>> 1)  Extends the scope of existing lanewise API for following new vector 
>> operations.
>>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
>> bits
>>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
>> zero bits
>>- VectorOperations.REVERSE: reversing the order of bits
>>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>>- compress and expand bits: Semantics are based on Hacker's Delight 
>> section 7-4 Compress, or Generalized Extract.
>> 
>> 2)  Adds following new APIs to perform cross lane vector compress and 
>> expansion operations under the influence of a mask.
>>- Vector.compress
>>- Vector.expand 
>>- VectorMask.compress
>> 
>> 3) Adds predicated and non-predicated versions of following new APIs to load 
>> and store the contents of vector from foreign MemorySegments. 
>>   - Vector.fromMemorySegment
>>   - Vector.intoMemorySegment
>> 
>> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
>> for each newly added operation.
>> 
>> 
>>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
>> 
>>  Kindly review and share your feedback.
>> 
>>  Best Regards,
>>  Jatin
>
> Jatin Bhateja has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains 10 commits:
> 
>  - 8284960: Correcting a typo.
>  - 8284960: Integrating changes from panama-vector (Add @since 19 tags).
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: AARCH64 backend changes.
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
>  - 8284960: Integration of JEP 426: Vector API (Fourth Incubator)

Hi @vnkozlov , It will be helpful if you can kindly review the changes.

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator) [v2]

2022-05-04 Thread Jatin Bhateja
> Hi All,
> 
> Patch adds the planned support for new vector operations and APIs targeted 
> for [JEP 426: Vector API (Fourth 
> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
> 
> Following is the brief summary of changes:-
> 
> 1)  Extends the scope of existing lanewise API for following new vector 
> operations.
>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
> bits
>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
> zero bits
>- VectorOperations.REVERSE: reversing the order of bits
>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>- compress and expand bits: Semantics are based on Hacker's Delight 
> section 7-4 Compress, or Generalized Extract.
> 
> 2)  Adds following new APIs to perform cross lane vector compress and 
> expansion operations under the influence of a mask.
>- Vector.compress
>- Vector.expand 
>- VectorMask.compress
> 
> 3) Adds predicated and non-predicated versions of following new APIs to load 
> and store the contents of vector from foreign MemorySegments. 
>   - Vector.fromMemorySegment
>   - Vector.intoMemorySegment
> 
> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
> for each newly added operation.
> 
> 
>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
> 
>  Kindly review and share your feedback.
> 
>  Best Regards,
>  Jatin

Jatin Bhateja has updated the pull request with a new target base due to a 
merge or a rebase. The pull request now contains 10 commits:

 - 8284960: Correcting a typo.
 - 8284960: Integrating changes from panama-vector (Add @since 19 tags).
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - 8284960: AARCH64 backend changes.
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8284960
 - 8284960: Integration of JEP 426: Vector API (Fourth Incubator)

-

Changes: https://git.openjdk.java.net/jdk/pull/8425/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8425&range=01
  Stats: 37900 lines in 214 files changed: 16527 ins; 16923 del; 4450 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8425.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8425/head:pull/8425

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator)

2022-05-04 Thread Paul Sandoz
On Wed, 27 Apr 2022 11:03:48 GMT, Jatin Bhateja  wrote:

> Hi All,
> 
> Patch adds the planned support for new vector operations and APIs targeted 
> for [JEP 426: Vector API (Fourth 
> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
> 
> Following is the brief summary of changes:-
> 
> 1)  Extends the scope of existing lanewise API for following new vector 
> operations.
>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
> bits
>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
> zero bits
>- VectorOperations.REVERSE: reversing the order of bits
>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>- compress and expand bits: Semantics are based on Hacker's Delight 
> section 7-4 Compress, or Generalized Extract.
> 
> 2)  Adds following new APIs to perform cross lane vector compress and 
> expansion operations under the influence of a mask.
>- Vector.compress
>- Vector.expand 
>- VectorMask.compress
> 
> 3) Adds predicated and non-predicated versions of following new APIs to load 
> and store the contents of vector from foreign MemorySegments. 
>   - Vector.fromMemorySegment
>   - Vector.intoMemorySegment
> 
> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
> for each newly added operation.
> 
> 
>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
> 
>  Kindly review and share your feedback.
> 
>  Best Regards,
>  Jatin

src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp line 1340:

> 1338:   assert_different_registers(dst, src, vtmp1, vtmp2, vtmp3, vtmp4);
> 1339:   assert_different_registers(mask, ptmp, pgtmp);
> 1340:   // Example input:   src   = 88 77 66 45 44 33 22 11

Suggestion:

  // Example input:   src   = 88 77 66 55 44 33 22 11

-

PR: https://git.openjdk.java.net/jdk/pull/8425


Re: RFR: 8284960: Integration of JEP 426: Vector API (Fourth Incubator)

2022-04-29 Thread Guoxiong Li
On Wed, 27 Apr 2022 11:03:48 GMT, Jatin Bhateja  wrote:

> Hi All,
> 
> Patch adds the planned support for new vector operations and APIs targeted 
> for [JEP 426: Vector API (Fourth 
> Incubator).](https://bugs.openjdk.java.net/browse/JDK-8280173)
> 
> Following is the brief summary of changes:-
> 
> 1)  Extends the scope of existing lanewise API for following new vector 
> operations.
>-  VectorOperations.BIT_COUNT: counts the number of one-bits
>- VectorOperations.LEADING_ZEROS_COUNT: counts the number of leading zero 
> bits
>- VectorOperations.TRAILING_ZEROS_COUNT: counts the number of trailing 
> zero bits
>- VectorOperations.REVERSE: reversing the order of bits
>- VectorOperations.REVERSE_BYTES: reversing the order of bytes
>- compress and expand bits: Semantics are based on Hacker's Delight 
> section 7-4 Compress, or Generalized Extract.
> 
> 2)  Adds following new APIs to perform cross lane vector compress and 
> expansion operations under the influence of a mask.
>- Vector.compress
>- Vector.expand 
>- VectorMask.compress
> 
> 3) Adds predicated and non-predicated versions of following new APIs to load 
> and store the contents of vector from foreign MemorySegments. 
>   - Vector.fromMemorySegment
>   - Vector.intoMemorySegment
> 
> 4) C2 Compiler IR enhancements and optimized X86 and AARCH64 backend support 
> for each newly added operation.
> 
> 
>  Patch has been regressed over AARCH64 and X86 targets different AVX levels. 
> 
>  Kindly review and share your feedback.
> 
>  Best Regards,
>  Jatin

Remind: please use the command `/jep JEP-426` [1] to mark this PR.

[1] 
https://wiki.openjdk.java.net/display/SKARA/Pull+Request+Commands#PullRequestCommands-/jep

-

PR: https://git.openjdk.java.net/jdk/pull/8425