about
LazyTensor: Combining eager execution with domain-specific compilers (arxiv.org)
2 points by matt_d on Mar 1, 2021 | hide | past | pdf | discuss on HN

In plain words: Eager code runs as usual, but each tensor operation is recorded and handed to a compiler that optimizes it for the hardware. Unlike frontends that accept only a limited slice of the language, it keeps the full language and works across chips and languages.

Abstract · LazyTensor: combining eager execution with domain-specific compilers

Domain-specific optimizing compilers have demonstrated significant performance and portability benefits, but require programs to be represented in their specialized IRs. Existing frontends to these compilers suffer from the "language subset problem" where some host language features are unsupported in the subset of the user's program that interacts with the domain-specific compiler. By contrast, define-by-run ML frameworks-colloquially called "eager" mode-are popular due to their ease of use and expressivity, where the full power of the host programming language can be used. LazyTensor is a technique to target domain specific compilers without sacrificing define-by-run ergonomics. Initially developed to support PyTorch on Cloud TPUs, the technique, along with a substantially shared implementation, has been used by Swift for TensorFlow across CPUs, GPUs, and TPUs, demonstrating the generality of the approach across (1) Tensor implementations, (2) hardware accelerators, and (3) programming languages.

Alex Suhan, Davide Libenzi, Ailing Zhang, Parker Schuh, Brennan Saeta, Jie Young Sohn, Denys Shabalin
arXiv:2102.13267 · cs.PL, cs.LG · submitted Feb 26, 2021
abstract · pdf · html

add comment on HN