RFR: 8297549: RISC-V: Support vloadcon instruction for Vector API

Dingli Zhang dzhang at openjdk.org
Thu Nov 24 05:48:31 UTC 2022


The instruction which is matched `VectorLoadConst`  will create index starting from 0 and incremented by 1. In detail, the instruction populates the destination vector by setting the first element to 0 and monotonically incrementing the value by 1 for each subsequent element. 

We can add support of `VectorLoadConst` for RISC-V by `vid.v` . It was implemented by referring to RVV v1.0 [1].

The JMH score of the micro-benchmark `IndexVectorBenchmark` [2] will be improved by a factor of about 9 on avarage after we implement this node.


Before:
Benchmark                               (size)   Mode  Cnt   Score   Error   Units
IndexVectorBenchmark.byteIndexVector      1024  thrpt    5  16.900 ± 3.606  ops/ms
IndexVectorBenchmark.doubleIndexVector    1024  thrpt    5   2.722 ± 0.113  ops/ms
IndexVectorBenchmark.floatIndexVector     1024  thrpt    5   3.692 ± 0.588  ops/ms
IndexVectorBenchmark.intIndexVector       1024  thrpt    5   4.974 ± 0.943  ops/ms
IndexVectorBenchmark.longIndexVector      1024  thrpt    5   3.273 ± 0.251  ops/ms
IndexVectorBenchmark.shortIndexVector     1024  thrpt    5   9.485 ± 0.452  ops/ms

After:
Benchmark                               (size)   Mode  Cnt   Score   Error   Units
IndexVectorBenchmark.byteIndexVector      1024  thrpt    5  91.309 ± 0.833  ops/ms
IndexVectorBenchmark.doubleIndexVector    1024  thrpt    5  20.834 ± 5.665  ops/ms
IndexVectorBenchmark.floatIndexVector     1024  thrpt    5  33.560 ± 1.569  ops/ms
IndexVectorBenchmark.intIndexVector       1024  thrpt    5  60.216 ± 0.532  ops/ms
IndexVectorBenchmark.longIndexVector      1024  thrpt    5  42.142 ± 1.934  ops/ms
IndexVectorBenchmark.shortIndexVector     1024  thrpt    5  76.982 ± 0.612  ops/ms


[1] https://github.com/riscv/riscv-v-spec/blob/v1.0/v-spec.adoc
[2] https://github.com/openjdk/jdk/blob/857b0f9b05bc711f3282a0da85fcff131fffab91/test/micro/org/openjdk/bench/jdk/incubator/vector/IndexVectorBenchmark.java

Please take a look and have some reviews. Thanks a lot.

## Testing:

- hotspot and jdk tier1 without new failures (release with UseRVV on QEMU)
- test/jdk/jdk/incubator/vector/* (fastdebug/release with UseRVV on QEMU)

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

Commit messages:
 - Support vloadcon instruction for Vector API

Changes: https://git.openjdk.org/jdk/pull/11344/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11344&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8297549
  Stats: 18 lines in 1 file changed: 17 ins; 1 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/11344.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11344/head:pull/11344

PR: https://git.openjdk.org/jdk/pull/11344


More information about the hotspot-compiler-dev mailing list