Im2win: Memory Efficient Convolution On SIMD Architectures

Shuai-bing Lu, Jun Chu, X. Liu
{"title":"Im2win: Memory Efficient Convolution On SIMD Architectures","authors":"Shuai-bing Lu, Jun Chu, X. Liu","doi":"10.1109/HPEC55821.2022.9926408","DOIUrl":null,"url":null,"abstract":"Convolution is the most expensive operation among neural network operations, thus its performance is critical to the overall performance of neural networks. Commonly used convolution approaches, including general matrix multiplication (GEMM)-based convolution and direct convolution, rely on im2col for data transformation or do not use data transformation at all, respectively. However, the im2col data transformation can lead to at least 2 x memory footprint compared to not using data transformation at all, thus limiting the size of neural network models running on memory-limited systems. Meanwhile, not using data transformation usually performs poorly due to nonconsecutive memory access although it consumes less memory. To solve those problems, we propose a new memory-efficient data transformation algorithm, called im2win. This algorithm refactorizes a row of square or rectangle dot product windows of the input image and flattens unique elements within these windows into a row in the output tensor, which enables consecutive memory access and data reuse, and thus greatly reduces the memory overhead. Furthermore, we propose a high-performance im2win-based convolution algorithm with various optimizations, including vectorization, loop reordering, etc. Our experimental results show that our algorithm reduces the memory overhead by average to 41.6% compared to the PyTorch's convolution implementation based on im2col, and achieves average to 3.6 × and 5.3× speedup in performance compared to the im2col-based convolution and not using data transformation, respectively.","PeriodicalId":200071,"journal":{"name":"2022 IEEE High Performance Extreme Computing Conference (HPEC)","volume":"48 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2022-09-19","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"1","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"2022 IEEE High Performance Extreme Computing Conference (HPEC)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/HPEC55821.2022.9926408","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 1

Abstract

Convolution is the most expensive operation among neural network operations, thus its performance is critical to the overall performance of neural networks. Commonly used convolution approaches, including general matrix multiplication (GEMM)-based convolution and direct convolution, rely on im2col for data transformation or do not use data transformation at all, respectively. However, the im2col data transformation can lead to at least 2 x memory footprint compared to not using data transformation at all, thus limiting the size of neural network models running on memory-limited systems. Meanwhile, not using data transformation usually performs poorly due to nonconsecutive memory access although it consumes less memory. To solve those problems, we propose a new memory-efficient data transformation algorithm, called im2win. This algorithm refactorizes a row of square or rectangle dot product windows of the input image and flattens unique elements within these windows into a row in the output tensor, which enables consecutive memory access and data reuse, and thus greatly reduces the memory overhead. Furthermore, we propose a high-performance im2win-based convolution algorithm with various optimizations, including vectorization, loop reordering, etc. Our experimental results show that our algorithm reduces the memory overhead by average to 41.6% compared to the PyTorch's convolution implementation based on im2col, and achieves average to 3.6 × and 5.3× speedup in performance compared to the im2col-based convolution and not using data transformation, respectively.
Im2win: SIMD架构上的内存高效卷积
卷积运算是神经网络运算中代价最高的运算,其性能对神经网络的整体性能至关重要。常用的卷积方法,包括基于一般矩阵乘法(GEMM)的卷积和直接卷积,分别依赖im2col进行数据转换,或者根本不使用数据转换。然而,与根本不使用数据转换相比,im2col数据转换可能导致至少2倍的内存占用,从而限制了在内存有限的系统上运行的神经网络模型的大小。同时,不使用数据转换虽然消耗较少的内存,但由于非连续内存访问,通常性能较差。为了解决这些问题,我们提出了一种新的内存高效数据转换算法,称为im2win。该算法对输入图像的一行正方形或矩形点积窗口进行重构,并将这些窗口内的唯一元素平坦化为输出张量中的一行,从而实现连续的内存访问和数据重用,从而大大降低了内存开销。此外,我们提出了一种高性能的基于im2win的卷积算法,并进行了各种优化,包括向量化、循环重排序等。我们的实验结果表明,与PyTorch基于im2col的卷积实现相比,我们的算法平均减少了41.6%的内存开销,与基于im2col的卷积和不使用数据转换相比,我们的算法在性能上分别实现了3.6倍和5.3倍的平均加速。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信