-
Bug
-
Resolution: Fixed
-
P4
-
24
-
b04
-
riscv
-
linux
HI, It's possible to specify a MaxVectorSize which is not equal to VM_Version::_initial_vector_length on RISC-V. For example, it could happen on Banana-Pi that MaxVectorSize equals 16, while VM_Version::_initial_vector_length is 32. This may lead to several jtreg test failures.
```
config AbstractVectorConversionTest.getRunTime(org.testng.internal.TestResult@195eb8c8): success
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000003f8c76866a, pid=911840, tid=911861
#
# JRE version: OpenJDK Runtime Environment (24.0) (build 24-internal-adhoc.zifeihan.jdk)
# Java VM: OpenJDK 64-Bit Server VM (24-internal-adhoc.zifeihan.jdk, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-riscv64)
# Problematic frame:
# J 622 c2 jdk.incubator.vector.ByteVector$ByteSpecies.fromArray(Ljava/lang/Object;I)Ljdk/incubator/vector/Vector; jdk.incubator.vector@24-internal (7 bytes) @ 0x0000003f8c76866a [0x0000003f8c768600+0x000000000000006a]
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/zifeihan/jdk/build/linux-riscv64-server-release/test-support/jtreg_test_jdk_jdk_incubator_vector_VectorMaxConversionTests_java/scratch/1/hs_err_pid911840.log
[16.711s][warning][os] Loading hsdis library failed
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
#
STDERR:
WARNING: Using incubator modules: jdk.incubator.vector
rerun:
```
The reason for this problem is that when spill vector registers into memory, the whole width of the register is used incorrectly, and MaxVectorSize should be used to handle the number of elements spill.
```
void spill(VectorRegister v, int offset) {
add(t0, sp, offset);
vs1r_v(v, t0);
}
```
PR propose to simply set MaxVectorSize to VM_Version::_initial_vector_length for the following reasons:
1. The CSR_VLENB register of RISC-V is read-only, we can't change it to MaxVectorSize like like aarch64.
2. It does not make sense to me to set MaxVectorSize to a value smaller than VM_Version::_initial_vector_length in the real world, which might bring negative impact on performance.
3. If MaxVectorSize equals to VM_Version::_initial_vector_length, then we can make use of vs1r_v/vl1r_v when saving and restoring vector registers, which avoids the need to control the number of elements with vsetvli.
```
config AbstractVectorConversionTest.getRunTime(org.testng.internal.TestResult@195eb8c8): success
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000003f8c76866a, pid=911840, tid=911861
#
# JRE version: OpenJDK Runtime Environment (24.0) (build 24-internal-adhoc.zifeihan.jdk)
# Java VM: OpenJDK 64-Bit Server VM (24-internal-adhoc.zifeihan.jdk, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-riscv64)
# Problematic frame:
# J 622 c2 jdk.incubator.vector.ByteVector$ByteSpecies.fromArray(Ljava/lang/Object;I)Ljdk/incubator/vector/Vector; jdk.incubator.vector@24-internal (7 bytes) @ 0x0000003f8c76866a [0x0000003f8c768600+0x000000000000006a]
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/zifeihan/jdk/build/linux-riscv64-server-release/test-support/jtreg_test_jdk_jdk_incubator_vector_VectorMaxConversionTests_java/scratch/1/hs_err_pid911840.log
[16.711s][warning][os] Loading hsdis library failed
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
#
STDERR:
WARNING: Using incubator modules: jdk.incubator.vector
rerun:
```
The reason for this problem is that when spill vector registers into memory, the whole width of the register is used incorrectly, and MaxVectorSize should be used to handle the number of elements spill.
```
void spill(VectorRegister v, int offset) {
add(t0, sp, offset);
vs1r_v(v, t0);
}
```
PR propose to simply set MaxVectorSize to VM_Version::_initial_vector_length for the following reasons:
1. The CSR_VLENB register of RISC-V is read-only, we can't change it to MaxVectorSize like like aarch64.
2. It does not make sense to me to set MaxVectorSize to a value smaller than VM_Version::_initial_vector_length in the real world, which might bring negative impact on performance.
3. If MaxVectorSize equals to VM_Version::_initial_vector_length, then we can make use of vs1r_v/vl1r_v when saving and restoring vector registers, which avoids the need to control the number of elements with vsetvli.