Description
There is a need to enable certain extensions for RISC-V coreclr builds. For example, emitLoadImmediate
makes heavy use of bit count intrinsics.
runtime/src/coreclr/jit/emitriscv64.cpp
Line 1312 in 456e1fe
We can increase the JIT throughput of this function by enabling Zbb
extension. This is only one example where we could improve RISC-V JIT throughput by enabling certain extensions. Other extensions, such as Zba
and Zicond
can improve throughput at various places.
Currently, the compiler (clang) uses the default configuration for RISC-V target, which "only" enables the rv64gc
"profile".
We can use CLR_ADDITIONAL_COMPILER_OPTIONS
to pass in -march=rv64gc_zbb
to clang:
runtime/eng/native/configurecompiler.cmake
Lines 785 to 787 in 11afd86
But I was wondering if we should introduce a better way to enable these extensions, akin to what we have for ARM:
runtime/eng/native/configurecompiler.cmake
Lines 753 to 756 in 11afd86
There are several alternative proposals that I would like to suggest:
- Introduce
RISCV_EXTENSIONS
CMake option. User can pass inZba_Zicond_...
. - Introduce
RISCV_PROFILE
CMake option. User can pass inrv22
,rv23
, etc. - Introduce options for each extension that might be useful, e.g.
RISCV_ZBB=1
, adding it only when a need arises. - Change the default profile to RVA20/22/23.
cc @dotnet/samsung