fwsGonzo / libriscv

The fastest RISC-V sandbox
BSD 3-Clause "New" or "Revised" License
522 stars 46 forks source link

Support RVC in binary translation #132

Closed fwsGonzo closed 1 month ago

fwsGonzo commented 1 month ago

This is part of the work towards supporting binary translation with the C-extension enabled

fwsGonzo commented 1 month ago

https://github.com/fwsGonzo/libriscv/issues/133

fwsGonzo commented 1 month ago
$ VERBOSE=1 ./rvlinux ~/github/coremark/coremark.exe 
* Loading program of size 406044 from 0x79ba79193010 to virtual 0x10000
* Program segment readable: 1 writable: 0  executable: 1
* Loading program of size 22248 from 0x79ba791f6d10 to virtual 0x74d00
* Program segment readable: 1 writable: 1  executable: 0
Emitted 85857 accelerated instructions and 7761 functions. GP=0x7ABE0
Command: clang-18 -O2 -s -std=c99 -fPIC -shared -rdynamic -x c  -fexceptions -march=native -DRISCV_MAX_COUNTER_OFF=2824 -DRISCV_INS_COUNTER_OFF=2816 -DRISCV_EXT_C=1 -DRISCV_ARENA_ROEND=471580 -DRISCV_MAX_SYSCALLS=512 -DRISCV_EXT_VECTOR=32 -DRISCV_ARENA_END=2097152000 -DRISCV_TRANSLATION_DYLIB=8 -DARCH=HOST_AMD64 -pipe   -o /tmp/rvbintr-F32C5A94 /tmp/rvtrcode-vckYsB 2>&1
* Entry is at 0x10d00
2K performance run parameters for coremark.
CoreMark Size    : 666
Total ticks      : 15810
Total time (secs): 15.810000
Iterations/Sec   : 12650.221379
Iterations       : 200000
Compiler version : GCC12.3.0
Compiler flags   : -O3 -DPERFORMANCE_RUN=1  
Memory location  : Please put data memory location here
            (e.g. code in flash, data on heap etc)
seedcrc          : 0xe9f5
[0]crclist       : 0xe714
[0]crcmatrix     : 0x1fd7
[0]crcstate      : 0x8e3a
[0]crcfinal      : 0x4983
Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 12650.221379 / GCC12.3.0 -O3 -DPERFORMANCE_RUN=1   / Static
>>> Program exited, exit code = 0 (0x0)
Instructions executed: 105779278986  Runtime: 24666.376ms  Insn/s: 4288mi/s
Pages in use: 112 (448 kB virtual memory, total 1816 kB)

Initial CoreMark score from binary translated RV64GC. Quite good for an initial run!