RFR: 8308817: RISC-V: Support VectorTest node for Vector API

Feilong Jiang fjiang at openjdk.org
Fri May 26 06:41:53 UTC 2023


On Thu, 25 May 2023 03:22:18 GMT, Gui Cao <gcao at openjdk.org> wrote:

> Hi,
> 
> we have added VectorTest node, It was implemented by referring to RVV v1.0 [1]. please take a look and have some reviews. Thanks a lot.
> We can use the Int256VectorTests.java[2] to print the compilation log, verify and observe the generation of nodes.
> 
> For example, we can use the following command to print the compilation log of a jtreg test case:
> 
> /home/zifeihan/jdk-tools/jtreg/bin/jtreg \
> -v:default \
> -concurrency:16 -timeout:50 \
> -javaoption:-XX:+UnlockExperimentalVMOptions \
> -javaoption:-XX:+UseRVV \
> -javaoption:-XX:+PrintOptoAssembly \
> -javaoption:-XX:LogFile=/home/zifeihan/jdk-rvv/Int256VectorTests_PrintOptoAssembly_20230525.log \
> -jdk:/home/zifeihan/jdk-rvv/build/linux-riscv64-server-fastdebug/jdk \
> -compilejdk:/home/zifeihan/jdk-rvv/build/linux-x86_64-server-release/images/jdk \
> /home/zifeihan/jdk/test/jdk/jdk/incubator/vector/Int256VectorTests.java
> 
> 
> Also here's a more concise test case, VectorTestDemo:
> 
> 
> import jdk.incubator.vector.ByteVector;
> import jdk.incubator.vector.VectorMask;
> 
> public class VectorTestDemo {
>     static boolean[] d = new boolean[]{true, false, false, false, false, false, false, false};
>     static VectorMask<Byte> avmask = VectorMask.fromArray(ByteVector.SPECIES_64, d, 0);
> 
>     public static void main(String[] args) {
>         for (int i = 0; i < 300000; i++) {
>             
>             final boolean alltrue = alltrue();
>             if (alltrue != false) {
>                 throw new RuntimeException("alltrue");
>             }
>             final boolean anytrue = anytrue();
>             if (anytrue != true) {
>                 throw new RuntimeException("anytrue");
>             }
>         }
>     }
> 
>     public static boolean anytrue() {
>         return avmask.anyTrue();
>     }
> 
>     public static boolean alltrue() {
>         return avmask.allTrue();
>     }
> }
> 
> 
> We can compile `VectorTestDemo.java` using `javac --add-modules jdk.incubator.vector VectorTestDemo.java`, and use `./java -XX:-TieredCompilation -XX:+UnlockExperimentalVMOptions -XX:+UseRVV -XX:+PrintOptoAssembly -XX:+LogCompilation -XX:LogFile=compile.log VectorTestDemo > aaa.log` to start the test case, we can observe the specified compilation log `compile.log`, which contains the VectorTest node for the PR implementation.
> Some of the compilation logs of VectorTestDemo#anytrue method are as follows.
> 
> 05e lwu R28, [R7, #12] # loadN, compressed ptr, #@loadN ! Field: jdk/internal/vm/vector/VectorSupport$VectorPayload.payload (con...

Looks good

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

Marked as reviewed by fjiang (Author).

PR Review: https://git.openjdk.org/jdk/pull/14138#pullrequestreview-1445273900


More information about the hotspot-compiler-dev mailing list