[Paper Review] TIRAMISU: A Polyhedral Compiler for Dense and Sparse Deep Learning
Tiramisu is a polyhedral compiler that generates highly optimized code for sparse and recurrent neural networks (RNNs) on multicore CPUs by leveraging the polyhedral model and user-guided scheduling commands. It achieves up to 5× speedup over Intel MKL-DNN and outperforms state-of-the-art compilers by up to 2× on deep learning benchmarks, demonstrating the first DNN compiler to efficiently exploit unstructured weight sparsity and support general RNNs with unknown unrolling factors.
In this paper, we demonstrate a compiler that can optimize sparse and recurrent neural networks, both of which are currently outside of the scope of existing neural network compilers (sparse neural networks here stand for networks that can be accelerated with sparse tensor algebra techniques). Our demonstration includes a mapping of sparse and recurrent neural networks to the polyhedral model along with an implementation of our approach in TIRAMISU, our state-of-the-art polyhedral compiler. We evaluate our approach on a set of deep learning benchmarks and compare our results with hand-optimized industrial libraries. Our results show that our approach at least matches Intel MKL-DNN and in some cases outperforms it by 5x (on multicore-CPUs).
Motivation & Objective
- To address the lack of support for sparse and recurrent neural networks in existing deep learning compilers.
- To enable high-performance code generation for unstructured weight sparsity, which is difficult to accelerate with conventional compilers.
- To support general RNNs with dynamic unrolling factors, which are not expressible in acyclic dataflow compilers.
- To outperform existing industrial and academic compilers on multicore CPUs through advanced loop and data layout transformations.
- To demonstrate that polyhedral compilers with user-scheduling can achieve superior performance compared to fully automatic or restricted-structure compilers.
Proposed method
- The compiler uses a domain-specific language (DSL) embedded in C++ to express the algorithm and scheduling commands separately, enabling architecture-independent high-level specification.
- It maps sparse and recurrent neural networks into the polyhedral model, allowing complex affine transformations such as loop tiling, fusion, vectorization, and iteration space skewing.
- Scheduling commands are used to guide code generation, giving users fine-grained control over optimizations like array packing, register blocking, and data prefetching.
- The polyhedral representation enables correct dependence analysis, allowing legal but conservative fusion and transformation decisions that avoid illegal code generation.
- The system supports non-rectangular iteration spaces and cyclic dataflow graphs, enabling modeling of general RNNs with unknown unrolling factors.
- It integrates with high-level frameworks like PyTorch and generates optimized C++ code targeting multicore CPUs with performance-critical optimizations.
Experimental results
Research questions
- RQ1Can a polyhedral compiler effectively optimize deep neural networks with unstructured weight sparsity, which are typically ignored by existing DNN compilers?
- RQ2How can a compiler express and optimize general recurrent neural networks where the unrolling factor is not known at compile time?
- RQ3Can user-guided scheduling in a polyhedral compiler outperform fully automatic schedulers and industrial libraries in terms of performance on CPU architectures?
- RQ4What is the impact of advanced optimizations like array packing, register blocking, and prefetching on sparse and recurrent DNNs when applied via a polyhedral framework?
- RQ5To what extent can a compiler based on the polyhedral model achieve performance comparable or superior to hand-optimized libraries like Intel MKL-DNN?
Key findings
- Tiramisu achieves up to 5× speedup over Intel MKL-DNN on multicore CPUs for sparse and recurrent DNNs, demonstrating significant performance gains.
- The compiler matches Intel MKL-DNN performance on all benchmarks and outperforms it in several cases, particularly for unstructured sparsity.
- Tiramisu is the first DNN compiler to generate efficient code for unstructured weight sparsity, enabling performance improvements from reduced computation and memory access.
- It successfully expresses and optimizes general RNNs with unknown unrolling factors, a capability not supported by Halide or other acyclic dataflow compilers.
- The use of scheduling commands enables fine-grained control over optimizations such as array packing and prefetching, which are missing in fully automatic polyhedral compilers.
- Tiramisu outperforms state-of-the-art compilers by up to 2×, showing that user-guided scheduling in a polyhedral framework can surpass fully automatic approaches.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.