DyCL:通过程序重写与图优化的动态神经网络编译
DyCL: Dynamic Neural Network Compilation Via Program Rewriting and Graph Optimization
AI总结:
DyCL 通过程序分析与变换将动态神经网络分解为多个无条件语句的子网络并独立编译,同时生成主机模块建模控制流,使现有 DL 编译器能以 100% 成功率编译 DyNNs,并获得 1.12 至 20.21 倍的性能提升。
摘要:
深度学习(DL)编译器的主要功能是将使用 PyTorch 和 TensorFlow 等高级 DL 框架编写的深度神经网络(DNN)程序翻译为可移植的可执行文件,这些可执行文件随后可由部署的主机程序灵活执行。然而,现有 DL 编译器依赖追踪机制,该机制需要向神经网络程序提供运行时输入,并追踪程序执行路径以生成编译所需的计算图。不幸的是,在处理现代动态神经网络(DyNNs)时,这种机制存在不足,因为 DyNNs 的计算图会根据输入的不同而变化。因此,传统 DL 编译器难以将 DyNNs 准确编译为可执行代码。为了解决这一局限性,我们提出了 DyCL,这是一种通用方法,能够使任何现有 DL 编译器成功编译 DyNNs。DyCL 通过引入一种编译机制来应对 DyNNs 的动态特性,该机制在编译过程中重新分配原始 DNN 程序的控制流和数据流。具体而言,DyCL 开发了程序分析和程序变换技术,将动态神经网络转换为多个子神经网络。每个子神经网络都不包含条件语句,并且被独立编译。此外,DyCL 还综合生成了一个主机模块,用于建模 DyNNs 的控制流并促进子神经网络的调用。我们的评估证明了 DyCL 的有效性,在编译所有动态神经网络时实现了 100% 的成功率。此外,DyCL 生成的编译后可执行文件表现出显著提升的性能,其运行速度比在通用 DL 框架上执行的原始 DyNNs 快 1.12 倍到 20.21 倍。
英文摘要:
DL compiler's primary function is to translate DNN programs written in high-level DL frameworks such as PyTorch and TensorFlow into portable executables. These executables can then be flexibly executed by the deployed host programs. However, existing DL compilers rely on a tracing mechanism, which involves feeding a runtime input to a neural network program and tracing the program execution paths to generate the computational graph necessary for compilation. Unfortunately, this mechanism falls short when dealing with modern dynamic neural networks (DyNNs) that possess varying computational graphs depending on the inputs. Consequently, conventional DL compilers struggle to accurately compile DyNNs into executable code. To address this limitation, we propose \tool, a general approach that enables any existing DL compiler to successfully compile DyNNs. \tool tackles the dynamic nature of DyNNs by introducing a compilation mechanism that redistributes the control and data flow of the original DNN programs during the compilation process. Specifically, \tool develops program analysis and program transformation techniques to convert a dynamic neural network into multiple sub-neural networks. Each sub-neural network is devoid of conditional statements and is compiled independently. Furthermore, \tool synthesizes a host module that models the control flow of the DyNNs and facilitates the invocation of the sub-neural networks. Our evaluation demonstrates the effectiveness of \tool, achieving a 100\% success rate in compiling all dynamic neural networks. Moreover, the compiled executables generated by \tool exhibit significantly improved performance, running between $1.12\times$ and $20.21\times$ faster than the original DyNNs executed on general-purpose DL frameworks.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。