arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2006.10226cs.DCcs.LGcs.PL
收藏

量化深度学习模型的高效执行:一种更简单的方法

Efficient Execution of Quantized Deep Learning Models: A Compiler Approach

Amazon Web Services(亚马逊云科技);Edgecortix Inc.(Edgecortix公司)

Animesh Jain, Shoubhik Bhattacharya, Masahiro Masuda, Vin Sharma, Yida Wang

摘要:

越来越多的应用程序使用深度学习模型来实现预测功能,这需要大量使用计算和内存。一种用于提高资源效率的流行技术是8位整数量化,其中使用较短的8位整数来表示32位浮点数(fp32)。尽管TensorFlow、TFLite、MXNet和PyTorch等深度学习框架使开发人员能够以较小的准确度降低对模型进行量化,但它们并不适合在各种硬件平台上执行量化模型。例如,TFLite经过优化,可以在ARM CPU边缘设备上运行推理,但它对Intel CPU和Nvidia GPU没有有效的支持。在本文中,我们通过提出一种增强编译器方法来解决在不同硬件平台上执行量化深度学习模型的挑战。诸如Apache TVM之类的深度学习编译器可以在各种目标上有效执行来自各种框架的模型。然而,今天的许多深度学习编译器主要是为fp32计算而设计的,无法优化预量化的INT 8模型。为了解决这个问题,我们创建了一个新的方言,称为量化神经网络(QNN),它扩展了编译器的内部表示与量化上下文。有了这个量化上下文,编译器可以在各种硬件平台上为预量化模型生成有效的代码。正如在Apache TVM中实现的那样,我们观察到QNN增强的深度学习编译器在Intel Xeon Cascade Lake CPU、Nvidia Tesla T4 GPU、ARM Raspberry Pi3和Pi4上分别实现了2.35倍、2.15倍、1.35倍和1.40倍的加速比,而fp32执行则得到了很好的优化,并且性能与最先进的特定于框架的解决方案相当。

英文摘要:

A growing number of applications implement predictive functions using deep learning models, which require heavy use of compute and memory. One popular technique for increasing resource efficiency is 8-bit integer quantization, in which 32-bit floating point numbers (fp32) are represented using shorter 8-bit integer numbers. Although deep learning frameworks such as TensorFlow, TFLite, MXNet, and PyTorch enable developers to quantize models with only a small drop in accuracy, they are not well suited to execute quantized models on a variety of hardware platforms. For example, TFLite is optimized to run inference on ARM CPU edge devices but it does not have efficient support for Intel CPUs and Nvidia GPUs. In this paper, we address the challenges of executing quantized deep learning models on diverse hardware platforms by proposing an augmented compiler approach. A deep learning compiler such as Apache TVM can enable the efficient execution of model from various frameworks on various targets. Many deep learning compilers today, however, are designed primarily for fp32 computation and cannot optimize a pre-quantized INT8 model. To address this issue, we created a new dialect called Quantized Neural Network (QNN) that extends the compiler's internal representation with a quantization context. With this quantization context, the compiler can generate efficient code for pre-quantized models on various hardware platforms. As implemented in Apache TVM, we observe that the QNN-augmented deep learning compiler achieves speedups of 2.35x, 2.15x, 1.35x and 1.40x on Intel Xeon Cascade Lake CPUs, Nvidia Tesla T4 GPUs, ARM Raspberry Pi3 and Pi4 respectively against well optimized fp32 execution, and comparable performance to the state-of-the-art framework-specific solutions.

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

↑