From rehn at rivosinc.com Mon Sep 1 09:30:14 2025 From: rehn at rivosinc.com (Robbin Ehn) Date: Mon, 1 Sep 2025 11:30:14 +0200 Subject: RISC-V RVA23 profile support In-Reply-To: <66e112bb.9d7b0.19904112e1b.Coremail.yangfei@iscas.ac.cn> References: <66e112bb.9d7b0.19904112e1b.Coremail.yangfei@iscas.ac.cn> Message-ID: Hi, >From some digging, I also gathered that Hotspot now supports close to half of the mandatory extensions of RVA23. The other half either don't provide useful instructions for us at the moment, or they specify something that we don't care about. For example: - zawrs provides new instructions, but there are no good use-cases for them. - zvkt specifies hardware behavior we don't care about. If we missed an extension we could use, please let us know. As Fei says, the default is to enable all non-experimental extensions that the kernel tells us about via hwprobe - there is no need to make any profile default. I'd say JDK 25 can take advantage of all relevant extensions in RVA23. Thanks, Robbin /Robbin > > Regards, > Pushkar > > [1] https://github.com/openjdk/jdk/blob/28942406020881be79b7543105b9eb2a0dda429e/src/hotspot/cpu/riscv/globals_riscv.hpp#L97 > [2] https://www.phoronix.com/news/Ubuntu-25.10-To-Require-RVA23 > > > From piotr.tarsa at hotmail.com Fri Sep 26 17:06:37 2025 From: piotr.tarsa at hotmail.com (Piotr Tarsa) Date: Fri, 26 Sep 2025 17:06:37 +0000 Subject: RISC-V RVA23 profile support Message-ID: Hi, I want to share my thoughts on the original topic (even though it's not shown as a reply, because I don't have the original email to reply to). The original question was about the minimal RISC-V profile that OpenJDK is designed to support and the answer was that OpenJDK will dynamically adapt to CPU's features by probing available extensions at startup. That does work for code outputted by JIT compiler, but it doesn't work for C++ code that is compiled AOT as part of OpenJDK runtime. Therefore, selecting different optimization target when compiling OpenJDK from C++ to an executable, will impact the performance of various subsystems (GC threads, JIT compiler itself, any other code on the hot path). RVA23 doesn't add much functionality that would affect typical C++ code, but RVA22 does. RVA22 mandates the bit-manipulation extension (named 'B'), basic conditional instructions, etc. Lack of these instructions, if targeting RVA20, could significantly impact performance. What is the minimum profile level (RVA20, RVA22 or other?) and set of extensions required by OpenJDK currently? Regards, Piotr -------------- next part -------------- An HTML attachment was scrubbed... URL: From rehn at rivosinc.com Fri Sep 26 18:12:19 2025 From: rehn at rivosinc.com (Robbin Ehn) Date: Fri, 26 Sep 2025 20:12:19 +0200 Subject: RISC-V RVA23 profile support In-Reply-To: References: Message-ID: Hey, The minimum level which we can compile with is rv64g, which is IMAFDZicsr_Zifencei. openJDK does not use march/mtune default on any platform, you need to add that in the configure step. And as we, the openJDK community, do not supply binaries it is not something we can control. Which means whatever gcc default march is, it will be supported. And yes you are correct, counting leading/trailing zeros in GC is very hot without B :) Thanks, Robbin On Fri, Sep 26, 2025 at 7:07?PM Piotr Tarsa wrote: > > Hi, > > I want to share my thoughts on the original topic (even though it's not shown as a reply, because I don't have the original email to reply to). > > The original question was about the minimal RISC-V profile that OpenJDK is designed to support and the answer was that OpenJDK will dynamically adapt to CPU's features by probing available extensions at startup. That does work for code outputted by JIT compiler, but it doesn't work for C++ code that is compiled AOT as part of OpenJDK runtime. Therefore, selecting different optimization target when compiling OpenJDK from C++ to an executable, will impact the performance of various subsystems (GC threads, JIT compiler itself, any other code on the hot path). > > RVA23 doesn't add much functionality that would affect typical C++ code, but RVA22 does. RVA22 mandates the bit-manipulation extension (named 'B'), basic conditional instructions, etc. Lack of these instructions, if targeting RVA20, could significantly impact performance. > > What is the minimum profile level (RVA20, RVA22 or other?) and set of extensions required by OpenJDK currently? > > Regards, > Piotr