OLLIE: Derivation-based Tensor Program Optimizer

Liyan Zheng, Haojie Wang, Jidong Zhai, Muyan Hu, Zixuan Ma, Tuowei Wang, Shizhi Tang, Lei Xie, Kezhao Huang, Zhihao JiaarXiv 2022 · DOI

Introduction

Optimizing Deep Learning (DL) models typically occurs in two distinct stages: graph-level rearrangement of predefined operators (e.g., TASO, PET) and hardware-specific scheduling of those operators (e.g., TVM, Ansor). However, a significant optimization gap exists in the expression space. Existing tools are constrained to "Predefined Operator Representable" (POR) expressions, preventing them from decomposing standard operators into underlying mathematical forms to find more efficient, non-standard representations.

Comparison of search spaces between OLLIE and existing optimizers.

OLLIE addresses this by exploring a "general" expression search space through formal mathematical derivations. By treating optimization as a derivation problem, OLLIE can "invent" high-performance computation paths that manual rule-based systems often miss.

Methodology

OLLIE introduces a derivation-based framework composed of several key innovations:

  • General Tensor Algebra Expressions: Computation is represented using formal traversal and summation notations rather than opaque operator names, enabling the representation of any tensor computation.
  • Derivation Rules: A set of mathematical rules--such as variable substitution and summation splitting--is used to transform expressions into functionally equivalent but potentially faster versions.
  • Hybrid Derivation Optimizer: To navigate the vast search space, OLLIE employs a two-stage search. An explorative phase broadly applies rules to find diverse mathematical forms, while a guided phase uses an iterator mapping table to steer these expressions toward patterns matching high-performance vendor libraries (e.g., cuBLAS).
  • eOperators: For derived expressions that do not match standard library kernels, OLLIE generates custom "eOperators" and utilizes code-generation frameworks like TVM for compilation.
The OLLIE optimization workflow and its derivation-based components.

Evaluation and Results

The system was evaluated on seven diverse DNN models, including vision (ResNet-18, SRCNN, GCN, CSRNet), generative (InfoGAN, DCGAN), and NLP (Longformer) workloads, using NVIDIA Tesla A100 and V100 GPUs.

OLLIE achieved significant performance gains, outperforming state-of-the-art optimizers like TensorRT and PET by up to 2.73x on the A100. Across all models, it provided an average speedup of 1.46x (A100) and 1.51x (V100). A key highlight was the discovery of a novel transformation for ConvTranspose in InfoGAN, which reduced L2 cache usage by nearly 4.4x, demonstrating the power of automated mathematical derivation over fixed rule sets.

Key Insights

  • Beyond Predefined Operators: The most effective implementation for a model often involves mathematical forms absent from standard libraries. OLLIE's ability to derive these forms is its primary advantage.
  • Hybrid Execution Strategy: By matching compute-bound math to optimized vendor kernels and using auto-generated eOperators for memory-bound logic, OLLIE balances performance and flexibility.
  • Iterator Mapping: Focusing on how loops access tensors provides a robust "fingerprint" for matching abstract math to hardware-specific kernels.

Conclusion and Future Work

While OLLIE demonstrates substantial improvements, challenges remain regarding search overhead for extremely complex derivations and potential kernel launch overhead from numerous small eOperators. Future work includes extending OLLIE's derivation rules to target specialized AI accelerators like TPUs or NPUs with unique memory hierarchies.

Summary updated

BibTeX
@misc{zheng2022ollie,
  author = {Liyan Zheng and Haojie Wang and Jidong Zhai and Muyan Hu and Zixuan Ma and Tuowei Wang and Shizhi Tang and Lei Xie and Kezhao Huang and Zhihao Jia},
  title = {{OLLIE: Derivation-based Tensor Program Optimizer}},
  year = {2022},
  eprint = {2208.02025},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2208.02025},
}
Figure