Abstract
RISC-V is an open ISA that has been calling the attention worldwide by its fast growth and adoption. It is already supported by GCC, Clang and the Linux Kernel. However, none of the currently available RISC-V emulators are capable of providing good, near-native, emulation performance. Thus, in this work, we investigate if faster emulators for RISC-V could be created. Since Dynamic Binary Translation (DBT) is the most common, and fastest, technique to implement emulators, we focus our investigation on the quality of the translated code, arguably the most important source of overhead when emulating code with DBT. To this end, we implemented and evaluated a LLVM-based Static Binary Translation (SBT) engine to investigate whether or not it is possible to produce high-quality translations from RISC-V to x86 and ARM. We explored different translation techniques and managed to design an SBT engine that produces translated code that is only 1.2x/1.3x slower than native x86/ARM code, which supports the claim that it is possible to build near-native RISC-V emulators for x86 and ARM hosts. We also analyze the main sources of overheads, compare the code produced by our SBT against the code produced by a popular DBT and provide insights on the potential performance impact of the proposed techniques on DBTs.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Auler, R., Borin, E.: The case for flexible ISAs: unleashing hardware and software. In: SBAC-PAD 2017 (2017)
Baraz, L., et al.: IA-32 execution layer: a two-phase dynamic translator designed to support IA-32 applications on Itanium®-based systems. In: 36th MICRO (2003)
Bellard, F.: TinyEMU. https://bellard.org/tinyemu. Accessed 27 Oct 2018
Bellard, F.: QEMU, a fast and portable dynamic translator. In: USENIX, FREENIX Track (2005)
Böhm, I., von Koch, T.J.E., Kyle, S.C., Franke, B., Topham, N.: Generalized just-in-time trace compilation using a parallel task farm in a dynamic binary translator. ACM SIGPLAN Not. 46(6), 74–85 (2011)
Borin, E., Wu, Y.: Characterization of DBT overhead. In: 2009 IEEE International Symposium on Workload Characterization (2009)
Cesar, D., Auler, R., Dalibera, R., Rigo, S., Borin, E., Araujo, G.: Modeling virtual machines misprediction overhead. In: 2013 IISWC (2013)
Cifuentes, C., Malhotra, V.M.: Binary translation: static, dynamic, retargetable? In: ICSM (1996)
Clark, M., Hoult, B.: rv8: a high performance RISC-V to x86 binary translator. In: 1st CARRV (2017)
RISC-V Foundation. http://riscv.org/risc-v-foundation. Accessed 21 Oct 2018
RISC-V Foundation: RISC-V QEMU. https://github.com/riscv/riscv-qemu. Accessed 21 Oct 2018
RISC-V Foundation: RISCV-angel. https://github.com/riscv/riscv-angel. Accessed 24 Oct 2019
RISC-V Foundation: Spike RISC-V ISA simulator. https://github.com/riscv/riscv-isa-sim. Accessed 24 Jan 2019
Gomes, G.F.T., Borin, E.: Indirect branch emulation techniques in virtual machines. Dissertation, University of Campinas (2014)
Guthaus, M.R., Ringenberg, J.S., Ernst, D., Austin, T.M., Mudge, T., Brown, R.B.: Mibench: a free, commercially representative embedded benchmark suite. In: WWC-4 (2001)
Hong, D.Y., et al.: HQEMU: a multi-threaded and retargetable dynamic binary translator on multicores. In: CGO 2012 (2012)
Ilbeyi, B., Lockhart, D., Batten, C.: Pydgin for RISC-V: a fast and productive instruction-set simulator. In: 3rd CARRV (2016)
Lawton, K.P.: Bochs: a portable PC emulator for Unix/x. Linux J. 1996(29es), 7 (1996)
Lupori, L., do Rosario, V.M., Borin, E.: Towards a high-performance RISC-V emulator. In: WSCAD 2018 (2018)
Probst, M.: Dynamic binary translation. In: UKUUG (2002)
Roelke, A., Stan, M.R.: RISC5: implementing the RISC-V ISA in Gem5. In: 1st CARRV (2017)
Salgado, F., Gomes, T., Pinto, S., Cabral, J., Tavares, A.: Condition codes evaluation on dynamic binary translation for embedded platforms. IEEE Embed. Syst. Lett. 9(3), 89–92 (2017)
Shen, B.Y., Chen, J.Y., Hsu, W.C., Yang, W.: LLBT: an LLVM-based static binary translator. In: CASES 2012 (2012)
Smith, J., Nair, R.: Virtual Machines: Versatile Platforms for Systems and Processes. Elsevier, Amsterdam (2005)
Imperas Software: Imperas RISC-V solutions. https://www.imperas.com/imperas-riscv-solutions. Accessed 02 Dec 2018
Imperas Software: OVP simulator for RISC-V. https://github.com/riscv/riscv-ovpsim. Accessed 02 Dec 2018
Ta, T., Cheng, L., Batten, C.: Simulating multi-core RISC-V systems in Gem5. In: 1st CARRV (2018)
Waterman, A., Lee, Y., Patterson, D.A., Asanovi, K.: The RISC-V instruction set manual. Volume 1: user-level ISA, version 2.0. Technical report, EECS Department, University of California, Berkeley (2014)
Zhang, X., Guo, Q., Chen, Y., Chen, T., Hu, W.: HERMES: a fast cross-ISA binary translator with post-optimization. In: CG0 2015 (2015)
Acknowledgments
We would like to thank CNPq (Grant #: 313012/2017-2), CAPES (PROCAD 2966/2014), and the São Paulo Research Foundation, FAPESP (Grant #: 2013/08293-7) for supporting this research.
Author information
Authors and Affiliations
Corresponding authors
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2020 Springer Nature Switzerland AG
About this paper
Cite this paper
Lupori, L., do Rosario, V.M., Borin, E. (2020). High-Performance RISC-V Emulation. In: Bianchini, C., Osthoff, C., Souza, P., Ferreira, R. (eds) High Performance Computing Systems. WSCAD 2018. Communications in Computer and Information Science, vol 1171. Springer, Cham. https://doi.org/10.1007/978-3-030-41050-6_9
Download citation
DOI: https://doi.org/10.1007/978-3-030-41050-6_9
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-41049-0
Online ISBN: 978-3-030-41050-6
eBook Packages: Computer ScienceComputer Science (R0)