国防科技大学自主研制的高性能加速器采用中央处理器(CPU)+通用数字信号处理器(GPDSP)的片上异构融合架构,使用超长指令集(VLIW)+单指令多数据流(SIMD)的向量化结构的GPDSP是峰值性能主要支撑的加速核。主流编译器在密集的数据计算指令排布、为指令静态分配硬件执行单元、GPDSP特有的向量指令等方面不能很好地支持高性能加速器。基于低级虚拟器(LLVM)编译框架,在前寄存器分配调度阶段,结合峰值寄存器压力感知方法(PERP)、蚁群优化(ACO)算法与GPDSP结构特点,优化代价模型,设计支持寄存器压力感知的指令调度模块;在后寄存器分配阶段提出支持静态功能单元分配的指令调度策略,通过冲突检测机制保证功能单元分配的正确性,为指令并行执行提供软件基础;在后端封装一系列丰富且规整的向量指令接口,实现对GPDSP向量指令的支持。实验结果表明,所提出的LLVM编译架构优化方法从功能和性能上实现了对GPDSP的良好支撑,GCC testsuite测试整体性能平均加速比为4。539,SPEC CPU 2017浮点测试整体性能平均加速比为4。49,SPEC CPU 2017整型测试整体性能平均加速比为3。24,使用向量接口的向量程序实现了平均97。1%的性能提升率。
Design and Optimization of LLVM Compiler for Domestic High Performance Accelerator
National University of Defense Technology independently developed a high-performance accelerator that uses an on-chip heterogeneous fusion architecture of a Central Processing Unit(CPU)and General Purpose Digital Signal Processor(GPDSP).The GPDSP,with its Very Long Instruction Word(VLIW)+Single Instruction Multiple Datastream(SIMD)vectorization structure,is the main support for the peak performance acceleration core.However,mainstream compilers cannot adequately support high-performance accelerators in intensive data calculation instruction layouts,static allocation of hardware execution units for instructions,and GPDSP-specific vector instructions.In this study,based on the Low Level Virtual Machine(LLVM)compilation framework,the PERP method,Ant Colony Optimization(ACO)algorithm,and GPDSP structural characteristics are combined to optimize the cost model in the pre-RA-sched stage,and the instruction scheduling module is designed to support register pressure awareness.This study proposes an instruction scheduling strategy that supports static functional unit allocation in the post-RA-sched stage,which guarantees correct functional unit allocation through a conflict detection mechanism,and provides a software basis for the parallel execution of instructions.Furthermore,a series of rich and regular vector instruction interfaces are encapsulated in the backend to support the GPDSP vector instructions.The experimental results demonstrate that the LLVM compilation architecture optimization method proposed in this study provides good support for the GPDSP in terms of both functionality and performance.Specifically,the overall performance average speedup ratio of GCC testsuite is 4.539,the overall performance average speedup ratio of SPEC CPU 2017 floating-point test is 4.49,and the overall performance average speedup ratio of SPEC CPU 2017 integer test is 3.24.Additionally,the vector program using vector interfaces achieves an average performance improvement ratio of 97.1%.
General Purpose Digital Signal Processor(GPDSP)Low Level Virtual Machine(LLVM)compilerinstruction schedulingvector instruction interface