• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

计算机工程与科学 ›› 2021, Vol. 43 ›› Issue (09): 1521-1528.

• 高性能计算 • 上一篇    下一篇

基于FPGA的卷积神经网络加速器动态余数处理映射模型

赵小强,姜晶菲,许金伟,窦勇   

  1. (国防科技大学计算机学院,湖南 长沙 410073)
  • 收稿日期:2020-06-11 修回日期:2020-07-07 接受日期:2021-09-25 出版日期:2021-09-25 发布日期:2021-09-24
  • 基金资助:
    核高基国家重大专项(2018ZX01028101);预研项目(31513010602-1)

A dynamic remainder processing mapping model for convolutional neural network accelerator on FPGA

ZHAO Xiao-qiang,JIANG Jing-fei,XU Jin-wei,DOU Yong   

  1. (College of Computer Science and Technology,National University of Defense Technology,Changsha 410073,China)

  • Received:2020-06-11 Revised:2020-07-07 Accepted:2021-09-25 Online:2021-09-25 Published:2021-09-24

摘要: 将卷积计算转化为矩阵乘法是FPGA上一种高效实现,而现有的转化方法无法根据卷积参数的不同动态调整,限制了卷积计算的并行度。提出一种新的动态余数处理映射模型。该映射模型包含有3个子模型:特征值映射模型,权值映射模型,和输出映射模型。特征值映射模型将特征值转化为特征值矩阵,权值映射模型将权值转化为权值矩阵,特征值矩阵和权值矩阵通过乘累加计算阵列得到卷积计算结果,由输出映射模型将卷积计算结果存储到内存中。在卷积计算过程中,卷积的输出通道数通常不是乘累加计算阵列行数的整数倍,3个子映射模型会根据产生的余数动态调整映射方法,提高乘累加计算阵列的利用率。通过实验表明,采用动态余数处理映射模型能够将余数并行度的倍数至多提高到卷积核大小,使整个加速器达到了更高的实际吞吐量和能量效率。


关键词: 卷积, 矩阵乘法, FPGA, 动态余数处理

Abstract: Mapping convolutions to matrix multiplications is an efficient implementation on FPGA. However, the existing conversion methods cannot be dynamically adjusted according to different convolution parameters, which limits the parallelism of convolution calculation. This paper proposes a novel dynamic residue processing mapping model. The mapping model contains three sub-models: feature mapping model, weight mapping model, and output mapping model. The feature mapping model converts features into a feature matrix, and the weight mapping model converts weights into a weight matrix. The feature matrix and the weight matrix obtain convolution calculation results by multiply-and- accumulate array, and the convolution calculation results are stored in the memory by the output mapping model. In the process of convolution calculation, the number of output channels of the convolution is usually not an integer multiple of the number of rows of the multiply-and-accumulate array. The three sub-mapping models will dynamically adjust the mapping method according to the remaining number to increase the utilization of the multiply-accumulated array. Experiments show that using the dynamic remainder processing mapping model can increase the multiple of parallelism up to the size of the convolution kernel and achieve higher actual throughput and energy efficiency.

Key words: convolution, matrix multiplication, FPGA, dynamic remainder processing