CoRa张量编译器:具有最小填充的粗糙张量编译
The CoRa Tensor Compiler: Compilation for Ragged Tensors with Minimal Padding
摘要:
用于深度学习的输入数据的形状和大小经常会发生变化。在许多情况下,这样的数据可以使用具有不均匀形状的张量或不规则张量来表示。由于对参差不齐的张量的有效执行的有限且不可移植的支持,当前的深度学习框架通常使用诸如填充和掩蔽之类的技术来使数据形状均匀,然后将计算卸载到用于密集张量代数的优化内核。然而,这样的技术可能导致大量浪费的计算,因此导致性能损失。本文介绍了一种张量编译器CoRa,它允许用户轻松地为针对各种CPU和GPU的粗糙张量运算符生成高效代码。在粗糙张量上的各种运算符以及Transformer模型的编码器层上评估CoRa,我们发现CoRa(i)与运算符和Transformer编码器的手动优化实现具有竞争力,并且(ii)在PyTorch上实现,Nvidia GPU上编码器的1.6倍几何加速比和ARM CPU上Transformers中使用的多头注意力模块的1.86倍几何加速比。
英文摘要:
There is often variation in the shape and size of input data used for deep learning. In many cases, such data can be represented using tensors with non-uniform shapes, or ragged tensors. Due to limited and non-portable support for efficient execution on ragged tensors, current deep learning frameworks generally use techniques such as padding and masking to make the data shapes uniform and then offload the computations to optimized kernels for dense tensor algebra. Such techniques can, however, lead to a lot of wasted computation and therefore, a loss in performance. This paper presents CoRa, a tensor compiler that allows users to easily generate efficient code for ragged tensor operators targeting a wide range of CPUs and GPUs. Evaluating CoRa on a variety of operators on ragged tensors as well as on an encoder layer of the transformer model, we find that CoRa (i)performs competitively with hand-optimized implementations of the operators and the transformer encoder and (ii) achieves, over PyTorch, a 1.6X geomean speedup for the encoder on an Nvidia GPU and a 1.86X geomean speedup for the multi-head attention module used in transformers on an ARM CPU.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。