Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8316933

RISC-V: compiler/vectorapi/VectorCastShape128Test.java fails when using RVV

XMLWordPrintable

    • b17
    • riscv
    • linux

        Hi, we are experiencing test failures in test/hotspot/jtreg/compiler/vectorapi/VectorCastShape128Test.java using latest qemu:

        ```
        zifeihan@plct-c8:~/qemu-master-riscv64/bin$ ./qemu-riscv64 -version
        qemu-riscv64 version 8.1.50
        Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers
        ```
        By the way, using a lower version of qemu (qemu-riscv64 version 7.0.91) no such problems were encountered. we infer that version 8.1.50 of qemu adds better checks.

        ```
        /home/zifeihan/jtreg/bin/jtreg -J-Djavatest.maxOutputSize=500000 -Djdk.lang.Process.launchMechanism=vfork -v:default -concurrency:48 -timeout:50 -javaoption:-XX:+UnlockExperimentalVMOptions -javaoption:-XX:+UseRVV -jdk:/home/zifeihan/jdk/build/linux-riscv64-server-fastdebug/jdk -compilejdk:/home/zifeihan/jdk-rvv/build/linux-x86_64-server-release/jdk /home/zifeihan/jdk/test/hotspot/jtreg/compiler/vectorapi/VectorCastShape128Test.java
        ```

        ```
        ----------System.out:(21/1314)----------
        For random generator using seed: 262884223316435826
        To re-run test with same seed value please add "-Djdk.test.lib.random.seed=262884223316435826" to command line.
        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # SIGILL (0x4) at pc=0x00002aaab582605a, pid=1865891, tid=1868167
        #
        # JRE version: OpenJDK Runtime Environment (22.0) (fastdebug build 22-internal-adhoc.zifeihan.jdk)
        # Java VM: OpenJDK 64-Bit Server VM (fastdebug 22-internal-adhoc.zifeihan.jdk, mixed mode, compressed oops, compressed class ptrs, g1 gc, linux-riscv64)
        # Problematic frame:
        # J 2181% c2 compiler.vectorapi.VectorCastShape128Test.testFloatToByte()V (111 bytes) @ 0x00002aaab582605a [0x00002aaab5825f40+0x000000000000011a]
        #
        # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /home/zifeihan/jdk/build/linux-riscv64-server-fastdebug/jdk/bin/JTwork/scratch/0/core.1865891)
        #
        # An error report file with more information is saved as:
        # /home/zifeihan/jdk/build/linux-riscv64-server-fastdebug/jdk/bin/JTwork/scratch/0/hs_err_pid1865891.log
        [49.618s][warning][os] Loading hsdis library failed
        #
        # If you would like to submit a bug report, please visit:
        # https://bugreport.java.com/bugreport/crash.jsp
        #
        ----------System.err:(1/22)----------
        ```
        1. SEW setting is not accurate

        https://github.com/openjdk/jdk/blob/e2e8e8e210ea9a7a9d901a1da729551714015d04/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp#L2195-L2207

        The reason for the error reported for the vcvtFtoX_narrow node is because the vmfeq_vv directive is used here, but when the macro is called, the vsetvli type is set to T_SHORT, not T_FLOAT, so an exception occurs here.

        For vcvtFtoL, vcvtDtoX_narrow nodes, there was also the problem of inaccurate setting of both SEW, which is also changed here.

        2. Register usage constraints
        For the vcvtStoX_fp_extend node, the operands of the vfwcvt_f_f_v instruction inside, the same register cannot be used here[1], so that has also been modified.

        [1] https://github.com/riscv/riscv-v-spec/blob/v1.0/v-spec.adoc#sec-vec-operands

              gcao Gui Cao
              gcao Gui Cao
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: