RFR: 8267969: Add vectorized implementation for VectorMask.eq() [v2]

Nils Eliasson neliasso at openjdk.java.net
Wed Jun 2 07:53:42 UTC 2021


On Wed, 2 Jun 2021 01:56:00 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:

>> Currently `"VectorMask.eq()" `is not vectorized:
>> 
>>     public VectorMask<E> eq(VectorMask<E> m) {
>>         // FIXME: Generate good code here.
>>         return bOp(m, (i, a, b) -> a == b);
>>     }
>> 
>> This can be implemented by calling `"xor(m.not())"` directly.
>> 
>> The performance improved about 1.4x ~ 1.9x for the following benchmark with different basic types:
>> 
>> @Benchmark
>> public Object eq() {
>>     boolean[] ma = fm.apply(size);
>>     boolean[] mb = fmb.apply(size);
>>     boolean[] mt = fmt.apply(size);
>>     VectorMask<Byte> m = VectorMask.fromArray(SPECIES, mt, 0);
>> 
>>     for (int ic = 0; ic < INVOC_COUNT; ic++) {
>>         for (int i = 0; i < ma.length; i += SPECIES.length()) {
>>             var av = SPECIES.loadMask(ma, i);
>>             var bv = SPECIES.loadMask(mb, i);
>> 
>>             // accumulate results, so JIT can't eliminate relevant computations
>>             m = m.and(av.eq(bv));
>>         }
>>     }
>> 
>>     return m;
>> }
>
> Xiaohong Gong has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
> 
>  - Merge branch 'jdk:master' into JDK-8267969
>  - 8267969: Add vectorized implementation for VectorMask.eq()

Looks good.

Please wait until you have two reviewers before integrating.

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

Marked as reviewed by neliasso (Reviewer).

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


More information about the hotspot-compiler-dev mailing list