[论文解读] Automating Generation of Low Precision Deep Learning Operators
本文提出了一种工作流程,利用TVM的自动调优和代码生成技术,自动为CPU生成高性能低精度深度学习算子。在Raspberry Pi 3B上,该方法相较于16位整数基线实现最高16倍的加速,并在1比特权值和2比特激活卷积上超越手写优化的ARM内核2.3倍性能。
State of the art deep learning models have made steady progress in the fields of computer vision and natural language processing, at the expense of growing model sizes and computational complexity. Deploying these models on low power and mobile devices poses a challenge due to their limited compute capabilities and strict energy budgets. One solution that has generated significant research interest is deploying highly quantized models that operate on low precision inputs and weights less than eight bits, trading off accuracy for performance. These models have a significantly reduced memory footprint (up to 32x reduction) and can replace multiply-accumulates with bitwise operations during compute intensive convolution and fully connected layers. Most deep learning frameworks rely on highly engineered linear algebra libraries such as ATLAS or Intel's MKL to implement efficient deep learning operators. To date, none of the popular deep learning directly support low precision operators, partly due to a lack of optimized low precision libraries. In this paper we introduce a work flow to quickly generate high performance low precision deep learning operators for arbitrary precision that target multiple CPU architectures and include optimizations such as memory tiling and vectorization. We present an extensive case study on low power ARM Cortex-A53 CPU, and show how we can generate 1-bit, 2-bit convolutions with speedups up to 16x over an optimized 16-bit integer baseline and 2.3x better than handwritten implementations.
研究动机与目标
- 解决深度学习框架中针对CPU的低精度优化算子缺乏的问题。
- 通过为任意低精度(1–4比特)生成高效位串行算子,实现在低功耗设备上的高性能推理。
- 克服朴素位串行实现中的性能瓶颈,其性能甚至低于8位整数运算。
- 证明自动化代码生成结合自动调优可在ARM和X86架构上超越手写优化内核。
- 实现高度量化模型(如1比特权值、2比特激活)的部署,仅需极少工程投入并具备最大可移植性。
提出的方法
- 扩展TVM以支持量化数据类型及位级操作,如位打包和位串行矩阵乘法。
- 利用TVM的自动调优基础设施,在不同CPU架构上搜索最优内存分块和向量化参数。
- 实现一个灵活的算子库,支持量化、位打包和低精度卷积,并具备可定制的调度策略。
- 利用向量指令(如ARM NEON、X86 AVX2)和原地卷积,减少内存带宽和数据冗余。
- 应用张量化内层循环调度,将低精度操作高效映射到底层硬件指令集。
- 为X86使用通用CPU调度,为ARM使用定制调度,以在目标设备上最大化性能。
实验结果
研究问题
- RQ1自动化代码生成结合自动调优能否在低功耗CPU上生成优于手写优化实现的低精度深度学习算子?
- RQ2在1–4比特精度的位串行卷积核中,内存分块和向量化对性能有何影响?
- RQ3在ARM和X86上,不同位宽组合(如W1A1、W2A2、W4A4)的低精度卷积性能如何随精度变化而扩展?
- RQ4如向量化popcount和指令级并行等架构特性,对低精度推理可实现的加速程度有何影响?
- RQ5单一代码生成工作流程能否在极少人工调优的情况下有效支持多种CPU架构?
主要发现
- 所提出的工作流程在ARM Cortex-A53上,对1比特权值和2比特激活卷积的性能相较16位整数基线最高实现16倍加速。
- 在Raspberry Pi 3B上,单线程实现相较手写优化的Caffe2超低精度库性能提升2.3倍,尤其在步长为2的1x1卷积上表现更优。
- 通过TVM自动调优获得的优化分块参数,在排除性能较差的层后,相较基线实现性能提升1.6倍。
- 在X86上,通用CPU调度相较32位浮点基线实现平均加速5.38倍(W1A1)、2.73倍(W1A2)和1.69倍(W2A2)。
- 尽管计算复杂度相同,W2A2相较W1A4性能提升1.3倍,证明了跨比特平面改进数据重用的优势。
- 在Raspberry Pi上使用生成的1比特权值和2比特激活算子进行ResNet18端到端推理,相较全精度推理实现3.3倍加速。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。