Benchmarking RISC-V QEMU User mode Emulator with SPEC CPU2017(SingleCore/intrate)
By Ali Tariq | July 2, 2024

This blog post outlines the process of executing the SPEC CPU 2017 benchmark on QEMU user-mode, specifically targeting a RISC-V binary running on a host architecture that is not RISC-V (x86 in this case). The binary is compiled for RISC-V and executed via QEMU user-mode emulation.

System Environment
The benchmark was executed using qemu-riscv64 version 8.2.1 on an Ubuntu 22.04 LTS system running on an x86 architecture. The environment was an LXC container configured with the following resources:

  • CPU: 4 cores from AMD EPYC™ 7713
  • Memory: 8 GB RAM
  • Swap: 2 GB

SPEC CPU 2017 Source Code Modifications​

The default SPEC CPU 2017 setup relies on a cascading set of scripts—starting from a main bash script, which invokes Perl scripts, that in turn execute other relevant scripts.

However, when using QEMU in user-mode, the binary under test must be compiled for the RISC-V architecture and must run on a non-RISC-V host (in this case, x86). This introduces a specific requirement: every binary generated during the benchmark must be compiled for RISC-V and executed through QEMU, rather than natively.

To achieve this, modifications were made to the SPEC CPU 2017 harness to prepend the QEMU user-mode invocation command:

qemu-riscv64 -L <path_to_test_environment>

💡 If you need assistance with modifying the SPEC harness or setting up this environment, feel free to contact: cloud-v@10xengineers.ai

Benchmark Execution

Unlike standard execution, the benchmark was run without the reportable flag and without peak compiler settings, due to constraints in the emulated environment.

The command used for test execution:

./runcpu --threads=1 --copies=1 --config="/home/user1/gcc-linux-qemu-riscv64.cfg" <space_separated_test_names>

I used this command and added all test names separated by space.

Results

Individual Test Results

The individual test results of qemu-riscv64 with single thread are as follows:



Final Results (comparison with physical hardware)

The following results of other instances are taken out from the previous SPEC CPU intrate/multicore blog.



Conclusion

These results show us that qemu-riscv64 user mode emulator is even faster than qemu-system-riscv64 and with latest specification changes even in single core performance. This makes the RISC-V software development streamlined and even faster on emulated RISC-V compute instances.




Benchmarking RISC-V QEMU User mode Emulator with SPEC CPU2017(SingleCore/intrate)
Cloud-V 4 August, 2025
Share this post
Archive

Benchmarking RISC-V QEMU User mode Emulator with SPEC CPU2017(Multicore/intrate)
By Ali Tariq | July 2, 2024