RFR: 8302906: AArch64: Add SVE backend support for vector unsigned comparison [v4]
changpeng1997
duke at openjdk.org
Wed Mar 15 03:38:54 UTC 2023
> This patch implements unsigned vector comparison on SVE.
>
> 1: Test:
> All vector API test cases[1][2] passed without new failure. Existing test cases can cover all unsigned comparison conditions for all kinds of vector.
>
> 2: Performance:
> (1): Benchmark:
> As existing benchmarks in panama repo (such as [3]) have some issues [4] (We will fix them in a separate patch.), I collected performance data with a reduced jmh benchmark [5]. e.g. for ByteVector unsigned comparison:
>
>
> @Benchmark
> public void byteVectorUnsignedCompare() {
> for (int j = 0; j < 200; j++) {
> for (int i = 0; i < bspecies.length(); i++) {
> ByteVector av = ByteVector.fromArray(bspecies, ba, i);
> ByteVector ca = ByteVector.fromArray(bspecies, bb, i);
> av.compare(VectorOperators.UNSIGNED_GT, ca).intoArray(br, i);
> }
> }
> }
>
>
> (2): Performance data
>
> Before:
>
>
> Benchmark Score(op/ms) Error
> ByteVector.UNSIGNED_GT#size(1024) 4.846 3.419
> ShortVector.UNSIGNED_GE#size(1024) 3.055 1.369
> IntVector.UNSIGNED_LT#size(1024) 3.475 1.269
> LongVector.UNSIGNED_LE#size(1024) 4.515 1.812
>
>
> After:
>
>
> Benchmark Score(op/ms) Error
> ByteVector.UNSIGNED_GT#size(1024) 493.937 1.389
> ShortVector.UNSIGNED_GE#size(1024) 5308.796 20.557
> IntVector.UNSIGNED_LT#size(1024) 4944.744 10.606
> LongVector.UNSIGNED_LE#size(1024) 8459.605 28.683
>
>
> [1] https://github.com/openjdk/jdk/tree/master/test/jdk/jdk/incubator/vector
> [2] https://github.com/openjdk/jdk/tree/master/test/hotspot/jtreg/compiler/vectorapi
> [3] https://github.com/openjdk/panama-vector/blob/2aade73adeabdf6a924136b17fd96ccc95c1d160/test/micro/org/openjdk/bench/jdk/incubator/vector/operation/ByteMaxVector.java#L1459
> [4] https://bugs.openjdk.org/browse/JDK-8282850
> [5] https://gist.github.com/changpeng1997/d311127e1015c107197f9b56a92b0fae
changpeng1997 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 four additional commits since the last revision:
- Merge branch 'openjdk:master' into sve_cmpU
- Refactor part of code in C2 assembler and remove some switch-case stmts.
- Merge branch 'openjdk:master' into sve_cmpU
- 8302906: AArch64: Add SVE backend support for vector unsigned comparison
This patch implements unsigned vector comparison on SVE.
1: Test:
All vector API test cases[1][2] passed without new failure. Existing
test cases can cover all unsigned comparison conditions for all
kinds of vector.
2: Performance:
(1): Benchmark:
As existing benchmarks in panama repo (such as [3]) have some
issues [4] (We will fix them in a separate patch.), I collected
performance data with a reduced jmh benchmark [5]. e.g. for
ByteVector unsigned comparison:
```
@Benchmark
public void byteVectorUnsignedCompare() {
for (int j = 0; j < 200; j++) {
for (int i = 0; i < bspecies.length(); i++) {
ByteVector av = ByteVector.fromArray(bspecies, ba, i);
ByteVector ca = ByteVector.fromArray(bspecies, bb, i);
av.compare(VectorOperators.UNSIGNED_GT, ca).intoArray(br, i);
}
}
}
```
(2): Performance data
Before:
```
Benchmark Score(op/ms) Error
ByteVector.UNSIGNED_GT#size(1024) 4.846 3.419
ShortVector.UNSIGNED_GE#size(1024) 3.055 1.369
IntVector.UNSIGNED_LT#size(1024) 3.475 1.269
LongVector.UNSIGNED_LE#size(1024) 4.515 1.812
```
After:
```
Benchmark Score(op/ms) Error
ByteVector.UNSIGNED_GT#size(1024) 493.937 1.389
ShortVector.UNSIGNED_GE#size(1024) 5308.796 20.557
IntVector.UNSIGNED_LT#size(1024) 4944.744 10.606
LongVector.UNSIGNED_LE#size(1024) 8459.605 28.683
```
[1] https://github.com/openjdk/jdk/tree/master/test/jdk/jdk/incubator/vector
[2] https://github.com/openjdk/jdk/tree/master/test/hotspot/jtreg/compiler/vectorapi
[3] https://github.com/openjdk/panama-vector/blob/2aade73adeabdf6a924136b17fd96ccc95c1d160/test/micro/org/openjdk/bench/jdk/incubator/vector/operation/ByteMaxVector.java#L1459
[4] https://bugs.openjdk.org/browse/JDK-8282850
[5] https://gist.github.com/changpeng1997/d311127e1015c107197f9b56a92b0fae
TEST_CMD: true
Jira: ENTLLT-6097
Change-Id: I236cf4a7626af3aad04bf081b47849a00e77df15
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/12725/files
- new: https://git.openjdk.org/jdk/pull/12725/files/5acf5ba4..12fa26bb
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=12725&range=03
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=12725&range=02-03
Stats: 117949 lines in 1227 files changed: 86726 ins; 16946 del; 14277 mod
Patch: https://git.openjdk.org/jdk/pull/12725.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/12725/head:pull/12725
PR: https://git.openjdk.org/jdk/pull/12725
More information about the hotspot-compiler-dev
mailing list