arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1709.03395cs.CV
收藏

基于低内存GEMM的深度神经网络卷积算法

Low-memory GEMM-based convolution algorithms for deep neural networks

Lero, School of Computer Science & Statistics, Trinity College Dublin(都柏林圣三一学院计算机科学与统计学院 Lero);Synopsys Inc, Dublin(新思科技,都柏林)

Andrew Anderson, Aravind Vasudevan, Cormac Keane, David Gregg

摘要:

深度神经网络(DNN)在现场部署时需要非常大量的计算来进行训练和推理。实现DNN的一种常见方法是将计算成本最高的运算重新转换为通用矩阵乘法(GEMM)。然而,正如我们在本文中所展示的那样,有很多不同的方法可以使用GEMM来表达DNN卷积运算。虽然不同的方法都执行相同数量的操作,但临时数据结构的大小差异很大。使用经典的im2col方法,具有维度$C \times H \times W$的输入矩阵的卷积需要$O(K^2CHW)$附加空间。最近,已经提出了仅需要$O(KCHW)$辅助空间的存储器有效的方法。我们提出了两种新的基于GEMM的算法,分别只需要$O(MHW)$和$O(KW)$额外的空间,其中$M$是卷积结果中的通道数。这些算法大大减少了DNN卷积的空间开销,使其更适合内存有限的嵌入式系统。实验评估表明,我们的低内存算法是一样快的最好的补丁建设的方法,尽管只需要一小部分的额外的内存量。我们的低内存算法具有出色的数据局部性,这使它们在使用多个核心时比补丁构建算法更具优势。因此,我们的低内存算法往往优于最好的补丁建设算法使用多线程。

英文摘要:

Deep neural networks (DNNs) require very large amounts of computation both for training and for inference when deployed in the field. A common approach to implementing DNNs is to recast the most computationally expensive operations as general matrix multiplication (GEMM). However, as we demonstrate in this paper, there are a great many different ways to express DNN convolution operations using GEMM. Although different approaches all perform the same number of operations, the size of temporary data structures differs significantly. Convolution of an input matrix with dimensions $C \times H \times W$, requires $O(K^2CHW)$ additional space using the classical im2col approach. More recently memory-efficient approaches requiring just $O(KCHW)$ auxiliary space have been proposed. We present two novel GEMM-based algorithms that require just $O(MHW)$ and $O(KW)$ additional space respectively, where $M$ is the number of channels in the result of the convolution. These algorithms dramatically reduce the space overhead of DNN convolution, making it much more suitable for memory-limited embedded systems. Experimental evaluation shows that our low-memory algorithms are just as fast as the best patch-building approaches despite requiring just a fraction of the amount of additional memory. Our low-memory algorithms have excellent data locality which gives them a further edge over patch-building algorithms when multiple cores are used. As a result, our low memory algorithms often outperform the best patch-building algorithms using multiple threads.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑