There is a need to enable certain extensions for RISC-V coreclr builds. For example, emitLoadImmediate makes heavy use of bit count intrinsics.
|
void emitter::emitLoadImmediate(emitAttr size, regNumber reg, ssize_t imm) |
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:
|
if(CLR_CMAKE_HOST_UNIX) |
|
add_compile_options(${CLR_ADDITIONAL_COMPILER_OPTIONS}) |
|
endif(CLR_CMAKE_HOST_UNIX) |
But I was wondering if we should introduce a better way to enable these extensions, akin to what we have for ARM:
|
if(CLR_CMAKE_HOST_UNIX_ARM) |
|
if (NOT DEFINED CLR_ARM_FPU_TYPE) |
|
set(CLR_ARM_FPU_TYPE vfpv3) |
|
endif(NOT DEFINED CLR_ARM_FPU_TYPE) |
There are several alternative proposals that I would like to suggest:
- Introduce
RISCV_EXTENSIONS CMake option. User can pass in Zba_Zicond_....
- Introduce
RISCV_PROFILE CMake option. User can pass in rv22, 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
There is a need to enable certain extensions for RISC-V coreclr builds. For example,
emitLoadImmediatemakes 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
Zbbextension. This is only one example where we could improve RISC-V JIT throughput by enabling certain extensions. Other extensions, such asZbaandZicondcan 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_OPTIONSto pass in-march=rv64gc_zbbto 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:
RISCV_EXTENSIONSCMake option. User can pass inZba_Zicond_....RISCV_PROFILECMake option. User can pass inrv22,rv23, etc.RISCV_ZBB=1, adding it only when a need arises.cc @dotnet/samsung