arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2306.14316cs.NEcs.AIcs.LG
收藏

Im2win:一种高效的 GPU 卷积范式

Im2win: An Efficient Convolution Paradigm on GPU

Nanchang Hangkong University(南昌航空大学);University of California Merced(加州大学默塞德分校);University of Washington(华盛顿大学)

Shuai Lu, Jun Chu, Luanzheng Guo, Xu T. Liu

AI总结:

本文提出了一种名为 im2win 的基于窗口顺序的 GPU 卷积范式,通过减少内存占用并提供连续内存访问,结合多种内核优化技术,在多个 DNN 基准上显著提升了性能并降低了内存消耗。

摘要:

卷积是深度神经网络操作中最耗时的运算,因此其性能对神经网络的整体性能至关重要。GPU 上常用的卷积方法包括基于通用矩阵乘法(GEMM)的卷积和直接卷积。基于 GEMM 的卷积依赖于 im2col 算法,这会导致较大的内存占用并降低性能。直接卷积没有较大的内存占用问题,但由于内存访问不连续,其性能无法与基于 GEMM 的方法相媲美。本文提出了一种基于窗口顺序的 GPU 卷积范式,称为 im2win,它不仅减少了内存占用,还提供了连续的内存访问,从而提升了性能。此外,我们在卷积 CUDA 内核上应用了一系列优化技术,包括共享内存、分块、微内核、双缓冲和预取。我们将我们的实现与直接卷积、PyTorch 中基于 GEMM 且使用 cuBLAS 的卷积,以及六种基于 cuDNN 的卷积实现,在十二个最先进的 DNN 基准上进行了比较。实验结果表明,我们的实现:1)与 cuBLAS 相比,内存占用减少了 23.1%,并实现了 3.5 倍的 TFLOPS;2)与 cuDNN 中性能最佳的卷积相比,内存占用减少了 32.8%,并实现了高达 1.8 倍的 TFLOPS;3)与直接卷积相比,实现了高达 155 倍的 TFLOPS。我们进一步对所应用的优化技术进行了消融研究,发现微内核对性能的提升影响最大。

英文摘要:

Convolution is the most time-consuming operation in deep neural network operations, so its performance is critical to the overall performance of the neural network. The commonly used methods for convolution on GPU include the general matrix multiplication (GEMM)-based convolution and the direct convolution. GEMM-based convolution relies on the im2col algorithm, which results in a large memory footprint and reduced performance. Direct convolution does not have the large memory footprint problem, but the performance is not on par with GEMM-based approach because of the discontinuous memory access. This paper proposes a window-order-based convolution paradigm on GPU, called im2win, which not only reduces memory footprint but also offers continuous memory accesses, resulting in improved performance. Furthermore, we apply a range of optimization techniques on the convolution CUDA kernel, including shared memory, tiling, micro-kernel, double buffer, and prefetching. We compare our implementation with the direct convolution, and PyTorch's GEMM-based convolution with cuBLAS and six cuDNN-based convolution implementations, with twelve state-of-the-art DNN benchmarks. The experimental results show that our implementation 1) uses less memory footprint by 23.1% and achieves 3.5$\times$ TFLOPS compared with cuBLAS, 2) uses less memory footprint by 32.8% and achieves up to 1.8$\times$ TFLOPS compared with the best performant convolutions in cuDNN, and 3) achieves up to 155$\times$ TFLOPS compared with the direct convolution. We further perform an ablation study on the applied optimization techniques and find that the micro-kernel has the greatest positive impact on performance.

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

↑