FlexPDA: 一种面向深度学习加速器的灵活的编程框架
FlexPDA: A Flexible Programming Framework for Deep Learning Accelerators
-
摘要: 1、研究背景(Context):近年来,深度学习加速器被广泛部署在图片分类、语音识别、自动驾驶等领域中。虽然深度学习加速器在性能、能效方面与日俱进,但是它的可编程性对开发者来说仍然是一个挑战。现有的方法通过深度学习框架来完成智能应用在深度学习加速器上的部署,但这种方法对开发人员来说并不灵活,因为框架支持的是端到端的网络,对细粒度操作的支持是不友好的。本文提出了一个通用编程框架来帮助用户在深度学习加速器上实现高效、灵活的应用开发,为开发者提供了更多的低层次的优化机会。
2、目的(Objective):本文的目的是为深度学习加速器设计一套灵活的编程框架。一方面,用户可以基于编程框架实现低层次的优化,编程框架的存储层次设计可以帮助用户准确地控制变量在加速器的片上存储,以此来降低访问延迟;用户可以利用算法的计算模式来设计诸如双buffer之类的优化。另一方面,新型神经网络结构为了满足不同需求的计算复杂度和访存任务,通常会引入新的操作。利用本文提出的编程框架中的数据结构和计算接口,用户可以实现自定义的神经网络特定功能模块。
3、方法(Method):首先,本文对深度学习应用和DaDianNao类的加速器架构进行了抽象,设计了一个编程框架FlexPDA。FlexPDA的前端是一个领域特定语言,后端是一个代码生成器。领域特定语言是基于C语言的一种扩展,后端的代码生成器是基于LLVM的一种实现。在语言的设计中,我们针对应用特点设计了一种张量数据结构和一系列高效的计算接口;在后端代码生成器中,针对深度学习加速器的存储和计算特性,我们对数据布局进行了优化,自动生成高性能代码。
4、结果(Result & Findings):本文使用10个典型的神经网络算子和AlexNet神经网络对提出的FlexPDA编程框架进行评估。实验结果表明,通过数据布局优化,在DaDianNao平台上,神经网络算子的性能可以提高1.79x~77.63x。此外,与低层次算子库DLPlib相比,在AlexNet的推理中,FlexPDA可以实现1.62x的加速。
5、结论(Conclusions):本文为DaDianNao类的深度学习加速器设计了一个灵活高效的编程框架FlexPDA。本文在实验部分将FlexPDA与现有的基于库的方法进行了比较,实验结果表明,通过数据布局优化和低层次的调优,FlexPDA可以实现1.62x的加速。FlexPDA是基于深度学习加速器的体系结构特征进行设计的,因此可以应用到具有相同存储和指令特征加速器中,如Cambricon-X。在未来工作中,我们将研究更多的编译优化技术,如使用多面体模型进行程序并行性的优化。Abstract: There are a wide variety of intelligence accelerators with promising performance and energy efficiency, deployed in a broad range of applications such as computer vision and speech recognition. However, programming productivity hinders the deployment of deep learning accelerators. The low-level library invoked in the high-level deep learning framework which supports the end-to-end execution with a given model, is designed to reduce the programming burden on the intelligence accelerators. Unfortunately, it is inflexible for developers to build a network model for every deep learning application, which probably brings unnecessary repetitive implementation. In this paper, a flexible and efficient programming framework for deep learning accelerators, FlexPDA, is proposed, which provides more optimization opportunities than the low-level library and realizes quick transplantation of applications to intelligence accelerators for fast upgrades. We evaluate FlexPDA by using 10 representative operators selected from deep learning algorithms and an end-to-end network. The experimental results validate the effectiveness of FlexPDA, which achieves an end-to-end performance improvement of 1.620x over the low-level library.