The rise of hardware accelerators with custom instructions necessitates custom compiler backends supporting these accelerators. This study provides detailed analyses of LLVM and its RISC-V backend, supplemented with case studies providing end-to-end overview of the mentioned transformations.
We discuss that instruction design should consider both hardware and software design space. The necessary compiler modifications may mean that the instruction is not well designed and need to be reconsidered. We discuss that RISC-V standard extensions provide exemplary instructions that can guide instruction designers.
In this study, the process of adding a custom instruction to compiler is split into two parts as Assembler support and pattern matching support. Without pattern matching support, conventional software requires manual entries of inline Assembly for the accelerator which is not scalable. While it is trivial to add Assembler support regardless of the instruction semantics, pattern matching support is on the contrary. Pattern matching support and choosing the right stage for the modification, requires the knowledge of the internal transformations in the compiler. This study delves deep into pattern matching and presents multiple ways to approach the problem of pattern matching support. It is discussed that depending on the pattern's complexity, higher level transformations, e.g. IR level, can be more maintainable compared to Instruction Selection phase.
Optimizing Tensor Train Decomposition in DNNs for RISC-V Architectures Using Design Space Exploration and Compiler Optimizations
School of Informatics, Aristotle University of Thessaloniki(阿尔基托斯大学信息学院);School of Engineering, Computing and Mathematics, University of Plymouth(普利茅斯大学工程、计算与数学学院);School of Informatics, Reutlingen University(鲁特林根大学信息学院)
随着RISC-V(一种开源ISA)的广泛普及,针对特定国防需求的定制硬件安全解决方案越来越受欢迎。这些解决方案通常需要专门的编译器,可以将元数据(称为标签)插入到生成的二进制文件中,和/或使用新指令扩展RISC-V ISA。开发这样的编译器可能是一个冗长而耗时的过程。在本文中,我们提出了COGENT,一个通用的指令标记生成器的RISC-V架构。COGENT能够将可配置和可变宽度(1到20位)的标记与每个指令相关联。它还能够发出对控制流完整性(CFI)解决方案的实现至关重要的标签。COGENT将所有标记和标签编码为nop指令,从而提供完全的向后兼容性。我们在SPEC CPU 2017基准测试套件的一个程序子集上评估了COGENT,并报告了最低和最高标签覆盖水平的二进制大小分别增加了29.3%和18.27%。此外,我们在COTS RISC-V未修改的硬件上执行标记程序,发现最低和最高覆盖级别的执行时间开销(相对于向后兼容性)分别为13.4%和5.72%。最后,使用案例研究,我们提出了可能的用例场景,COGENT可以应用。
National Institute of Science Education and Research(国家科学教育与研究所);Sri Sri University(斯里斯里大学);Gandhi Institute of Engineering and Technology University(甘地工程技术学院大学);Homi Bhabha National Institute(霍米·巴巴国家研究所)