RAF:用于深度学习模型训练的整体编译
RAF: Holistic Compilation for Deep Learning Model Training
摘要:
随着深度学习在现代应用中的普及,许多深度学习框架被提出来供深度学习从业者快速开发和训练DNN模型。与此同时,随着近年来训练大型深度学习模型成为一种趋势,训练吞吐量和内存占用变得至关重要。因此,通过编译器优化来优化训练工作量是必然的,也越来越受到人们的关注。然而,现有的深度学习编译器(DLC)主要以推理为目标,并且在训练工作负载中没有结合整体优化,例如自动微分和自动混合精度。在本文中,我们提出了RAF,一个用于训练的深度学习编译器。与现有的DLC不同,RAF接受前向模型并在内部生成训练图。因此,RAF能够系统地整合性能,内存和分布式训练的图形优化。此外,为了赶上手工制作的内核库以及张量编译器的最新性能,RAF提出了一种操作符方言机制来无缝集成所有可能的内核实现。我们证明,通过内部训练图生成和操作员方言机制,我们能够执行整体优化,并针对PyTorch(渴望和torchscript模式),XLA和DeepSpeed针对GPU上流行的Transformer模型实现更好的训练吞吐量或更大的批量。
英文摘要:
As deep learning is pervasive in modern applications, many deep learning frameworks are presented for deep learning practitioners to develop and train DNN models rapidly. Meanwhile, as training large deep learning models becomes a trend in recent years, the training throughput and memory footprint are getting crucial. Accordingly, optimizing training workloads with compiler optimizations is inevitable and getting more and more attentions. However, existing deep learning compilers (DLCs) mainly target inference and do not incorporate holistic optimizations, such as automatic differentiation and automatic mixed precision, in training workloads. In this paper, we present RAF, a deep learning compiler for training. Unlike existing DLCs, RAF accepts a forward model and in-house generates a training graph. Accordingly, RAF is able to systematically consolidate graph optimizations for performance, memory and distributed training. In addition, to catch up to the state-of-the-art performance with hand-crafted kernel libraries as well as tensor compilers, RAF proposes an operator dialect mechanism to seamlessly integrate all possible kernel implementations. We demonstrate that by in-house training graph generation and operator dialect mechanism, we are able to perform holistic optimizations and achieve either better training throughput or larger batch size against PyTorch (eager and torchscript mode), XLA, and DeepSpeed for popular transformer models on GPUs.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。