PDL Abstract

THE CORA TENSOR COMPILER: COMPILATION FOR RAGGED TENSORS WITH MINIMAL PADDING

Proceedings of the 5th MLSys Conference, Santa Clara, CA, USA, August, 2022..

Pratik Fegade1, Tianqi Chen1,2, Phillip B. Gibbons1, Todd C. Mowry1

1 Carnegie Mellon University
2 OctoML

http://www.pdl.cmu.edu/

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 a 1.6× geomean speedup over PyTorch for the encoder on an Nvidia GPU and a 1.37× geomean speedup over TensorFlow for the multi-head attention module used in transformers on a 64-core ARM CPU.

FULL PAPER: pdf